bug fix and feature

- Fix bug that a pTarget linked to a export pin will raise error.
- Fix bug that a export pOut can't create shortcut correctly.
- Add helper ui in viewer.
- Use std lib rewrite entire exporter.
This commit is contained in:
yyc12345 2020-06-21 16:59:21 +08:00
parent f81d7e5b59
commit 0044f6e24a
15 changed files with 508 additions and 348 deletions

View File

@ -6,7 +6,7 @@
将Virtools文档中的所有脚本导出成一个SQLite数据库文件然后经过Python进行排布处理最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本也适用于其中含有不可展开的`Behavior Graph`的脚本。 将Virtools文档中的所有脚本导出成一个SQLite数据库文件然后经过Python进行排布处理最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本也适用于其中含有不可展开的`Behavior Graph`的脚本。
物化器不能完全恢复脚本的原有排布无论原有排布是否存在物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变例如Export parameter但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式因此物化器只能提供无视脚本隐藏的分析功能。 物化器不能完全恢复脚本的原有排布无论原有排布是否存在物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变例如Export parameter亦或者是与Virtools中的呈现不同但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式因此物化器只能提供无视脚本隐藏的分析功能。
本工程代码源于另两个工程:[BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer)该工程用于将指定脚本导出为JSON文档和[BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation)该工程能够在Virtools 3.5中提供内置的隐藏脚本解析功能将解析结果解析为可以被Virtools识别的格式 本工程代码源于另两个工程:[BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer)该工程用于将指定脚本导出为JSON文档和[BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation)该工程能够在Virtools 3.5中提供内置的隐藏脚本解析功能将解析结果解析为可以被Virtools识别的格式
@ -22,12 +22,21 @@
将导出文件重命名为`export.db`并和`SuperScriptViewer.py`放在一起。然后在此目录中运行`python ./SuperScriptViewer.py`等待Python交互界面提示可以打开本地的网页即可。 将导出文件重命名为`export.db`并和`SuperScriptViewer.py`放在一起。然后在此目录中运行`python ./SuperScriptViewer.py`等待Python交互界面提示可以打开本地的网页即可。
`SuperScriptViewer.py`具有一些命令行开关:
- `-i`:指定输入的`export.db`
- `-o`:指定输出的`decorated.db`,如果已经存在将不考虑输入,直接使用输出数据库呈现
- `-e`:指定输入的`env.db`,环境数据库
- `-f`:无参数,用于强制重新生成输出数据库,无论输出数据库是否存在
以上选项在基本使用中应该不会用到,因此按上述规则直接放置好文件直接运行即可。
### 使用注意 ### 使用注意
- 您需要先安装Virtools, Python和任意一种浏览器才能使用本工程。Python需要先安装`Flask`库。 - 您需要先安装Virtools, Python和任意一种浏览器才能使用本工程。Python需要先安装`Flask`库。
- 导出插件目前只支持Virtools 5后期会支持Virtools 3.5 - 导出插件目前只支持Virtools 5后期会支持Virtools 3.5
- 导出插件选择完文件后卡住或者Python交互界面弹出错误堆栈这可能是设计失误请附带您引起bug的文件提交bug - 导出插件选择完文件后卡住或者Python交互界面弹出错误堆栈这可能是设计失误请附带您引起bug的文件提交bug
- 如果Python交互界面提示数据库`TEXT`类型解码失败,那么可能您需要手动在`DecoratorCore.py`中指定数据库文本解码方式。因为Virtools使用多字节编码依赖于当前操作系统的代码页`DecoratorCore.py`做了特殊获取以保证大多数计算机可以直接运行,但仍然不能排除一些特殊情况。 - 如果Python交互界面提示数据库`TEXT`类型解码失败,那么可能您需要手动在`CustomConfig.py`中的`database_encoding`中指定数据库文本解码方式。因为Virtools使用多字节编码依赖于当前操作系统的代码页`SuperScriptMaterializer`做了特殊获取以保证大多数计算机可以直接运行,但仍然不能排除一些特殊情况。
- 如果您使用本工程的Release页面中提供的已编译好的Virtools界面插件现在因为仍然在开发所以没有您需要放入的`sqlite3.dll`版本应为`sqlite-dll-win32-x86-3310100` - 如果您使用本工程的Release页面中提供的已编译好的Virtools界面插件现在因为仍然在开发所以没有您需要放入的`sqlite3.dll`版本应为`sqlite-dll-win32-x86-3310100`
## 编译 ## 编译
@ -35,3 +44,9 @@
只有Virtools界面插件需要编译其余均为解释性语言无需编译。 只有Virtools界面插件需要编译其余均为解释性语言无需编译。
需要手动配置Virtools插件的编译参数例如包含路径等需要指向您自己的Virtools SDK。对于SQLite SDK您可以从[sqlite.org](http://www.sqlite.org/)下载然后使用Visual C++的工具集执行`LIB /DEF:sqlite3.def /machine:IX86`以获取可以用于编译的文件。 需要手动配置Virtools插件的编译参数例如包含路径等需要指向您自己的Virtools SDK。对于SQLite SDK您可以从[sqlite.org](http://www.sqlite.org/)下载然后使用Visual C++的工具集执行`LIB /DEF:sqlite3.def /machine:IX86`以获取可以用于编译的文件。
## 下一版本计划
第一个版本的开发即将告一段落,下一版本的开放将会加入一直搁置的移动功能。
至于之后的企划可能只包含修复各种Bug的内容因为已做完应该做完的事情了。

View File

@ -16,7 +16,11 @@ void dbScriptDataStructHelper::init(CKParameterManager* paramManager) {
_db_pLocalData = new db_pLocalData(); _db_pLocalData = new db_pLocalData();
_db_pOper = new db_pOper(); _db_pOper = new db_pOper();
_db_eLink = new db_eLink(); _db_eLink = new db_eLink();
_parameterManager = paramManager; _parameterManager = paramManager;
_stringCache = (char*)malloc(STRINGCACHE_SIZE * sizeof(char));
if (_stringCache == NULL)
throw new std::bad_alloc();
} }
void dbScriptDataStructHelper::dispose() { void dbScriptDataStructHelper::dispose() {
@ -33,7 +37,9 @@ void dbScriptDataStructHelper::dispose() {
delete _db_pLocal; delete _db_pLocal;
delete _db_pOper; delete _db_pOper;
delete _db_eLink; delete _db_eLink;
_parameterManager = NULL; _parameterManager = NULL;
free(_stringCache);
} }
void dbEnvDataStructHelper::init() { void dbEnvDataStructHelper::init() {
@ -42,6 +48,10 @@ void dbEnvDataStructHelper::init() {
_db_envMsg = new db_envMsg; _db_envMsg = new db_envMsg;
_db_envAttr = new db_envAttr; _db_envAttr = new db_envAttr;
_db_envPlugin = new db_envPlugin; _db_envPlugin = new db_envPlugin;
_stringCache = (char*)malloc(STRINGCACHE_SIZE * sizeof(char));
if (_stringCache == NULL)
throw new std::bad_alloc();
} }
void dbEnvDataStructHelper::dispose() { void dbEnvDataStructHelper::dispose() {
@ -50,6 +60,8 @@ void dbEnvDataStructHelper::dispose() {
delete _db_envMsg; delete _db_envMsg;
delete _db_envAttr; delete _db_envAttr;
delete _db_envPlugin; delete _db_envPlugin;
free(_stringCache);
} }
#pragma endregion #pragma endregion
@ -59,8 +71,7 @@ void dbEnvDataStructHelper::dispose() {
void database::open(const char* file) { void database::open(const char* file) {
db = NULL; db = NULL;
errmsg = (char*)calloc(256, sizeof(char)); stmtCache = new std::vector<sqlite3_stmt*>(13, NULL);
commandStr = (char*)calloc(2048, sizeof(char));
//open db //open db
int result; int result;
@ -82,139 +93,148 @@ void database::close() {
//release res //release res
sqlite3_close(db); sqlite3_close(db);
db = NULL; db = NULL;
delete stmtCache;
free(errmsg);
free(commandStr);
} }
BOOL scriptDatabase::init() { BOOL scriptDatabase::init() {
int result; int result;
result = sqlite3_exec(db, "PRAGMA synchronous = OFF;", NULL, NULL, &errmsg); result = sqlite3_exec(db, "PRAGMA synchronous = OFF;", NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
//init table //init table
result = sqlite3_exec(db, "begin;", NULL, NULL, &errmsg); result = sqlite3_exec(db, "begin;", NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE script([thisobj] INTEGER, [name] TEXT, [index] INTEGER, [behavior] INTEGER);", "CREATE TABLE script([thisobj] INTEGER, [name] TEXT, [index] INTEGER, [behavior] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE behavior([thisobj] INTEGER, [name] TEXT, [type] INTEGER, [proto_name] TEXT, [proto_guid] TEXT, [flags] INTEGER, [priority] INTEGER, [version] INTEGER, [pin_count] TEXT, [parent] INTEGER);", "CREATE TABLE behavior([thisobj] INTEGER, [name] TEXT, [type] INTEGER, [proto_name] TEXT, [proto_guid] TEXT, [flags] INTEGER, [priority] INTEGER, [version] INTEGER, [pin_count] TEXT, [parent] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pTarget([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [belong_to] INTEGER, [direct_source] INTEGER, [shard_source] INTEGER);", "CREATE TABLE pTarget([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [belong_to] INTEGER, [direct_source] INTEGER, [shard_source] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pIn([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [belong_to] INTEGER, [direct_source] INTEGER, [shard_source] INTEGER);", "CREATE TABLE pIn([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [belong_to] INTEGER, [direct_source] INTEGER, [shard_source] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pOut([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [belong_to] INTEGER);", "CREATE TABLE pOut([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE bIn([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [belong_to] INTEGER);", "CREATE TABLE bIn([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE bOut([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [belong_to] INTEGER);", "CREATE TABLE bOut([thisobj] INTEGER, [index] INTEGER, [name] TEXT, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE bLink([input] INTEGER, [output] INTEGER, [delay] INTEGER, [input_obj] INTEGER, [input_type] INTEGER, [input_index] INETEGR, [output_obj] INTEGER, [output_type] INTEGER, [output_index] INETEGR, [belong_to] INTEGER);", "CREATE TABLE bLink([input] INTEGER, [output] INTEGER, [delay] INTEGER, [input_obj] INTEGER, [input_type] INTEGER, [input_index] INETEGR, [output_obj] INTEGER, [output_type] INTEGER, [output_index] INETEGR, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pLocal([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [is_setting] INTEGER, [belong_to] INTEGER);", "CREATE TABLE pLocal([thisobj] INTEGER, [name] TEXT, [type] TEXT, [type_guid] TEXT, [is_setting] INTEGER, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pLocalData([field] TEXT, [data] TEXT, [belong_to] INTEGER);", "CREATE TABLE pLocalData([field] TEXT, [data] TEXT, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pLink([input] INTEGER, [output] INTEGER, [input_obj] INTEGER, [input_type] INTEGER, [input_is_bb] INTEGER, [input_index] INETEGR, [output_obj] INTEGER, [output_type] INTEGER, [output_is_bb] INTEGER, [output_index] INETEGR, [belong_to] INTEGER);", "CREATE TABLE pLink([input] INTEGER, [output] INTEGER, [input_obj] INTEGER, [input_type] INTEGER, [input_is_bb] INTEGER, [input_index] INETEGR, [output_obj] INTEGER, [output_type] INTEGER, [output_is_bb] INTEGER, [output_index] INETEGR, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE pOper([thisobj] INTEGER, [op] TEXT, [op_guid] TEXT, [belong_to] INTEGER);", "CREATE TABLE pOper([thisobj] INTEGER, [op] TEXT, [op_guid] TEXT, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE eLink([export_obj] INTEGER, [internal_obj] INTEGER, [is_in] INTEGER, [index] INTEGER, [belong_to] INTEGER);", "CREATE TABLE eLink([export_obj] INTEGER, [internal_obj] INTEGER, [is_in] INTEGER, [index] INTEGER, [belong_to] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, "commit;", NULL, NULL, &errmsg); result = sqlite3_exec(db, "commit;", NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
//start job //start job
sqlite3_exec(db, "begin;", NULL, NULL, &errmsg); sqlite3_exec(db, "begin;", NULL, NULL, NULL);
return TRUE; return TRUE;
} }
BOOL scriptDatabase::finalJob() { BOOL scriptDatabase::finalJob() {
//stop job //stop job
sqlite3_exec(db, "commit;", NULL, NULL, &errmsg); for (auto it = stmtCache->begin(); it != stmtCache->end(); it++) {
if (*it != NULL)
sqlite3_finalize(*it);
}
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
//create index for quick select in following app //create index for quick select in following app
/*sqlite3_exec(db, "begin;", NULL, NULL, &errmsg); /*sqlite3_exec(db, "begin;", NULL, NULL, NULL);
sqlite3_exec(db, "CREATE INDEX [quick_where1] ON bIn (thisobj)", NULL, NULL, &errmsg); sqlite3_exec(db, "CREATE INDEX [quick_where1] ON bIn (thisobj)", NULL, NULL, NULL);
sqlite3_exec(db, "CREATE INDEX [quick_where2] ON bOut (thisobj)", NULL, NULL, &errmsg); sqlite3_exec(db, "CREATE INDEX [quick_where2] ON bOut (thisobj)", NULL, NULL, NULL);
sqlite3_exec(db, "CREATE INDEX [quick_where3] ON pIn (thisobj)", NULL, NULL, &errmsg); sqlite3_exec(db, "CREATE INDEX [quick_where3] ON pIn (thisobj)", NULL, NULL, NULL);
sqlite3_exec(db, "CREATE INDEX [quick_where4] ON pOut (thisobj)", NULL, NULL, &errmsg); sqlite3_exec(db, "CREATE INDEX [quick_where4] ON pOut (thisobj)", NULL, NULL, NULL);
sqlite3_exec(db, "commit;", NULL, NULL, &errmsg);*/ sqlite3_exec(db, "commit;", NULL, NULL, NULL);*/
return TRUE; return TRUE;
} }
BOOL envDatabase::init() { BOOL envDatabase::init() {
stmtCache = new std::vector<sqlite3_stmt*>(5, NULL);
int result; int result;
result = sqlite3_exec(db, "PRAGMA synchronous = OFF;", NULL, NULL, &errmsg); result = sqlite3_exec(db, "PRAGMA synchronous = OFF;", NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
//init table //init table
result = sqlite3_exec(db, "begin;", NULL, NULL, &errmsg); result = sqlite3_exec(db, "begin;", NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE op([funcptr] INTEGER, [in1_guid] TEXT, [in2_guid] TEXT, [out_guid] TEXT, [op_guid] INTEGER, [op_name] TEXT, [op_code] INTEGER);", "CREATE TABLE op([funcptr] INTEGER, [in1_guid] TEXT, [in2_guid] TEXT, [out_guid] TEXT, [op_guid] INTEGER, [op_name] TEXT, [op_code] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE param([index] INTEGER, [guid] TEXT, [derived_from] TEXT, [type_name] TEXT, [default_size] INTEGER, [func_CreateDefault] INTEGER, [func_Delete] INTEGER, [func_SaveLoad] INTEGER, [func_Check] INTEGER, [func_Copy] INTEGER, [func_String] INTEGER, [func_UICreator] INTEGER, [creator_dll_index] INTEGER, [creator_plugin_index] INTEGER, [dw_param] INTEGER, [dw_flags] INTEGER, [cid] INTEGER, [saver_manager] TEXT);", "CREATE TABLE param([index] INTEGER, [guid] TEXT, [derived_from] TEXT, [type_name] TEXT, [default_size] INTEGER, [func_CreateDefault] INTEGER, [func_Delete] INTEGER, [func_SaveLoad] INTEGER, [func_Check] INTEGER, [func_Copy] INTEGER, [func_String] INTEGER, [func_UICreator] INTEGER, [creator_dll_index] INTEGER, [creator_plugin_index] INTEGER, [dw_param] INTEGER, [dw_flags] INTEGER, [cid] INTEGER, [saver_manager] TEXT);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE msg([index] INTEGER, [name] TEXT);", "CREATE TABLE msg([index] INTEGER, [name] TEXT);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE attr([index] INTEGER, [name] TEXT, [category_index] INTEGER, [category_name] TEXT, [flags] INTEGER, [param_index] INTEGER, [compatible_classid] INTEGER, [default_value] TEXT);", "CREATE TABLE attr([index] INTEGER, [name] TEXT, [category_index] INTEGER, [category_name] TEXT, [flags] INTEGER, [param_index] INTEGER, [compatible_classid] INTEGER, [default_value] TEXT);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, result = sqlite3_exec(db,
"CREATE TABLE plugin([dll_index] INTEGER, [dll_name] TEXT, [plugin_index] INTEGER, [category] TEXT, [active] INTEGER, [needed_by_file] INTEGER, [guid] TEXT, [desc] TEXT, [author] TEXT, [summary] TEXT, [version] INTEGER, [func_init] INTEGER, [func_exit] INTEGER);", "CREATE TABLE plugin([dll_index] INTEGER, [dll_name] TEXT, [plugin_index] INTEGER, [category] TEXT, [active] INTEGER, [needed_by_file] INTEGER, [guid] TEXT, [desc] TEXT, [author] TEXT, [summary] TEXT, [version] INTEGER, [func_init] INTEGER, [func_exit] INTEGER);",
NULL, NULL, &errmsg); NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
result = sqlite3_exec(db, "commit;", NULL, NULL, &errmsg); result = sqlite3_exec(db, "commit;", NULL, NULL, NULL);
if (result != SQLITE_OK) return FALSE; if (result != SQLITE_OK) return FALSE;
//start job //start job
sqlite3_exec(db, "begin;", NULL, NULL, &errmsg); sqlite3_exec(db, "begin;", NULL, NULL, NULL);
return TRUE; return TRUE;
} }
BOOL envDatabase::finalJob() { BOOL envDatabase::finalJob() {
//stop job //stop job
sqlite3_exec(db, "commit;", NULL, NULL, &errmsg); for (auto it = stmtCache->begin(); it != stmtCache->end(); it++) {
if (*it != NULL)
sqlite3_finalize(*it);
}
sqlite3_exec(db, "commit;", NULL, NULL, NULL);
return TRUE; return TRUE;
} }
@ -223,293 +243,318 @@ BOOL envDatabase::finalJob() {
#pragma region write func #pragma region write func
#define tryGetStmt(index,defaultStr) stmt=(*stmtCache)[index];if(stmt==NULL){sqlite3_prepare_v2(db,defaultStr,-1,&stmt,NULL);(*stmtCache)[index]=stmt;}
void scriptDatabase::write_CKBehavior(dbCKBehavior* data) { void scriptDatabase::write_CKBehavior(dbCKBehavior* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO behavior VALUES (%d, '%s', %d, '%s', '%d, %d', %d, %d, %d, '%s', %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(0, "INSERT INTO behavior VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
data->name, sqlite3_reset(stmt);
data->type,
data->proto_name,
data->proto_guid[0],
data->proto_guid[1],
data->flags,
data->priority,
data->version,
data->pin_count,
data->parent);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_text(stmt, 2, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data->type);
sqlite3_bind_text(stmt, 4, data->proto_name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, data->proto_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 6, data->flags);
sqlite3_bind_int(stmt, 7, data->priority);
sqlite3_bind_int(stmt, 8, data->version);
sqlite3_bind_text(stmt, 9, data->pin_count.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 10, data->parent);
sqlite3_step(stmt);
} }
void scriptDatabase::write_CKScript(dbCKScript* data) { void scriptDatabase::write_CKScript(dbCKScript* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO script VALUES (%d, '%s', %d, %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(1, "INSERT INTO script VALUES (?, ?, ?, ?)");
data->host_name, sqlite3_reset(stmt);
data->index,
data->behavior);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_text(stmt, 2, data->host_name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data->index);
sqlite3_bind_int(stmt, 4, data->behavior);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pTarget(db_pTarget* data) { void scriptDatabase::write_pTarget(db_pTarget* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pTarget VALUES (%d, '%s', '%s', '%d, %d', %d, %d, %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(2, "INSERT INTO pTarget VALUES (?, ?, ?, ?, ?, ?, ?)");
data->name, sqlite3_reset(stmt);
data->type,
data->type_guid[0],
data->type_guid[1],
data->belong_to,
data->direct_source,
data->shared_source);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_text(stmt, 2, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 3, data->type.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, data->type_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 5, data->belong_to);
sqlite3_bind_int(stmt, 6, data->direct_source);
sqlite3_bind_int(stmt, 7, data->shared_source);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pIn(db_pIn* data) { void scriptDatabase::write_pIn(db_pIn* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pIn VALUES (%d, %d, '%s', '%s', '%d, %d', %d, %d, %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(3, "INSERT INTO pIn VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
data->index, sqlite3_reset(stmt);
data->name,
data->type,
data->type_guid[0],
data->type_guid[1],
data->belong_to,
data->direct_source,
data->shared_source);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_int(stmt, 2, data->index);
sqlite3_bind_text(stmt, 3, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, data->type.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, data->type_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 6, data->belong_to);
sqlite3_bind_int(stmt, 7, data->direct_source);
sqlite3_bind_int(stmt, 8, data->shared_source);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pOut(db_pOut* data) { void scriptDatabase::write_pOut(db_pOut* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pOut VALUES (%d, %d, '%s', '%s', '%d, %d', %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(4, "INSERT INTO pOut VALUES (?, ?, ?, ?, ?, ?)");
data->index, sqlite3_reset(stmt);
data->name,
data->type,
data->type_guid[0],
data->type_guid[1],
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_int(stmt, 2, data->index);
sqlite3_bind_text(stmt, 3, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, data->type.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, data->type_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 6, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_bIn(db_bIn* data) { void scriptDatabase::write_bIn(db_bIn* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO bIn VALUES (%d, %d, '%s', %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(5, "INSERT INTO bIn VALUES (?, ?, ?, ?)");
data->index, sqlite3_reset(stmt);
data->name,
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_int(stmt, 2, data->index);
sqlite3_bind_text(stmt, 3, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 4, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_bOut(db_bOut* data) { void scriptDatabase::write_bOut(db_bOut* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO bOut VALUES (%d, %d, '%s', %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(6, "INSERT INTO bOut VALUES (?, ?, ?, ?)");
data->index, sqlite3_reset(stmt);
data->name,
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_int(stmt, 2, data->index);
sqlite3_bind_text(stmt, 3, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 4, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_bLink(db_bLink* data) { void scriptDatabase::write_bLink(db_bLink* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO bLink VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d);", sqlite3_stmt* stmt = NULL;
data->input, tryGetStmt(7, "INSERT INTO bLink VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
data->output, sqlite3_reset(stmt);
data->delay,
data->input_obj,
data->input_type,
data->input_index,
data->output_obj,
data->output_type,
data->output_index,
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->input);
sqlite3_bind_int(stmt, 2, data->output);
sqlite3_bind_int(stmt, 3, data->delay);
sqlite3_bind_int(stmt, 4, data->input_obj);
sqlite3_bind_int(stmt, 5, data->input_type);
sqlite3_bind_int(stmt, 6, data->input_index);
sqlite3_bind_int(stmt, 7, data->output_obj);
sqlite3_bind_int(stmt, 8, data->output_type);
sqlite3_bind_int(stmt, 9, data->output_index);
sqlite3_bind_int(stmt, 10, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pLocal(db_pLocal* data) { void scriptDatabase::write_pLocal(db_pLocal* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pLocal VALUES (%d, '%s', '%s', '%d, %d', %d, %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(8, "INSERT INTO pLocal VALUES (?, ?, ?, ?, ?, ?)");
data->name, sqlite3_reset(stmt);
data->type,
data->type_guid[0],
data->type_guid[1],
data->is_setting,
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_text(stmt, 2, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 3, data->type.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, data->type_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 5, data->is_setting);
sqlite3_bind_int(stmt, 6, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pLink(db_pLink* data) { void scriptDatabase::write_pLink(db_pLink* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pLink VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);", sqlite3_stmt* stmt = NULL;
data->input, tryGetStmt(9, "INSERT INTO pLink VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
data->output, sqlite3_reset(stmt);
data->input_obj,
data->input_type,
data->input_is_bb,
data->input_index,
data->output_obj,
data->output_type,
data->output_is_bb,
data->output_index,
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->input);
sqlite3_bind_int(stmt, 2, data->output);
sqlite3_bind_int(stmt, 3, data->input_obj);
sqlite3_bind_int(stmt, 4, data->input_type);
sqlite3_bind_int(stmt, 5, data->input_is_bb);
sqlite3_bind_int(stmt, 6, data->input_index);
sqlite3_bind_int(stmt, 7, data->output_obj);
sqlite3_bind_int(stmt, 8, data->output_type);
sqlite3_bind_int(stmt, 9, data->output_is_bb);
sqlite3_bind_int(stmt, 10, data->output_index);
sqlite3_bind_int(stmt, 11, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pLocalData(db_pLocalData* data) { void scriptDatabase::write_pLocalData(db_pLocalData* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pLocalData VALUES ('%s', '%s', %d);", sqlite3_stmt* stmt = NULL;
data->field, tryGetStmt(10, "INSERT INTO pLocalData VALUES (?, ?, ?)");
data->data, sqlite3_reset(stmt);
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_text(stmt, 1, data->field.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, data->data.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_pOper(db_pOper* data) { void scriptDatabase::write_pOper(db_pOper* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO pOper VALUES (%d, '%s', '%d, %d', %d);", sqlite3_stmt* stmt = NULL;
data->thisobj, tryGetStmt(11, "INSERT INTO pOper VALUES (?, ?, ?, ?)");
data->op, sqlite3_reset(stmt);
data->op_guid[0],
data->op_guid[1],
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->thisobj);
sqlite3_bind_text(stmt, 2, data->op.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 3, data->op_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 4, data->belong_to);
sqlite3_step(stmt);
} }
void scriptDatabase::write_eLink(db_eLink* data) { void scriptDatabase::write_eLink(db_eLink* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO eLink VALUES (%d, %d, %d, %d, %d);", sqlite3_stmt* stmt = NULL;
data->export_obj, tryGetStmt(12, "INSERT INTO eLink VALUES (?, ?, ?, ?, ?)");
data->internal_obj, sqlite3_reset(stmt);
data->is_in,
data->index,
data->belong_to);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->export_obj);
sqlite3_bind_int(stmt, 2, data->internal_obj);
sqlite3_bind_int(stmt, 3, data->is_in);
sqlite3_bind_int(stmt, 4, data->index);
sqlite3_bind_int(stmt, 5, data->belong_to);
sqlite3_step(stmt);
} }
void envDatabase::write_envOp(db_envOp* data) { void envDatabase::write_envOp(db_envOp* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO op VALUES (%d, '%d,%d', '%d,%d', '%d,%d', '%d,%d', '%s', %d);", sqlite3_stmt* stmt = NULL;
data->funcPtr, tryGetStmt(0, "INSERT INTO op VALUES (?, ?, ?, ?, ?, ?, ?)");
data->in1_guid[0], sqlite3_reset(stmt);
data->in1_guid[1],
data->in2_guid[0],
data->in2_guid[1],
data->out_guid[0],
data->out_guid[1],
data->op_guid[0],
data->op_guid[1],
data->op_name,
data->op_code);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, (int)data->funcPtr);
sqlite3_bind_text(stmt, 2, data->in1_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 3, data->in2_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, data->out_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, data->op_guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 6, data->op_name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 7, data->op_code);
sqlite3_step(stmt);
} }
void envDatabase::write_envParam(db_envParam* data) { void envDatabase::write_envParam(db_envParam* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO param VALUES (%d, '%d,%d', '%d,%d', '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%d,%d');", sqlite3_stmt* stmt = NULL;
data->index, tryGetStmt(1, "INSERT INTO param VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
data->guid[0], sqlite3_reset(stmt);
data->guid[1],
data->derived_from[0],
data->derived_from[1],
data->type_name,
data->default_size,
data->func_CreateDefault,
data->func_Delete,
data->func_SaveLoad,
data->func_Check,
data->func_Copy,
data->func_String,
data->func_UICreator,
data->creator_dll_index,
data->creator_plugin_index,
data->dw_param,
data->dw_flags,
data->cid,
data->saver_manager[0],
data->saver_manager[1]);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->index);
sqlite3_bind_text(stmt, 2, data->guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 3, data->derived_from.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 4, data->type_name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 5, data->default_size);
sqlite3_bind_int(stmt, 6, (int)data->func_CreateDefault);
sqlite3_bind_int(stmt, 7, (int)data->func_Delete);
sqlite3_bind_int(stmt, 8, (int)data->func_SaveLoad);
sqlite3_bind_int(stmt, 9, (int)data->func_Check);
sqlite3_bind_int(stmt, 10, (int)data->func_Copy);
sqlite3_bind_int(stmt, 11, (int)data->func_String);
sqlite3_bind_int(stmt, 12, (int)data->func_UICreator);
sqlite3_bind_int(stmt, 13, data->creator_dll_index);
sqlite3_bind_int(stmt, 14, data->creator_plugin_index);
sqlite3_bind_int(stmt, 15, data->dw_param);
sqlite3_bind_int(stmt, 16, data->dw_flags);
sqlite3_bind_int(stmt, 17, data->cid);
sqlite3_bind_text(stmt, 18, data->saver_manager.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_step(stmt);
} }
void envDatabase::write_envMsg(db_envMsg* data) { void envDatabase::write_envMsg(db_envMsg* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO msg VALUES (%d, '%s');", sqlite3_stmt* stmt = NULL;
data->index, tryGetStmt(2, "INSERT INTO msg VALUES (?, ?)");
data->name); sqlite3_reset(stmt);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->index);
sqlite3_bind_text(stmt, 2, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_step(stmt);
} }
void envDatabase::write_envAttr(db_envAttr* data) { void envDatabase::write_envAttr(db_envAttr* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO attr VALUES (%d, '%s', %d, '%s', %d, %d, %d, '%s');", sqlite3_stmt* stmt = NULL;
data->index, tryGetStmt(3, "INSERT INTO attr VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
data->name, sqlite3_reset(stmt);
data->category_index,
data->category_name,
data->flags,
data->param_index,
data->compatible_classid,
data->default_value);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->index);
sqlite3_bind_text(stmt, 2, data->name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data->category_index);
sqlite3_bind_text(stmt, 4, data->category_name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 5, data->flags);
sqlite3_bind_int(stmt, 6, data->param_index);
sqlite3_bind_int(stmt, 7, data->compatible_classid);
sqlite3_bind_text(stmt, 8, data->default_value.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_step(stmt);
} }
void envDatabase::write_envPlugin(db_envPlugin* data) { void envDatabase::write_envPlugin(db_envPlugin* data) {
if (db == NULL) return; if (db == NULL) return;
sprintf(commandStr, "INSERT INTO plugin VALUES (%d, '%s', %d, '%s', %d, %d, '%d,%d', '%s', '%s', '%s', %d, %d, %d);", sqlite3_stmt* stmt = NULL;
data->dll_index, tryGetStmt(4, "INSERT INTO plugin VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
data->dll_name, sqlite3_reset(stmt);
data->plugin_index,
data->category,
data->active,
data->needed_by_file,
data->guid[0],
data->guid[1],
data->desc,
data->author,
data->summary,
data->version,
data->func_init,
data->func_exit);
sqlite3_exec(db, commandStr, NULL, NULL, &errmsg); sqlite3_bind_int(stmt, 1, data->dll_index);
sqlite3_bind_text(stmt, 2, data->dll_name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 3, data->plugin_index);
sqlite3_bind_text(stmt, 4, data->category.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 5, data->active);
sqlite3_bind_int(stmt, 6, data->needed_by_file);
sqlite3_bind_text(stmt, 7, data->guid.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 8, data->desc.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 9, data->author.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 10, data->summary.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 11, data->version);
sqlite3_bind_int(stmt, 12, (int)data->func_init);
sqlite3_bind_int(stmt, 13, (int)data->func_exit);
sqlite3_step(stmt);
} }
#undef tryGetStmt
#pragma endregion #pragma endregion

View File

@ -3,6 +3,10 @@
#include <sqlite3.h> #include <sqlite3.h>
#include "stdafx.h" #include "stdafx.h"
#include <string>
#include <vector>
#define STRINGCACHE_SIZE 25565
typedef long EXPAND_CK_ID; typedef long EXPAND_CK_ID;
enum bLinkInputOutputType { enum bLinkInputOutputType {
@ -20,30 +24,30 @@ enum pLinkInputOutputType {
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
char name[1024]; std::string name;
CK_BEHAVIOR_TYPE type; CK_BEHAVIOR_TYPE type;
char proto_name[1024]; std::string proto_name;
CKDWORD proto_guid[2]; std::string proto_guid;
CK_BEHAVIOR_FLAGS flags; CK_BEHAVIOR_FLAGS flags;
int priority; int priority;
CKDWORD version; CKDWORD version;
//pTarget, pIn, pOut, bIn, bOut //pTarget, pIn, pOut, bIn, bOut
char pin_count[128]; std::string pin_count;
EXPAND_CK_ID parent; EXPAND_CK_ID parent;
}dbCKBehavior; }dbCKBehavior;
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
char host_name[1024]; std::string host_name;
int index; int index;
EXPAND_CK_ID behavior; EXPAND_CK_ID behavior;
}dbCKScript; }dbCKScript;
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
char name[1024]; std::string name;
char type[1024]; std::string type;
CKDWORD type_guid[2]; std::string type_guid;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
EXPAND_CK_ID direct_source; EXPAND_CK_ID direct_source;
EXPAND_CK_ID shared_source; EXPAND_CK_ID shared_source;
@ -52,9 +56,9 @@ typedef struct {
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
int index; int index;
char name[1024]; std::string name;
char type[1024]; std::string type;
CKDWORD type_guid[2]; std::string type_guid;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
EXPAND_CK_ID direct_source; EXPAND_CK_ID direct_source;
EXPAND_CK_ID shared_source; EXPAND_CK_ID shared_source;
@ -63,16 +67,16 @@ typedef struct {
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
int index; int index;
char name[1024]; std::string name;
char type[1024]; std::string type;
CKDWORD type_guid[2]; std::string type_guid;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
}db_pOut; }db_pOut;
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
int index; int index;
char name[1024]; std::string name;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
}db_bIO; }db_bIO;
typedef db_bIO db_bIn; typedef db_bIO db_bIn;
@ -95,16 +99,16 @@ typedef struct {
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
char name[1024]; std::string name;
char type[1024]; std::string type;
CKDWORD type_guid[2]; std::string type_guid;
BOOL is_setting; BOOL is_setting;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
}db_pLocal; }db_pLocal;
typedef struct { typedef struct {
char field[1024]; std::string field;
char data[1024]; std::string data;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
}db_pLocalData; }db_pLocalData;
@ -126,8 +130,8 @@ typedef struct {
typedef struct { typedef struct {
EXPAND_CK_ID thisobj; EXPAND_CK_ID thisobj;
char op[1024]; std::string op;
CKDWORD op_guid[2]; std::string op_guid;
EXPAND_CK_ID belong_to; EXPAND_CK_ID belong_to;
}db_pOper; }db_pOper;
@ -143,19 +147,19 @@ typedef struct {
typedef struct { typedef struct {
CK_PARAMETEROPERATION funcPtr; CK_PARAMETEROPERATION funcPtr;
CKDWORD in1_guid[2]; std::string in1_guid;
CKDWORD in2_guid[2]; std::string in2_guid;
CKDWORD out_guid[2]; std::string out_guid;
CKDWORD op_guid[2]; std::string op_guid;
char op_name[1024]; std::string op_name;
CKOperationType op_code; CKOperationType op_code;
}db_envOp; }db_envOp;
typedef struct { typedef struct {
CKParameterType index; CKParameterType index;
CKDWORD guid[2]; std::string guid;
CKDWORD derived_from[2]; std::string derived_from;
char type_name[1024]; std::string type_name;
int default_size; int default_size;
CK_PARAMETERCREATEDEFAULTFUNCTION func_CreateDefault; CK_PARAMETERCREATEDEFAULTFUNCTION func_CreateDefault;
CK_PARAMETERDELETEFUNCTION func_Delete; CK_PARAMETERDELETEFUNCTION func_Delete;
@ -169,36 +173,36 @@ typedef struct {
CKDWORD dw_param; CKDWORD dw_param;
CKDWORD dw_flags; CKDWORD dw_flags;
CKDWORD cid; CKDWORD cid;
CKDWORD saver_manager[2]; std::string saver_manager;
}db_envParam; }db_envParam;
typedef struct { typedef struct {
CKMessageType index; CKMessageType index;
char name[1024]; std::string name;
}db_envMsg; }db_envMsg;
typedef struct { typedef struct {
CKAttributeType index; CKAttributeType index;
char name[1024]; std::string name;
CKAttributeCategory category_index; CKAttributeCategory category_index;
char category_name[1024]; std::string category_name;
CK_ATTRIBUT_FLAGS flags; CK_ATTRIBUT_FLAGS flags;
CKParameterType param_index; CKParameterType param_index;
CK_CLASSID compatible_classid; CK_CLASSID compatible_classid;
char default_value[1024]; std::string default_value;
}db_envAttr; }db_envAttr;
typedef struct { typedef struct {
int dll_index; int dll_index;
char dll_name[1024]; std::string dll_name;
int plugin_index; int plugin_index;
char category[1024]; std::string category;
CKBOOL active; CKBOOL active;
CKBOOL needed_by_file; CKBOOL needed_by_file;
CKDWORD guid[2]; std::string guid;
char desc[1024]; std::string desc;
char author[1024]; std::string author;
char summary[1024]; std::string summary;
DWORD version; DWORD version;
CK_INITINSTANCEFCT func_init; CK_INITINSTANCEFCT func_init;
CK_EXITINSTANCEFCT func_exit; CK_EXITINSTANCEFCT func_exit;
@ -211,6 +215,7 @@ class dbScriptDataStructHelper {
void init(CKParameterManager* paramManager); void init(CKParameterManager* paramManager);
void dispose(); void dispose();
char* _stringCache;
CKParameterManager* _parameterManager; CKParameterManager* _parameterManager;
dbCKBehavior* _dbCKBehavior; dbCKBehavior* _dbCKBehavior;
dbCKScript* _dbCKScript; dbCKScript* _dbCKScript;
@ -232,6 +237,7 @@ class dbEnvDataStructHelper {
void init(); void init();
void dispose(); void dispose();
char* _stringCache;
db_envOp* _db_envOp; db_envOp* _db_envOp;
db_envParam* _db_envParam; db_envParam* _db_envParam;
db_envMsg* _db_envMsg; db_envMsg* _db_envMsg;
@ -250,8 +256,7 @@ class database {
virtual BOOL finalJob() { return TRUE; } virtual BOOL finalJob() { return TRUE; }
sqlite3* db; sqlite3* db;
char* errmsg; std::vector<sqlite3_stmt*>* stmtCache;
char* commandStr;
}; };
class scriptDatabase : public database { class scriptDatabase : public database {

View File

@ -2,6 +2,8 @@
//disable shit tip //disable shit tip
#pragma warning(disable:26812) #pragma warning(disable:26812)
#define copyGuid(guid,str) sprintf(helper->_stringCache,"%d,%d",guid.d1,guid.d2);str=helper->_stringCache;
void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper) { void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper) {
int count = parameterManager->GetParameterOperationCount(); int count = parameterManager->GetParameterOperationCount();
CKOperationDesc* opList = NULL; CKOperationDesc* opList = NULL;
@ -11,8 +13,8 @@ void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase
//fill basic data //fill basic data
helper->_db_envOp->op_code = i; helper->_db_envOp->op_code = i;
_guid = parameterManager->OperationCodeToGuid(i); _guid = parameterManager->OperationCodeToGuid(i);
cp_guid(helper->_db_envOp->op_guid, _guid); copyGuid(_guid,helper->_db_envOp->op_guid);
strcpy(helper->_db_envOp->op_name, parameterManager->OperationCodeToName(i)); helper->_db_envOp->op_name = parameterManager->OperationCodeToName(i);
//allocate mem //allocate mem
cacheListCount = parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, NULL); cacheListCount = parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, NULL);
@ -24,9 +26,9 @@ void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase
parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, opList); parameterManager->GetAvailableOperationsDesc(_guid, NULL, NULL, NULL, opList);
for (int j = 0; j < cacheListCount; j++) { for (int j = 0; j < cacheListCount; j++) {
cp_guid(helper->_db_envOp->in1_guid, opList[j].P1Guid); copyGuid(opList[j].P1Guid, helper->_db_envOp->in1_guid);
cp_guid(helper->_db_envOp->in2_guid, opList[j].P2Guid); copyGuid(opList[j].P2Guid, helper->_db_envOp->in2_guid);
cp_guid(helper->_db_envOp->out_guid, opList[j].ResGuid); copyGuid(opList[j].ResGuid, helper->_db_envOp->out_guid);
helper->_db_envOp->funcPtr = opList[j].Fct; helper->_db_envOp->funcPtr = opList[j].Fct;
db->write_envOp(helper->_db_envOp); db->write_envOp(helper->_db_envOp);
@ -43,9 +45,9 @@ void IterateParameter(CKParameterManager* parameterManager, envDatabase* db, dbE
desc = parameterManager->GetParameterTypeDescription(i); desc = parameterManager->GetParameterTypeDescription(i);
helper->_db_envParam->index = desc->Index; helper->_db_envParam->index = desc->Index;
cp_guid(helper->_db_envParam->guid, desc->Guid); copyGuid(desc->Guid, helper->_db_envParam->guid);
cp_guid(helper->_db_envParam->derived_from, desc->DerivedFrom); copyGuid(desc->DerivedFrom, helper->_db_envParam->derived_from);
strcpy(helper->_db_envParam->type_name, desc->TypeName.CStr()); helper->_db_envParam->type_name = desc->TypeName.CStr();
helper->_db_envParam->default_size = desc->DefaultSize; helper->_db_envParam->default_size = desc->DefaultSize;
helper->_db_envParam->func_CreateDefault = desc->CreateDefaultFunction; helper->_db_envParam->func_CreateDefault = desc->CreateDefaultFunction;
helper->_db_envParam->func_Delete = desc->DeleteFunction; helper->_db_envParam->func_Delete = desc->DeleteFunction;
@ -65,7 +67,7 @@ void IterateParameter(CKParameterManager* parameterManager, envDatabase* db, dbE
helper->_db_envParam->dw_param = desc->dwParam; helper->_db_envParam->dw_param = desc->dwParam;
helper->_db_envParam->dw_flags = desc->dwFlags; helper->_db_envParam->dw_flags = desc->dwFlags;
helper->_db_envParam->cid = desc->Cid; helper->_db_envParam->cid = desc->Cid;
cp_guid(helper->_db_envParam->saver_manager, desc->Saver_Manager); copyGuid(desc->Saver_Manager, helper->_db_envParam->saver_manager);
db->write_envParam(helper->_db_envParam); db->write_envParam(helper->_db_envParam);
} }
@ -75,7 +77,7 @@ void IterateMessage(CKMessageManager* msgManager, envDatabase* db, dbEnvDataStru
int count = msgManager->GetMessageTypeCount(); int count = msgManager->GetMessageTypeCount();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
helper->_db_envMsg->index = i; helper->_db_envMsg->index = i;
strcpy(helper->_db_envMsg->name, msgManager->GetMessageTypeName(i)); helper->_db_envMsg->name = msgManager->GetMessageTypeName(i);
db->write_envMsg(helper->_db_envMsg); db->write_envMsg(helper->_db_envMsg);
} }
@ -85,13 +87,13 @@ void IterateAttribute(CKAttributeManager* attrManager, envDatabase* db, dbEnvDat
int count = attrManager->GetAttributeCount(); int count = attrManager->GetAttributeCount();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
helper->_db_envAttr->index = i; helper->_db_envAttr->index = i;
strcpy(helper->_db_envAttr->name, attrManager->GetAttributeNameByType(i)); helper->_db_envAttr->name = attrManager->GetAttributeNameByType(i);
helper->_db_envAttr->category_index = attrManager->GetAttributeCategoryIndex(i); helper->_db_envAttr->category_index = attrManager->GetAttributeCategoryIndex(i);
strcpy(helper->_db_envAttr->category_name, attrManager->GetAttributeCategory(i) != NULL ? attrManager->GetAttributeCategory(i) : ""); helper->_db_envAttr->category_name = attrManager->GetAttributeCategory(i) != NULL ? attrManager->GetAttributeCategory(i) : "";
helper->_db_envAttr->flags = attrManager->GetAttributeFlags(i); helper->_db_envAttr->flags = attrManager->GetAttributeFlags(i);
helper->_db_envAttr->param_index = attrManager->GetAttributeParameterType(i); helper->_db_envAttr->param_index = attrManager->GetAttributeParameterType(i);
helper->_db_envAttr->compatible_classid = attrManager->GetAttributeCompatibleClassId(i); helper->_db_envAttr->compatible_classid = attrManager->GetAttributeCompatibleClassId(i);
strcpy(helper->_db_envAttr->default_value, attrManager->GetAttributeDefaultValue(i) != NULL ? attrManager->GetAttributeDefaultValue(i) : ""); helper->_db_envAttr->default_value = attrManager->GetAttributeDefaultValue(i) != NULL ? attrManager->GetAttributeDefaultValue(i) : "";
db->write_envAttr(helper->_db_envAttr); db->write_envAttr(helper->_db_envAttr);
} }
@ -100,20 +102,20 @@ void IterateAttribute(CKAttributeManager* attrManager, envDatabase* db, dbEnvDat
void IteratePlugin(CKPluginManager* plgManager, envDatabase* db, dbEnvDataStructHelper* helper) { void IteratePlugin(CKPluginManager* plgManager, envDatabase* db, dbEnvDataStructHelper* helper) {
for (int i = 0; i <= 7; i++) { for (int i = 0; i <= 7; i++) {
int catCount = plgManager->GetPluginCount(i); int catCount = plgManager->GetPluginCount(i);
strcpy(helper->_db_envPlugin->category, plgManager->GetCategoryName(i)); helper->_db_envPlugin->category = plgManager->GetCategoryName(i);
for (int j = 0; j < catCount; j++) { for (int j = 0; j < catCount; j++) {
CKPluginEntry* plgEntry = plgManager->GetPluginInfo(i, j); CKPluginEntry* plgEntry = plgManager->GetPluginInfo(i, j);
helper->_db_envPlugin->dll_index = plgEntry->m_PluginDllIndex; helper->_db_envPlugin->dll_index = plgEntry->m_PluginDllIndex;
strcpy(helper->_db_envPlugin->dll_name, plgManager->GetPluginDllInfo(plgEntry->m_PluginDllIndex)->m_DllFileName.CStr()); helper->_db_envPlugin->dll_name = plgManager->GetPluginDllInfo(plgEntry->m_PluginDllIndex)->m_DllFileName.CStr();
helper->_db_envPlugin->plugin_index = plgEntry->m_PositionInDll; helper->_db_envPlugin->plugin_index = plgEntry->m_PositionInDll;
helper->_db_envPlugin->active = plgEntry->m_Active; helper->_db_envPlugin->active = plgEntry->m_Active;
helper->_db_envPlugin->needed_by_file = plgEntry->m_NeededByFile; helper->_db_envPlugin->needed_by_file = plgEntry->m_NeededByFile;
CKPluginInfo* plgInfo = &(plgEntry->m_PluginInfo); CKPluginInfo* plgInfo = &(plgEntry->m_PluginInfo);
cp_guid(helper->_db_envPlugin->guid, plgInfo->m_GUID); copyGuid(plgInfo->m_GUID, helper->_db_envPlugin->guid);
strcpy(helper->_db_envPlugin->desc, plgInfo->m_Description.CStr()); helper->_db_envPlugin->desc = plgInfo->m_Description.CStr();
strcpy(helper->_db_envPlugin->author, plgInfo->m_Author.CStr()); helper->_db_envPlugin->author = plgInfo->m_Author.CStr();
strcpy(helper->_db_envPlugin->summary, plgInfo->m_Summary.CStr()); helper->_db_envPlugin->summary = plgInfo->m_Summary.CStr();
helper->_db_envPlugin->version = plgInfo->m_Version; helper->_db_envPlugin->version = plgInfo->m_Version;
helper->_db_envPlugin->func_init = plgInfo->m_InitInstanceFct; helper->_db_envPlugin->func_init = plgInfo->m_InitInstanceFct;
helper->_db_envPlugin->func_exit = plgInfo->m_ExitInstanceFct; helper->_db_envPlugin->func_exit = plgInfo->m_ExitInstanceFct;

View File

@ -4,8 +4,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "database.h" #include "database.h"
#define cp_guid(x,y) x[0]=y.d1;x[1]=y.d2
void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper); void IterateParameterOperation(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper);
void IterateParameter(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper); void IterateParameter(CKParameterManager* parameterManager, envDatabase* db, dbEnvDataStructHelper* helper);
void IterateMessage(CKMessageManager* msgManager, envDatabase* db, dbEnvDataStructHelper* helper); void IterateMessage(CKMessageManager* msgManager, envDatabase* db, dbEnvDataStructHelper* helper);

View File

@ -3,6 +3,7 @@
#pragma warning(disable:26812) #pragma warning(disable:26812)
#define changeSuffix(a) prefix[endIndex]='\0';strcat(prefix,a) #define changeSuffix(a) prefix[endIndex]='\0';strcat(prefix,a)
#define copyGuid(guid,str) sprintf(helper->_stringCache,"%d,%d",guid.d1,guid.d2);str=helper->_stringCache;
#pragma region inline func #pragma region inline func
@ -73,16 +74,27 @@ inline void generate_pLink_in_pIn(CKContext* ctx, CKParameterIn* cache, scriptDa
inline void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents) { inline void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents) {
helper->_db_pTarget->thisobj = cache->GetID(); helper->_db_pTarget->thisobj = cache->GetID();
strcpy(helper->_db_pTarget->name, cache->GetName()); helper->_db_pTarget->name = cache->GetName();
strcpy(helper->_db_pTarget->type, helper->_parameterManager->ParameterTypeToName(cache->GetType())); helper->_db_pTarget->type = helper->_parameterManager->ParameterTypeToName(cache->GetType());
helper->_db_pTarget->type_guid[0] = cache->GetGUID().d1; copyGuid(cache->GetGUID(), helper->_db_pTarget->type_guid);
helper->_db_pTarget->type_guid[1] = cache->GetGUID().d2;
helper->_db_pTarget->belong_to = parents; helper->_db_pTarget->belong_to = parents;
helper->_db_pTarget->direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1; helper->_db_pTarget->direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1;
helper->_db_pTarget->shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1; helper->_db_pTarget->shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1;
db->write_pTarget(helper->_db_pTarget); db->write_pTarget(helper->_db_pTarget);
//judge whether expoer parameter and write database
if (((CKBehavior*)ctx->GetObjectA(grandparents))->GetInputParameterPosition(cache) != -1) {
helper->_db_eLink->export_obj = cache->GetID();
helper->_db_eLink->internal_obj = parents;
helper->_db_eLink->is_in = TRUE;
helper->_db_eLink->index = -1;
helper->_db_eLink->belong_to = grandparents;
db->write_eLink(helper->_db_eLink);
return;
}
//=========try generate pLink //=========try generate pLink
generate_pLink_in_pIn(ctx, cache, db, helper, parents, grandparents, -1, TRUE, TRUE); generate_pLink_in_pIn(ctx, cache, db, helper, parents, grandparents, -1, TRUE, TRUE);
} }
@ -90,12 +102,11 @@ inline void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* d
inline void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) { inline void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
helper->_db_pIn->thisobj = cache->GetID(); helper->_db_pIn->thisobj = cache->GetID();
helper->_db_pIn->index = index; helper->_db_pIn->index = index;
strcpy(helper->_db_pIn->name, cache->GetName()); helper->_db_pIn->name = cache->GetName();
CKParameterType vaildTypeChecker = cache->GetType(); CKParameterType vaildTypeChecker = cache->GetType();
if (vaildTypeChecker != -1) strcpy(helper->_db_pIn->type, helper->_parameterManager->ParameterTypeToName(cache->GetType())); //known types if (vaildTypeChecker != -1) helper->_db_pIn->type = helper->_parameterManager->ParameterTypeToName(cache->GetType()); //known types
else strcpy(helper->_db_pIn->type, "!!UNKNOW TYPE!!"); //unknow type else helper->_db_pIn->type = "!!UNKNOW TYPE!!"; //unknow type
helper->_db_pIn->type_guid[0] = cache->GetGUID().d1; copyGuid(cache->GetGUID(), helper->_db_pIn->type_guid);
helper->_db_pIn->type_guid[1] = cache->GetGUID().d2;
helper->_db_pIn->belong_to = parents; helper->_db_pIn->belong_to = parents;
helper->_db_pIn->direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1; helper->_db_pIn->direct_source = cache->GetDirectSource() ? cache->GetDirectSource()->GetID() : -1;
helper->_db_pIn->shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1; helper->_db_pIn->shared_source = cache->GetSharedSource() ? cache->GetSharedSource()->GetID() : -1;
@ -122,12 +133,11 @@ inline void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, d
inline void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) { inline void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, EXPAND_CK_ID grandparents, int index, BOOL executedFromBB) {
helper->_db_pOut->thisobj = cache->GetID(); helper->_db_pOut->thisobj = cache->GetID();
helper->_db_pOut->index = index; helper->_db_pOut->index = index;
strcpy(helper->_db_pOut->name, cache->GetName()); helper->_db_pOut->name = cache->GetName();
CKParameterType vaildTypeChecker = cache->GetType(); CKParameterType vaildTypeChecker = cache->GetType();
if (vaildTypeChecker != -1) strcpy(helper->_db_pOut->type, helper->_parameterManager->ParameterTypeToName(cache->GetType())); //known types if (vaildTypeChecker != -1) helper->_db_pOut->type = helper->_parameterManager->ParameterTypeToName(cache->GetType()); //known types
else strcpy(helper->_db_pOut->type, "!!UNKNOW TYPE!!"); //unknow type else helper->_db_pOut->type = "!!UNKNOW TYPE!!"; //unknow type
helper->_db_pOut->type_guid[0] = cache->GetGUID().d1; copyGuid(cache->GetGUID(), helper->_db_pOut->type_guid);
helper->_db_pOut->type_guid[1] = cache->GetGUID().d2;
helper->_db_pOut->belong_to = parents; helper->_db_pOut->belong_to = parents;
db->write_pOut(helper->_db_pOut); db->write_pOut(helper->_db_pOut);
@ -184,7 +194,7 @@ inline void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db,
inline void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) { inline void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) {
helper->_db_bIn->thisobj = cache->GetID(); helper->_db_bIn->thisobj = cache->GetID();
helper->_db_bIn->index = index; helper->_db_bIn->index = index;
strcpy(helper->_db_bIn->name, cache->GetName()); helper->_db_bIn->name = cache->GetName();
helper->_db_bIn->belong_to = parents; helper->_db_bIn->belong_to = parents;
db->write_bIn(helper->_db_bIn); db->write_bIn(helper->_db_bIn);
@ -193,7 +203,7 @@ inline void proc_bIn(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStruct
inline void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) { inline void proc_bOut(CKBehaviorIO* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, int index) {
helper->_db_bOut->thisobj = cache->GetID(); helper->_db_bOut->thisobj = cache->GetID();
helper->_db_bOut->index = index; helper->_db_bOut->index = index;
strcpy(helper->_db_bOut->name, cache->GetName()); helper->_db_bOut->name = cache->GetName();
helper->_db_bOut->belong_to = parents; helper->_db_bOut->belong_to = parents;
db->write_bOut(helper->_db_bOut); db->write_bOut(helper->_db_bOut);
@ -221,12 +231,11 @@ inline void proc_bLink(CKBehaviorLink* cache, scriptDatabase* db, dbScriptDataSt
inline void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, BOOL is_setting) { inline void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents, BOOL is_setting) {
helper->_db_pLocal->thisobj = cache->GetID(); helper->_db_pLocal->thisobj = cache->GetID();
strcpy(helper->_db_pLocal->name, cache->GetName() ? cache->GetName() : ""); helper->_db_pLocal->name = cache->GetName() ? cache->GetName() : "";
CKParameterType vaildTypeChecker = cache->GetType(); CKParameterType vaildTypeChecker = cache->GetType();
if (vaildTypeChecker != -1) strcpy(helper->_db_pLocal->type, helper->_parameterManager->ParameterTypeToName(cache->GetType())); //known types if (vaildTypeChecker != -1) helper->_db_pLocal->type = helper->_parameterManager->ParameterTypeToName(cache->GetType()); //known types
else strcpy(helper->_db_pLocal->type, "!!UNKNOW TYPE!!"); //unknow type else helper->_db_pLocal->type = "!!UNKNOW TYPE!!"; //unknow type
helper->_db_pLocal->type_guid[0] = cache->GetGUID().d1; copyGuid(cache->GetGUID(), helper->_db_pLocal->type_guid);
helper->_db_pLocal->type_guid[1] = cache->GetGUID().d2;
helper->_db_pLocal->is_setting = is_setting; helper->_db_pLocal->is_setting = is_setting;
helper->_db_pLocal->belong_to = parents; helper->_db_pLocal->belong_to = parents;
@ -238,9 +247,8 @@ inline void proc_pLocal(CKParameterLocal* cache, scriptDatabase* db, dbScriptDat
inline void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) { inline void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
helper->_db_pOper->thisobj = cache->GetID(); helper->_db_pOper->thisobj = cache->GetID();
strcpy(helper->_db_pOper->op, helper->_parameterManager->OperationGuidToName(cache->GetOperationGuid())); helper->_db_pOper->op = helper->_parameterManager->OperationGuidToName(cache->GetOperationGuid());
helper->_db_pOper->op_guid[0] = cache->GetOperationGuid().d1; copyGuid(cache->GetOperationGuid(), helper->_db_pOper->op_guid);
helper->_db_pOper->op_guid[1] = cache->GetOperationGuid().d2;
helper->_db_pOper->belong_to = parents; helper->_db_pOper->belong_to = parents;
db->write_pOper(helper->_db_pOper); db->write_pOper(helper->_db_pOper);
@ -254,8 +262,8 @@ inline void proc_pOper(CKContext* ctx, CKParameterOperation* cache, scriptDataba
//============================helper for pLocal data export //============================helper for pLocal data export
inline void helper_pLocalDataExport(const char* field, const char* data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) { inline void helper_pLocalDataExport(const char* field, const char* data, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
strcpy(helper->_db_pLocalData->field, field); helper->_db_pLocalData->field = field;
strcpy(helper->_db_pLocalData->data, data); helper->_db_pLocalData->data = data;
helper->_db_pLocalData->belong_to = parents; helper->_db_pLocalData->belong_to = parents;
db->write_pLocalData(helper->_db_pLocalData); db->write_pLocalData(helper->_db_pLocalData);
@ -291,7 +299,7 @@ void IterateScript(CKContext* ctx, scriptDatabase* db, dbScriptDataStructHelper*
beh = beobj->GetScript(j); beh = beobj->GetScript(j);
helper->_dbCKScript->thisobj = beobj->GetID(); helper->_dbCKScript->thisobj = beobj->GetID();
strcpy(helper->_dbCKScript->host_name, beobj->GetName()); helper->_dbCKScript->host_name = beobj->GetName();
helper->_dbCKScript->index = j; helper->_dbCKScript->index = j;
helper->_dbCKScript->behavior = beh->GetID(); helper->_dbCKScript->behavior = beh->GetID();
db->write_CKScript(helper->_dbCKScript); db->write_CKScript(helper->_dbCKScript);
@ -305,21 +313,21 @@ void IterateScript(CKContext* ctx, scriptDatabase* db, dbScriptDataStructHelper*
void IterateBehavior(CKContext* ctx, CKBehavior* bhv, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) { void IterateBehavior(CKContext* ctx, CKBehavior* bhv, scriptDatabase* db, dbScriptDataStructHelper* helper, EXPAND_CK_ID parents) {
//write self data //write self data
helper->_dbCKBehavior->thisobj = bhv->GetID(); helper->_dbCKBehavior->thisobj = bhv->GetID();
strcpy(helper->_dbCKBehavior->name, bhv->GetName()); helper->_dbCKBehavior->name = bhv->GetName();
helper->_dbCKBehavior->type = bhv->GetType(); helper->_dbCKBehavior->type = bhv->GetType();
strcpy(helper->_dbCKBehavior->proto_name, bhv->GetPrototypeName() ? bhv->GetPrototypeName() : ""); helper->_dbCKBehavior->proto_name = bhv->GetPrototypeName() ? bhv->GetPrototypeName() : "";
helper->_dbCKBehavior->proto_guid[0] = bhv->GetPrototypeGuid().d1; copyGuid(bhv->GetPrototypeGuid(), helper->_dbCKBehavior->proto_guid);
helper->_dbCKBehavior->proto_guid[1] = bhv->GetPrototypeGuid().d2;
helper->_dbCKBehavior->flags = bhv->GetFlags(); helper->_dbCKBehavior->flags = bhv->GetFlags();
helper->_dbCKBehavior->priority = bhv->GetPriority(); helper->_dbCKBehavior->priority = bhv->GetPriority();
helper->_dbCKBehavior->version = bhv->GetVersion(); helper->_dbCKBehavior->version = bhv->GetVersion();
helper->_dbCKBehavior->parent = parents; helper->_dbCKBehavior->parent = parents;
sprintf(helper->_dbCKBehavior->pin_count, "%d,%d,%d,%d,%d", sprintf(helper->_stringCache, "%d,%d,%d,%d,%d",
(bhv->IsUsingTarget() ? 1 : 0), (bhv->IsUsingTarget() ? 1 : 0),
bhv->GetInputParameterCount(), bhv->GetInputParameterCount(),
bhv->GetOutputParameterCount(), bhv->GetOutputParameterCount(),
bhv->GetInputCount(), bhv->GetInputCount(),
bhv->GetOutputCount()); bhv->GetOutputCount());
helper->_dbCKBehavior->pin_count = helper->_stringCache;
db->write_CKBehavior(helper->_dbCKBehavior); db->write_CKBehavior(helper->_dbCKBehavior);
//write target //write target
@ -461,10 +469,10 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
if (t == CKPGUID_STRING) { if (t == CKPGUID_STRING) {
char* cptr = (char*)p->GetReadDataPtr(false); char* cptr = (char*)p->GetReadDataPtr(false);
int cc = p->GetDataSize(); int cc = p->GetDataSize();
for (int i = 0; i < cc; i++)
helper->_db_pLocalData->data[i] = cptr[i]; helper->_db_pLocalData->data.clear();
helper->_db_pLocalData->data[cc] = '\0'; helper->_db_pLocalData->data.insert(0, cptr, 0, cc);
strcpy(helper->_db_pLocalData->field, "str"); helper->_db_pLocalData->field = "str";
helper->_db_pLocalData->belong_to = p->GetID(); helper->_db_pLocalData->belong_to = p->GetID();
db->write_pLocalData(helper->_db_pLocalData); db->write_pLocalData(helper->_db_pLocalData);
return; return;
@ -479,25 +487,21 @@ void IteratepLocalData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStru
char temp[4]; char temp[4];
int cc = 0, rcc = 0, pos = 0; int cc = 0, rcc = 0, pos = 0;
rcc = cc = p->GetDataSize(); rcc = cc = p->GetDataSize();
if (rcc > 200) rcc = 200; if (rcc > 1024) rcc = 1024;
helper->_db_pLocalData->data.clear();
for (int i = 0; i < rcc; i++) { for (int i = 0; i < rcc; i++) {
sprintf(temp, "%02X", cptr[i]); sprintf(temp, "%02X", cptr[i]);
helper->_db_pLocalData->data[pos++] = '0';
helper->_db_pLocalData->data[pos++] = 'x'; helper->_db_pLocalData->data += temp;
helper->_db_pLocalData->data[pos++] = temp[0]; if (i != rcc - 1)
helper->_db_pLocalData->data[pos++] = temp[1]; helper->_db_pLocalData->data += ", ";
helper->_db_pLocalData->data[pos++] = ',';
} }
if (pos)
helper->_db_pLocalData->data[--pos] = '\0';
else
helper->_db_pLocalData->data[0] = '\0';
if (rcc == cc) if (rcc == cc)
strcpy(helper->_db_pLocalData->field, "dump.data"); helper->_db_pLocalData->field = "dump.data";
else else
strcpy(helper->_db_pLocalData->field, "dump.partial_data"); helper->_db_pLocalData->field = "dump.partial_data";
helper->_db_pLocalData->belong_to = p->GetID(); helper->_db_pLocalData->belong_to = p->GetID();
db->write_pLocalData(helper->_db_pLocalData); db->write_pLocalData(helper->_db_pLocalData);

View File

@ -2,6 +2,7 @@ import sqlite3
import DecoratorConstValue as dcv import DecoratorConstValue as dcv
import json import json
import CustomConfig import CustomConfig
import sys
def run(): def run():
exportDb = sqlite3.connect(CustomConfig.export_db) exportDb = sqlite3.connect(CustomConfig.export_db)
@ -21,12 +22,25 @@ def run():
# decorate each graph # decorate each graph
print('Generating graph...') print('Generating graph...')
currentGraphBlockCell = {} currentGraphBlockCell = {}
percentageAll = len(graphList)
if percentageAll == 0:
percentageAll = 1
percentageNow = 0
percentageCache = 0
#debug
graphList=graphList[int(percentageAll*3/4):]
for i in graphList: for i in graphList:
sys.stdout.write('\r[{}{}]{}%'.format(int(percentageCache / 5) * '#',(20 - int(percentageCache / 5)) * '=', percentageCache))
sys.stdout.flush()
currentGraphBlockCell.clear() currentGraphBlockCell.clear()
buildBlock(exportDb, decorateDb, i, currentGraphBlockCell) buildBlock(exportDb, decorateDb, i, currentGraphBlockCell)
graphPIO = buildCell(exportDb, decorateDb, i, currentGraphBlockCell) graphPIO = buildCell(exportDb, decorateDb, i, currentGraphBlockCell)
buildLink(exportDb, decorateDb, i, currentGraphBlockCell, graphPIO) buildLink(exportDb, decorateDb, i, currentGraphBlockCell, graphPIO)
percentageNow += 1
percentageCache = int(100 * percentageNow / percentageAll)
# export information # export information
print('Generating info...') print('Generating info...')
buildInfo(exportDb, decorateDb) buildInfo(exportDb, decorateDb)
@ -539,8 +553,13 @@ def buildLink(exDb, deDb, target, currentGraphBlockCell, graphPIO):
exCur = exDb.cursor() exCur = exDb.cursor()
deCur = deDb.cursor() deCur = deDb.cursor()
# prepare block set
blockSet = set()
for i in currentGraphBlockCell.keys():
blockSet.add(i)
# bLink # bLink
exCur.execute("SELECT * FROM bLink WHERE [belong_to] == ?", (target, )) exCur.execute("SELECT * FROM bLink WHERE [belong_to] == ?", (target,))
for i in exCur.fetchall(): for i in exCur.fetchall():
if i[3] == target: if i[3] == target:
(x1, y1) = computLinkBTerminal(i[0], 0, -1 ,currentGraphBlockCell) (x1, y1) = computLinkBTerminal(i[0], 0, -1 ,currentGraphBlockCell)
@ -590,7 +609,11 @@ def buildLink(exDb, deDb, target, currentGraphBlockCell, graphPIO):
(target, -1, i[0], i[1], i[2], i[6], 0, 0, i[5], i[9], x1, y1, x2, y2)) (target, -1, i[0], i[1], i[2], i[6], 0, 0, i[5], i[9], x1, y1, x2, y2))
else: else:
if i[2] in blockSet: # process protencial pOut(shortcut) (because plocal input/input_obj
# output/output_obj is same, so don't need add for them)
(x1, y1) = computLinkPTerminal(i[2], 1, i[5], currentGraphBlockCell) (x1, y1) = computLinkPTerminal(i[2], 1, i[5], currentGraphBlockCell)
else:
(x1, y1) = computLinkPTerminal(i[0], 1, i[5], currentGraphBlockCell)
(x2, y2) = computLinkPTerminal(i[6], 0, i[9], currentGraphBlockCell) (x2, y2) = computLinkPTerminal(i[6], 0, i[9], currentGraphBlockCell)
deCur.execute("INSERT INTO link VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", deCur.execute("INSERT INTO link VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);",
(target, -1, i[0], i[1], i[2], i[6], 1, 0, i[5], i[9], x1, y1, x2, y2)) (target, -1, i[0], i[1], i[2], i[6], 1, 0, i[5], i[9], x1, y1, x2, y2))
@ -627,7 +650,9 @@ def computLinkBTerminal(obj, xtype, index, currentGraphBlockCell):
cache.y if index == -1 else (cache.y + dcv.BB_BOFFSET + index * (dcv.BB_PBSIZE + dcv.BB_BSPAN))) cache.y if index == -1 else (cache.y + dcv.BB_BOFFSET + index * (dcv.BB_PBSIZE + dcv.BB_BSPAN)))
def computLinkPTerminal(obj, ytype, index, currentGraphBlockCell): def computLinkPTerminal(obj, ytype, index, currentGraphBlockCell):
# ytype is not database type. it have the same meaning of LinkBTerminal, indicating the position. 0 is keep origin position(for pIn and pTarget), 1 is consider height(for pOut) # ytype is not database type. it have the same meaning of LinkBTerminal,
# indicating the position. 0 is keep origin position(for pIn and pTarget),
# 1 is consider height(for pOut)
cache = currentGraphBlockCell[obj] cache = currentGraphBlockCell[obj]
return (cache.x if index == -1 else (cache.x + dcv.BB_POFFSET + index * (dcv.BB_PBSIZE + dcv.BB_PSPAN)), return (cache.x if index == -1 else (cache.x + dcv.BB_POFFSET + index * (dcv.BB_PBSIZE + dcv.BB_PSPAN)),
cache.y if ytype == 0 else (cache.y + cache.h - dcv.BB_PBSIZE)) cache.y if ytype == 0 else (cache.y + cache.h - dcv.BB_PBSIZE))

View File

@ -104,8 +104,8 @@ def viewerHandle(scriptPath):
gWidth = width, gWidth = width,
gHeight = height, gHeight = height,
hamburgerHistory = hamburger, hamburgerHistory = hamburger,
static_css = url_for('static', filename='site.css'), static_css = url_for('static', filename='viewer.css'),
static_js = url_for('static', filename='site.js'), static_js = url_for('static', filename='viewer.js'),
hamburgerCurrent = currentHamburger, hamburgerCurrent = currentHamburger,
blocks = dbBlocks, blocks = dbBlocks,
cells = dbCells, cells = dbCells,

View File

@ -9,11 +9,11 @@ try:
opts, args = getopt.getopt(sys.argv, "hi:o:e:f") opts, args = getopt.getopt(sys.argv, "hi:o:e:f")
except getopt.GetoptError: except getopt.GetoptError:
print('Wrong arguments!') print('Wrong arguments!')
print('test.py -i <export.db> -o <decorated.db> -e <env.db> -f') print('python SuperScriptViewer.py -i <export.db> -o <decorated.db> -e <env.db> -f')
sys.exit(1) sys.exit(1)
for opt, arg in opts: for opt, arg in opts:
if opt == '-h': if opt == '-h':
print('test.py -i <export.db> -o <decorated.db> -e <env.db> -f') print('python SuperScriptViewer.py -i <export.db> -o <decorated.db> -e <env.db> -f')
sys.exit(0) sys.exit(0)
elif opt == '-i': elif opt == '-i':
CustomConfig.export_db = arg CustomConfig.export_db = arg

View File

@ -16,6 +16,8 @@ So, let we crack all scripts and destroy close-source illusion.</p>
Web interface is powered by <a href="https://github.com/pallets/flask">Flask</a>.<br /> Web interface is powered by <a href="https://github.com/pallets/flask">Flask</a>.<br />
Ancestor projects: <a href="https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation">BearKidsTeam/VirtoolsScriptDeobfuscation</a> and <a href="https://github.com/BearKidsTeam/Script-Materializer">BearKidsTeam/Script-Materializer</a>.<br /> Ancestor projects: <a href="https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation">BearKidsTeam/VirtoolsScriptDeobfuscation</a> and <a href="https://github.com/BearKidsTeam/Script-Materializer">BearKidsTeam/Script-Materializer</a>.<br />
Thank <a href="https://github.com/chirs241097">chirs241097</a> and <a href="https://github.com/instr3">2jjy</a>.</p> Thank <a href="https://github.com/chirs241097">chirs241097</a> and <a href="https://github.com/instr3">2jjy</a>.</p>
<br />
<p>Current Super Script Materializer version: 1.0</p>
</body> </body>
</html> </html>

View File

@ -8,7 +8,21 @@
<body> <body>
<h1>Super Script Viewer Help</h1> <h1>Super Script Viewer Help</h1>
<p>In this file, I will introduce how to use this viewer.</p> <p>This page is help center, providing useful link for some detailed help page. Choose what you want to use and enter corresponding page.</p>
<br />
<br />
<h2>Help tools</h2>
<ul>
<li><a href="/help/converter">Converter</a>: The page containing converter which can convert the data with various style for some convenient operations.</li>
</ul>
<h2>Environment database query</h2>
<ul>
<li><a href="/help/env-attr">Attribute query</a>: The page which can query attribute environment.</li>
<li><a href="/help/env-msg">Message query</a>: The page which can query message environment.</li>
<li><a href="/help/env-op">Operation query</a>: The page which can query operation(param converter) environment.</li>
<li><a href="/help/env-param">Parameter query</a>: The page which can query parameter environment.</li>
<li><a href="/help/env-plugin">Plugin query</a>: The page which can query plugin environment.</li>
</ul>
<br /> <br />
<br /> <br />
<!-- todo: finish this--> <!-- todo: finish this-->

View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Help - Converter</title>
</head>
<body>
<h1>Converter</h1>
<p>This page provide some useful converter for your decoding work. All converter is interactive..</p>
<br />
<h2>Reverse C style byte array</h2>
<p>This converter will reverse your inputed C style byte array. Actually, it take responsibility for the convert between big-endian and little-endian.<br />
Typical and legal input just like this: <code>0x00, 0xBb, 0xff, 0xFF</code><br />
Support multi-input. Use line break to split each input.</p>
<p>Input:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
<p>Output:</p>
<textarea style="width: 350px; height: 100px; resize: none;" readonly="true"></textarea>
<h2>C style byte array to HEX</h2>
<p>This converter will converte provided C style byte array into HEX number. It is double interactive.<br />
Acceptable byte array should follow little-endian format.<br />
Support multi-input. Use line break to split each input.</p>
<p>Byte array:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
<p>HEX number:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
<h2>C style byte array to DEC</h2>
<p>This converter will converte provided C style byte array into DEC number. It is double interactive.<br />
Acceptable byte array should follow little-endian format.<br />
Support multi-input. Use line break to split each input.</p>
<p>Byte array:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
<p>DEC number:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
<h2>Lowcase upcase converter</h2>
<p>This converter will provide the convert between lowcase and upcase string. It is double interactive.</p>
<p>Lowcase:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
<p>Upcase:</p>
<textarea style="width: 350px; height: 100px; resize: none;"></textarea>
</body>
</html>