finish env_export.cpp refactor. add new features (1/2)
This commit is contained in:
parent
b0d36798ff
commit
1de5483432
|
@ -253,7 +253,7 @@ doc.db导出的是当前Virtools文档内的脚本及其它重要数据。
|
||||||
|param_type_guid|TEXT|列的类型的GUID|
|
|param_type_guid|TEXT|列的类型的GUID|
|
||||||
|parent|INTEGER|表头所属表的`CK_ID`|
|
|parent|INTEGER|表头所属表的`CK_ID`|
|
||||||
|
|
||||||
当列类型为Parameter时,`param_type`和`param_type_guid`为其所属CKParameterType的类型文本和GUID,当列类型为Object时,`param_type`为其对应的Class id,`param_type_guid`无效。列类型为其它类型时,`param_type`和`param_type_guid`均无效。
|
当列类型为Parameter时,`param_type`和`param_type_guid`为其所属CKParameterType的类型文本和GUID,当列类型为Object时,`param_type`和`param_type_guid`均无效,因为无法确认对应CKObject的类型。列类型为其它类型时,`param_type`和`param_type_guid`也均无效。
|
||||||
|
|
||||||
### array_cell
|
### array_cell
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ env.db导出的是当前Virtools环境的数据,与文档无关,这部分如
|
||||||
|字段|类型|含义|
|
|字段|类型|含义|
|
||||||
|:---|:---|:---|
|
|:---|:---|:---|
|
||||||
|dll_index|INTEGER|`CKPluginEntry::m_PluginDllIndex`|
|
|dll_index|INTEGER|`CKPluginEntry::m_PluginDllIndex`|
|
||||||
|dll_name|TEXT|`CKPluginEntry::m_PluginInfo`的`CKPluginInfo::m_DllFileName`|
|
|dll_name|TEXT|以`CKPluginEntry::m_PluginDllIndex`为参,使用`CKPluginManager::GetPluginDllInfo()`,获得的`CKPluginDll::m_DllFileName`|
|
||||||
|plugin_index|INTEGER|`CKPluginEntry::m_PositionInDll`|
|
|plugin_index|INTEGER|`CKPluginEntry::m_PositionInDll`|
|
||||||
|active|INTEGER|`CKPluginEntry::m_Active`|
|
|active|INTEGER|`CKPluginEntry::m_Active`|
|
||||||
|guid|TEXT|`CKPluginEntry::m_PluginInfo`的`CKPluginInfo::m_GUID`|
|
|guid|TEXT|`CKPluginEntry::m_PluginInfo`的`CKPluginInfo::m_GUID`|
|
||||||
|
|
|
@ -109,18 +109,16 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="database.hpp" />
|
<ClInclude Include="database.hpp" />
|
||||||
<ClInclude Include="data_export.h" />
|
<ClInclude Include="env_export.hpp" />
|
||||||
<ClInclude Include="env_export.h" />
|
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="doc_export.hpp" />
|
<ClInclude Include="doc_export.hpp" />
|
||||||
<ClInclude Include="string_helper.hpp" />
|
<ClInclude Include="string_helper.hpp" />
|
||||||
<ClInclude Include="virtools_compatible.h" />
|
<ClInclude Include="virtools_compatible.hpp" />
|
||||||
<ClInclude Include="vt_menu.h" />
|
<ClInclude Include="vt_menu.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="database.cpp" />
|
<ClCompile Include="database.cpp" />
|
||||||
<ClCompile Include="data_export.cpp" />
|
|
||||||
<ClCompile Include="env_export.cpp" />
|
<ClCompile Include="env_export.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="doc_export.cpp" />
|
<ClCompile Include="doc_export.cpp" />
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<ClInclude Include="database.hpp">
|
<ClInclude Include="database.hpp">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="env_export.h">
|
<ClInclude Include="env_export.hpp">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="resource.h">
|
<ClInclude Include="resource.h">
|
||||||
|
@ -33,10 +33,7 @@
|
||||||
<ClInclude Include="vt_menu.h">
|
<ClInclude Include="vt_menu.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="virtools_compatible.h">
|
<ClInclude Include="virtools_compatible.hpp">
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="data_export.h">
|
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="string_helper.hpp">
|
<ClInclude Include="string_helper.hpp">
|
||||||
|
@ -65,9 +62,6 @@
|
||||||
<ClCompile Include="virtools_compatible.cpp">
|
<ClCompile Include="virtools_compatible.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="data_export.cpp">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="string_helper.cpp">
|
<ClCompile Include="string_helper.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#include "data_export.h"
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#if !defined(_YYCDLL_DATA_EXPORT_H__IMPORTED_)
|
|
||||||
#define _YYCDLL_DATA_EXPORT_H__IMPORTED_
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "database.h"
|
|
||||||
|
|
||||||
void DigCKObjectData(CKObject* cko, DocumentDatabase* mDb, dbdoc_data* helper, EXPAND_CK_ID parents);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "virtools_compatible.h"
|
#include "virtools_compatible.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
|
@ -435,13 +435,160 @@ namespace SSMaterializer {
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma region message
|
||||||
|
|
||||||
|
void IterateMessage(CKContext* ctx, Database::DocumentDatabase* mDb) {
|
||||||
|
CKMessageManager* msgManager = ctx->GetMessageManager();
|
||||||
|
int count = msgManager->GetMessageTypeCount();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
mDb->mDbHelper.msg.index = i;
|
||||||
|
CopyCKString(mDb->mDbHelper.msg.name, msgManager->GetMessageTypeName(i));
|
||||||
|
|
||||||
|
mDb->write_msg(mDb->mDbHelper.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region array
|
#pragma region array
|
||||||
|
|
||||||
|
void IterateArray(CKContext* ctx, Database::DocumentDatabase* mDb) {
|
||||||
|
// get all array
|
||||||
|
XObjectPointerArray objArray = ctx->GetObjectListByType(CKCID_DATAARRAY, TRUE);
|
||||||
|
CKDataArray* darray = NULL;
|
||||||
|
int len = objArray.Size();
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
darray = (CKDataArray*)objArray.GetObjectA(i);
|
||||||
|
|
||||||
|
// dump self data first
|
||||||
|
mDb->mDbHelper._array.thisobj = darray->GetID();
|
||||||
|
CopyCKString(mDb->mDbHelper._array.name, darray->GetName());
|
||||||
|
mDb->mDbHelper._array.columns = darray->GetColumnCount();
|
||||||
|
mDb->mDbHelper._array.rows = darray->GetRowCount();
|
||||||
|
|
||||||
|
mDb->write_array(mDb->mDbHelper._array);
|
||||||
|
|
||||||
|
// dump column and row data
|
||||||
|
Proc_ArrayColumnRow(darray, mDb, darray->GetID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Proc_ArrayColumnRow(CKDataArray* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
|
||||||
|
int columns = cache->GetColumnCount(), rows = cache->GetRowCount();
|
||||||
|
|
||||||
|
// we iterate columns to get data
|
||||||
|
// because the value type of one column is not changed,
|
||||||
|
// it is benefit to our export.
|
||||||
|
for (int col = 0; col < columns; ++col) {
|
||||||
|
// dump column self first
|
||||||
|
mDb->mDbHelper.array_header.index = col;
|
||||||
|
CopyCKString(mDb->mDbHelper.array_header.name, cache->GetColumnName(col));
|
||||||
|
|
||||||
|
CK_ARRAYTYPE coltype = cache->GetColumnType(col);
|
||||||
|
mDb->mDbHelper.array_header.type = coltype;
|
||||||
|
if (coltype == CKARRAYTYPE_PARAMETER) {
|
||||||
|
CKGUID guid = cache->GetColumnParameterGuid(col);
|
||||||
|
CopyGuid(mDb->mDbHelper.array_header.param_type_guid, guid);
|
||||||
|
CKSTRING pname = mDb->mDbHelper.param_manager->ParameterGuidToName(guid);
|
||||||
|
CopyCKString(mDb->mDbHelper.array_header.param_type, pname);
|
||||||
|
} else {
|
||||||
|
mDb->mDbHelper.array_header.param_type = "";
|
||||||
|
mDb->mDbHelper.array_header.param_type_guid = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
mDb->mDbHelper.array_header.parent = parents;
|
||||||
|
mDb->write_array_header(mDb->mDbHelper.array_header);
|
||||||
|
|
||||||
|
// write row data
|
||||||
|
switch (coltype) {
|
||||||
|
case CKARRAYTYPE_INT:
|
||||||
|
for (int row = 0; row < rows; ++row) {
|
||||||
|
mDb->mDbHelper.array_cell.column = col;
|
||||||
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
|
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%d", &((int*)cache->GetElement(row, col)));
|
||||||
|
mDb->mDbHelper.array_cell.inner_param = -1;
|
||||||
|
|
||||||
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CKARRAYTYPE_FLOAT:
|
||||||
|
for (int row = 0; row < rows; ++row) {
|
||||||
|
mDb->mDbHelper.array_cell.column = col;
|
||||||
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
|
Utils::StdstringPrintf(mDb->mDbHelper.array_cell.showcase, "%f", &((float*)cache->GetElement(row, col)));
|
||||||
|
mDb->mDbHelper.array_cell.inner_param = -1;
|
||||||
|
|
||||||
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CKARRAYTYPE_STRING:
|
||||||
|
for (int row = 0; row < rows; ++row) {
|
||||||
|
mDb->mDbHelper.array_cell.column = col;
|
||||||
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
|
int count = cache->GetElementStringValue(row, col, NULL);
|
||||||
|
mDb->mDbHelper.array_cell.showcase.resize(count);
|
||||||
|
cache->GetElementStringValue(row, col, (char*)mDb->mDbHelper.array_cell.showcase.data());
|
||||||
|
mDb->mDbHelper.array_cell.inner_param = -1;
|
||||||
|
|
||||||
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CKARRAYTYPE_OBJECT:
|
||||||
|
for (int row = 0; row < rows; ++row) {
|
||||||
|
mDb->mDbHelper.array_cell.column = col;
|
||||||
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
|
CKObject* obj = cache->GetElementObject(row, col);
|
||||||
|
if (obj == NULL) continue; // fail to get obj
|
||||||
|
CopyCKString(mDb->mDbHelper.array_cell.showcase, obj->GetName());
|
||||||
|
mDb->mDbHelper.array_cell.inner_param = obj->GetID();
|
||||||
|
|
||||||
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
|
||||||
|
// dig more data for it
|
||||||
|
DigObjectData(obj, mDb, obj->GetID());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CKARRAYTYPE_PARAMETER:
|
||||||
|
for (int row = 0; row < rows; ++row) {
|
||||||
|
mDb->mDbHelper.array_cell.column = col;
|
||||||
|
mDb->mDbHelper.array_cell.row = row;
|
||||||
|
mDb->mDbHelper.array_cell.parent = parents;
|
||||||
|
|
||||||
|
CKParameter* p = (CKParameter*)cache->GetElementObject(row, col);
|
||||||
|
if (p == NULL) continue; // fail to get obj
|
||||||
|
int count = p->GetStringValue(NULL, FALSE);
|
||||||
|
mDb->mDbHelper.array_cell.showcase.resize(count);
|
||||||
|
p->GetStringValue((char*)mDb->mDbHelper.array_cell.showcase.data(), FALSE);
|
||||||
|
mDb->mDbHelper.array_cell.inner_param = p->GetID();
|
||||||
|
|
||||||
|
mDb->write_array_cell(mDb->mDbHelper.array_cell);
|
||||||
|
|
||||||
|
// dig more data for it.
|
||||||
|
DigParameterData(p, mDb, p->GetID());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region data process
|
#pragma region data process
|
||||||
|
|
||||||
void DigParameterData(CKParameterLocal* p, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
|
void DigObjectData(CKObject* o, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DigParameterData(CKParameter* p, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents) {
|
||||||
CKGUID t = p->GetGUID();
|
CKGUID t = p->GetGUID();
|
||||||
CKParameterType pt = p->GetType();
|
CKParameterType pt = p->GetType();
|
||||||
BOOL unknowType = FALSE;
|
BOOL unknowType = FALSE;
|
||||||
|
|
|
@ -22,9 +22,13 @@ namespace SSMaterializer {
|
||||||
void Proc_Behavior(CKContext* ctx, CKBehavior* bhv, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
void Proc_Behavior(CKContext* ctx, CKBehavior* bhv, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
void IterateScript(CKContext* ctx, Database::DocumentDatabase* mDb);
|
void IterateScript(CKContext* ctx, Database::DocumentDatabase* mDb);
|
||||||
|
|
||||||
void IterateArray(CKContext* ctx, Database::DocumentDatabase* mDb);
|
void IterateMessage(CKContext* ctx, Database::DocumentDatabase* mDb);
|
||||||
|
|
||||||
void DigParameterData(CKParameterLocal* pl, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
void IterateArray(CKContext* ctx, Database::DocumentDatabase* mDb);
|
||||||
|
void Proc_ArrayColumnRow(CKDataArray* cache, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
|
|
||||||
|
void DigObjectData(CKObject* o, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
|
void DigParameterData(CKParameter* pl, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
void DataDictWritter(const char* field, long data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
void DataDictWritter(const char* field, long data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
void DataDictWritter(const char* field, float data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
void DataDictWritter(const char* field, float data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
void DataDictWritter(const char* field, const char* data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
void DataDictWritter(const char* field, const char* data, Database::DocumentDatabase* mDb, DataStruct::EXPAND_CK_ID parents);
|
||||||
|
|
|
@ -1,147 +1,145 @@
|
||||||
#include "env_export.h"
|
#include "env_export.hpp"
|
||||||
|
#include "string_helper.hpp"
|
||||||
|
|
||||||
//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;
|
namespace SSMaterializer {
|
||||||
#define CopyCKString(storage,str) storage=(str)?(str):"";
|
namespace EnvironmentExporter {
|
||||||
|
|
||||||
void IterateParameterOperation(CKParameterManager* parameterManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper) {
|
void IterateParameterOperation(CKParameterManager* parameterManager, Database::EnvironmentDatabase* mDb) {
|
||||||
int count = parameterManager->GetParameterOperationCount();
|
int count = parameterManager->GetParameterOperationCount();
|
||||||
CKOperationDesc* opList = NULL;
|
CKOperationDesc* opList = NULL;
|
||||||
int listCount = 0, cacheListCount = 0;
|
|
||||||
CKGUID _guid;
|
CKGUID _guid;
|
||||||
|
int listCount = 0, cacheListCount = 0;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
//fill basic data
|
//fill basic data
|
||||||
helper->_db_op->op_code = i;
|
mDb->mDbHelper.op.op_code = i;
|
||||||
_guid = parameterManager->OperationCodeToGuid(i);
|
_guid = parameterManager->OperationCodeToGuid(i);
|
||||||
CopyGuid(_guid,helper->_db_op->op_guid);
|
CopyGuid(mDb->mDbHelper.op.op_guid, _guid);
|
||||||
helper->_db_op->op_name = parameterManager->OperationCodeToName(i);
|
mDb->mDbHelper.op.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);
|
||||||
if (cacheListCount > listCount) {
|
if (cacheListCount > listCount) {
|
||||||
listCount = cacheListCount;
|
listCount = cacheListCount;
|
||||||
opList = (CKOperationDesc*)realloc(opList, listCount * sizeof(CKOperationDesc));
|
opList = (CKOperationDesc*)realloc(opList, listCount * sizeof(CKOperationDesc));
|
||||||
assert(opList != NULL);
|
if (opList == NULL) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
CopyGuid(opList[j].P1Guid, helper->_db_op->in1_guid);
|
CopyGuid(mDb->mDbHelper.op.in1_guid, opList[j].P1Guid);
|
||||||
CopyGuid(opList[j].P2Guid, helper->_db_op->in2_guid);
|
CopyGuid(mDb->mDbHelper.op.in2_guid, opList[j].P2Guid);
|
||||||
CopyGuid(opList[j].ResGuid, helper->_db_op->out_guid);
|
CopyGuid(mDb->mDbHelper.op.out_guid, opList[j].ResGuid);
|
||||||
helper->_db_op->funcPtr = opList[j].Fct;
|
mDb->mDbHelper.op.funcPtr = opList[j].Fct;
|
||||||
|
|
||||||
mDb->write_op(helper->_db_op);
|
mDb->write_op(mDb->mDbHelper.op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opList != NULL) free(opList);
|
if (opList != NULL) free(opList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IterateParameter(CKParameterManager* parameterManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper) {
|
void IterateParameter(CKParameterManager* parameterManager, Database::EnvironmentDatabase* mDb) {
|
||||||
int count = parameterManager->GetParameterTypesCount();
|
int count = parameterManager->GetParameterTypesCount();
|
||||||
CKParameterTypeDesc* desc = NULL;
|
CKParameterTypeDesc* desc = NULL;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
desc = parameterManager->GetParameterTypeDescription(i);
|
desc = parameterManager->GetParameterTypeDescription(i);
|
||||||
|
|
||||||
helper->_db_param->index = desc->Index;
|
mDb->mDbHelper.param.index = desc->Index;
|
||||||
CopyGuid(desc->Guid, helper->_db_param->guid);
|
CopyGuid(mDb->mDbHelper.param.guid, desc->Guid);
|
||||||
CopyGuid(desc->DerivedFrom, helper->_db_param->derived_from);
|
CopyGuid(mDb->mDbHelper.param.derived_from, desc->DerivedFrom);
|
||||||
helper->_db_param->type_name = desc->TypeName.CStr();
|
mDb->mDbHelper.param.type_name = desc->TypeName.CStr();
|
||||||
helper->_db_param->default_size = desc->DefaultSize;
|
mDb->mDbHelper.param.default_size = desc->DefaultSize;
|
||||||
helper->_db_param->func_CreateDefault = desc->CreateDefaultFunction;
|
mDb->mDbHelper.param.func_CreateDefault = desc->CreateDefaultFunction;
|
||||||
helper->_db_param->func_Delete = desc->DeleteFunction;
|
mDb->mDbHelper.param.func_Delete = desc->DeleteFunction;
|
||||||
helper->_db_param->func_SaveLoad = desc->SaveLoadFunction;
|
mDb->mDbHelper.param.func_SaveLoad = desc->SaveLoadFunction;
|
||||||
helper->_db_param->func_Check = desc->CheckFunction;
|
mDb->mDbHelper.param.func_Check = desc->CheckFunction;
|
||||||
helper->_db_param->func_Copy = desc->CopyFunction;
|
mDb->mDbHelper.param.func_Copy = desc->CopyFunction;
|
||||||
helper->_db_param->func_String = desc->StringFunction;
|
mDb->mDbHelper.param.func_String = desc->StringFunction;
|
||||||
helper->_db_param->func_UICreator = desc->UICreatorFunction;
|
mDb->mDbHelper.param.func_UICreator = desc->UICreatorFunction;
|
||||||
CKPluginEntry* plgEntry = desc->CreatorDll;
|
CKPluginEntry* plgEntry = desc->CreatorDll;
|
||||||
if (plgEntry != NULL) {
|
if (plgEntry != NULL) {
|
||||||
helper->_db_param->creator_dll_index = plgEntry->m_PluginDllIndex;
|
mDb->mDbHelper.param.creator_dll_index = plgEntry->m_PluginDllIndex;
|
||||||
helper->_db_param->creator_plugin_index = plgEntry->m_PositionInDll;
|
mDb->mDbHelper.param.creator_plugin_index = plgEntry->m_PositionInDll;
|
||||||
} else {
|
} else {
|
||||||
helper->_db_param->creator_dll_index =-1;
|
mDb->mDbHelper.param.creator_dll_index = -1;
|
||||||
helper->_db_param->creator_plugin_index =-1;
|
mDb->mDbHelper.param.creator_plugin_index = -1;
|
||||||
}
|
}
|
||||||
helper->_db_param->dw_param = desc->dwParam;
|
mDb->mDbHelper.param.dw_param = desc->dwParam;
|
||||||
helper->_db_param->dw_flags = desc->dwFlags;
|
mDb->mDbHelper.param.dw_flags = desc->dwFlags;
|
||||||
helper->_db_param->cid = desc->Cid;
|
mDb->mDbHelper.param.cid = desc->Cid;
|
||||||
CopyGuid(desc->Saver_Manager, helper->_db_param->saver_manager);
|
CopyGuid(mDb->mDbHelper.param.saver_manager, desc->Saver_Manager);
|
||||||
|
|
||||||
mDb->write_param(helper->_db_param);
|
mDb->write_param(mDb->mDbHelper.param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IterateMessage(CKMessageManager* msgManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper) {
|
void IterateAttribute(CKAttributeManager* attrManager, Database::EnvironmentDatabase* mDb) {
|
||||||
int count = msgManager->GetMessageTypeCount();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
helper->_db_envMsg->index = i;
|
|
||||||
helper->_db_envMsg->name = msgManager->GetMessageTypeName(i);
|
|
||||||
|
|
||||||
mDb->write_msg(helper->_db_envMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IterateAttribute(CKAttributeManager* attrManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper) {
|
|
||||||
int count = attrManager->GetAttributeCount();
|
int count = attrManager->GetAttributeCount();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
helper->_db_attr->index = i;
|
mDb->mDbHelper.attr.index = i;
|
||||||
helper->_db_attr->name = attrManager->GetAttributeNameByType(i);
|
mDb->mDbHelper.attr.name = attrManager->GetAttributeNameByType(i);
|
||||||
helper->_db_attr->category_index = attrManager->GetAttributeCategoryIndex(i);
|
mDb->mDbHelper.attr.category_index = attrManager->GetAttributeCategoryIndex(i);
|
||||||
helper->_db_attr->category_name = attrManager->GetAttributeCategory(i) != NULL ? attrManager->GetAttributeCategory(i) : "";
|
CopyCKString(mDb->mDbHelper.attr.category_name, attrManager->GetAttributeCategory(i));
|
||||||
helper->_db_attr->flags = attrManager->GetAttributeFlags(i);
|
mDb->mDbHelper.attr.flags = attrManager->GetAttributeFlags(i);
|
||||||
helper->_db_attr->param_index = attrManager->GetAttributeParameterType(i);
|
mDb->mDbHelper.attr.param_index = attrManager->GetAttributeParameterType(i);
|
||||||
helper->_db_attr->compatible_classid = attrManager->GetAttributeCompatibleClassId(i);
|
mDb->mDbHelper.attr.compatible_classid = attrManager->GetAttributeCompatibleClassId(i);
|
||||||
helper->_db_attr->default_value = attrManager->GetAttributeDefaultValue(i) != NULL ? attrManager->GetAttributeDefaultValue(i) : "";
|
CopyCKString(mDb->mDbHelper.attr.default_value, attrManager->GetAttributeDefaultValue(i));
|
||||||
|
|
||||||
mDb->write_attr(helper->_db_attr);
|
mDb->write_attr(mDb->mDbHelper.attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IteratePlugin(CKPluginManager* plgManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper) {
|
void IteratePlugin(CKPluginManager* plgManager, Database::EnvironmentDatabase* mDb) {
|
||||||
for (int i = 0; i <= 7; i++) {
|
for (int i = 0; i <= 7; i++) {
|
||||||
int catCount = plgManager->GetPluginCount(i);
|
int catCount = plgManager->GetPluginCount(i);
|
||||||
helper->_db_plugin->category = plgManager->GetCategoryName(i);
|
mDb->mDbHelper.plugin.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_plugin->dll_index = plgEntry->m_PluginDllIndex;
|
|
||||||
helper->_db_plugin->dll_name = plgManager->GetPluginDllInfo(plgEntry->m_PluginDllIndex)->m_DllFileName.CStr();
|
|
||||||
helper->_db_plugin->plugin_index = plgEntry->m_PositionInDll;
|
|
||||||
helper->_db_plugin->active = plgEntry->m_Active;
|
|
||||||
helper->_db_plugin->needed_by_file = plgEntry->m_NeededByFile;
|
|
||||||
CKPluginInfo* plgInfo = &(plgEntry->m_PluginInfo);
|
CKPluginInfo* plgInfo = &(plgEntry->m_PluginInfo);
|
||||||
CopyGuid(plgInfo->m_GUID, helper->_db_plugin->guid);
|
CKPluginDll* plgDll = plgManager->GetPluginDllInfo(plgEntry->m_PluginDllIndex);
|
||||||
helper->_db_plugin->desc = plgInfo->m_Description.CStr();
|
|
||||||
helper->_db_plugin->author = plgInfo->m_Author.CStr();
|
|
||||||
helper->_db_plugin->summary = plgInfo->m_Summary.CStr();
|
|
||||||
helper->_db_plugin->version = plgInfo->m_Version;
|
|
||||||
helper->_db_plugin->func_init = plgInfo->m_InitInstanceFct;
|
|
||||||
helper->_db_plugin->func_exit = plgInfo->m_ExitInstanceFct;
|
|
||||||
|
|
||||||
mDb->write_plugin(helper->_db_plugin);
|
mDb->mDbHelper.plugin.dll_index = plgEntry->m_PluginDllIndex;
|
||||||
|
|
||||||
|
mDb->mDbHelper.plugin.dll_name = plgDll->m_DllFileName.CStr();
|
||||||
|
|
||||||
|
mDb->mDbHelper.plugin.plugin_index = plgEntry->m_PositionInDll;
|
||||||
|
mDb->mDbHelper.plugin.active = plgEntry->m_Active;
|
||||||
|
|
||||||
|
CopyGuid(mDb->mDbHelper.plugin.guid, plgInfo->m_GUID);
|
||||||
|
mDb->mDbHelper.plugin.desc = plgInfo->m_Description.CStr();
|
||||||
|
mDb->mDbHelper.plugin.author = plgInfo->m_Author.CStr();
|
||||||
|
mDb->mDbHelper.plugin.summary = plgInfo->m_Summary.CStr();
|
||||||
|
mDb->mDbHelper.plugin.version = plgInfo->m_Version;
|
||||||
|
mDb->mDbHelper.plugin.func_init = plgInfo->m_InitInstanceFct;
|
||||||
|
mDb->mDbHelper.plugin.func_exit = plgInfo->m_ExitInstanceFct;
|
||||||
|
|
||||||
|
mDb->write_plugin(mDb->mDbHelper.plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(VIRTOOLS_21)
|
#if !defined(VIRTOOLS_21)
|
||||||
void IterateVariable(CKVariableManager* varManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper) {
|
void IterateVariable(CKVariableManager* varManager, Database::EnvironmentDatabase* mDb) {
|
||||||
CKVariableManager::Iterator it = varManager->GetVariableIterator();
|
CKVariableManager::Iterator it = varManager->GetVariableIterator();
|
||||||
CKVariableManager::Variable* varobj = NULL;
|
CKVariableManager::Variable* varobj = NULL;
|
||||||
XString dataCopyCache;
|
XString dataCopyCache;
|
||||||
for (; !it.End(); it++) {
|
for (; !it.End(); it++) {
|
||||||
varobj = it.GetVariable();
|
varobj = it.GetVariable();
|
||||||
helper->_db_variable->name = it.GetName();
|
mDb->mDbHelper.variable.name = it.GetName();
|
||||||
CopyCKString(helper->_db_variable->desciption, varobj->GetDescription());
|
CopyCKString(mDb->mDbHelper.variable.desciption, varobj->GetDescription());
|
||||||
helper->_db_variable->flags = varobj->GetFlags();
|
mDb->mDbHelper.variable.flags = varobj->GetFlags();
|
||||||
helper->_db_variable->type = varobj->GetType();
|
mDb->mDbHelper.variable.type = varobj->GetType();
|
||||||
CopyCKString(helper->_db_variable->representation, varobj->GetRepresentation());
|
CopyCKString(mDb->mDbHelper.variable.representation, varobj->GetRepresentation());
|
||||||
varobj->GetStringValue(dataCopyCache);
|
varobj->GetStringValue(dataCopyCache);
|
||||||
helper->_db_variable->data = dataCopyCache.CStr();
|
mDb->mDbHelper.variable.data = dataCopyCache.CStr();
|
||||||
|
|
||||||
mDb->write_variable(helper->_db_variable);
|
mDb->write_variable(mDb->mDbHelper.variable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
#if !defined(_YYCDLL_ENV_EXPORT_H__IMPORTED_)
|
|
||||||
#define _YYCDLL_ENV_EXPORT_H__IMPORTED_
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "database.h"
|
|
||||||
|
|
||||||
void IterateParameterOperation(CKParameterManager* parameterManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper);
|
|
||||||
void IterateParameter(CKParameterManager* parameterManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper);
|
|
||||||
void IterateMessage(CKMessageManager* msgManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper);
|
|
||||||
void IterateAttribute(CKAttributeManager* attrManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper);
|
|
||||||
void IteratePlugin(CKPluginManager* plgManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper);
|
|
||||||
void IterateVariable(CKVariableManager* varManager, EnvironmentDatabase* mDb, dbEnvDataStructHelper* helper);
|
|
||||||
|
|
||||||
#endif
|
|
19
SuperScriptMaterializer/env_export.hpp
Normal file
19
SuperScriptMaterializer/env_export.hpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "database.hpp"
|
||||||
|
|
||||||
|
namespace SSMaterializer {
|
||||||
|
namespace EnvironmentExporter {
|
||||||
|
|
||||||
|
void IterateParameterOperation(CKParameterManager* parameterManager, Database::EnvironmentDatabase* mDb);
|
||||||
|
void IterateParameter(CKParameterManager* parameterManager, Database::EnvironmentDatabase* mDb);
|
||||||
|
void IterateAttribute(CKAttributeManager* attrManager, Database::EnvironmentDatabase* mDb);
|
||||||
|
void IteratePlugin(CKPluginManager* plgManager, Database::EnvironmentDatabase* mDb);
|
||||||
|
|
||||||
|
#if !defined(VIRTOOLS_21)
|
||||||
|
void IterateVariable(CKVariableManager* varManager, Database::EnvironmentDatabase* mDb);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define CopyGuid(str, guid) SSMaterializer::Utils::StdstringPrintf((str), "0x%08X, 0x%08X", (guid).d1, (guid).d2);
|
#define CopyGuid(str, guid) SSMaterializer::Utils::StdstringPrintf((str), "0x%08X, 0x%08X", (guid).d1, (guid).d2);
|
||||||
#define CopyCKString(storage, str) storage = (str) ? (str) : "";
|
#define CopyCKString(storage, str) storage = (str) ? (str) : "!!UNKNOW!!";
|
||||||
#define CopyCKParamTypeStr(strl, ckpt, pm) if ((ckpt) != -1) (strl) = (pm)->ParameterTypeToName(ckpt);\
|
#define CopyCKParamTypeStr(strl, ckpt, pm) if ((ckpt) != -1) (strl) = (pm)->ParameterTypeToName(ckpt);\
|
||||||
else (strl) = "!!UNKNOW TYPE!!";
|
else (strl) = "!!UNKNOW!!";
|
||||||
|
|
||||||
namespace SSMaterializer {
|
namespace SSMaterializer {
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#if !defined(_YYCDLL_VIRTOOLS_COMPATIBLE_H__IMPORTED_)
|
#pragma once
|
||||||
#define _YYCDLL_VIRTOOLS_COMPATIBLE_H__IMPORTED_
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
@ -10,5 +9,3 @@
|
||||||
#elif defined(VIRTOOLS_25) || defined(VIRTOOLS_35) || defined(VIRTOOLS_40) || defined(VIRTOOLS_50)
|
#elif defined(VIRTOOLS_25) || defined(VIRTOOLS_35) || defined(VIRTOOLS_40) || defined(VIRTOOLS_50)
|
||||||
#define UNIVERSAL_VAR_TYPE CKVariableManager::Variable::Type
|
#define UNIVERSAL_VAR_TYPE CKVariableManager::Variable::Type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user