diff --git a/src/include/wxss.h b/src/include/wxss.h index b2ae942..8e5c150 100644 --- a/src/include/wxss.h +++ b/src/include/wxss.h @@ -156,7 +156,8 @@ namespace WXSS std::string offset_8; std::map> offset_32; std::map> offset_56; - std::map offset_136; + std::map offset_128; + std::map offset_152; XCompiler(/* args */); XCompiler(std::map const&, bool, std::string const&); ~XCompiler(); diff --git a/src/wxss/x_compiler.cpp b/src/wxss/x_compiler.cpp index b20695d..b468f20 100644 --- a/src/wxss/x_compiler.cpp +++ b/src/wxss/x_compiler.cpp @@ -318,11 +318,103 @@ namespace WXSS } void XCompiler::GenExpr(std::shared_ptr a2, std::stringstream & a3, std::string & a4) { - throw "not implement"; + auto target = a2->offset_120; + for (int i = 0; i < target.size(); i++) + { + auto cur = target[i]; + if (cur->offset_0 == "DIRECTIVE" + && cur->offset_120.size() > 1 + && cur->offset_120[0]->offset_0 == "@import" + && cur->offset_140.get() + ) + { + std::string v16= *cur->offset_140; + if (this->offset_128[v16] > 1) + { + this->DealRPX(a4, a3); + a3 << "[2,\""; + auto v8 = this->offset_152[v16]; + a3 << WXML::Rewrite::ToStringCode2(v8); + a3 <<"\"],"; + } + else + { + auto v17 = this->offset_32[v16]; + this->GenExpr(v17, a3, a4); + } + } + else + { + cur->RenderCode(a4, 1); + } + } + + return ; } - int XCompiler::GetPageCss(std::string const&, std::string&, uint) + int XCompiler::GetPageCss(std::string const& a2, std::string& a3, uint a4) { - throw "not implement"; + if (this->offset_0) + { + return 6; + } + if (this->offset_32.find(a2) == this->offset_32.end()) + { + std::stringstream v38; + v38 << "setCssToHead([],undefined,{path:\""; + v38 << WXML::Rewrite::ToStringCode2(a2); + v38 << "\"})"; + a3 = v38.str(); + return 1; + } + else + { + std::string v30; + auto v23 = this->offset_32; + std::stringstream v38; + throw "not implement"; + // if ( + // this->offset_32[a2]->offset_156 + // && this->offset_32[a2]->offset_156->offset_12!= -1 + // ) + // { + // auto v6 = this->offset_32[a2]; + // } + v38.clear(); + v38 << "setCssToHead(["; + if (this->offset_128[a2] <= 1) + { + std::string v35; + auto v33 = v23[a2]; + this->GenExpr(v33, v38, v35); + if (v35.length()) + { + this->DealRPX(v35, v38); + } + + } + else + { + v38 << "[2,\""; + std::string v12 = this->offset_152[a2]; + v38 << WXML::Rewrite::ToStringCode2(v12); + v38 << "\"]"; + } + v38 << "]"; + if (v30.length()) + { + v38 << ",\"" << v30 << "\""; + } + else + { + v38 << ",undefined"; + } + v38 << ",{path:\""; + v38 << WXML::Rewrite::ToStringCode2(a2); + v38 << "\"})"; + a3 = v38.str(); + + } + return this->offset_0; } void XCompiler::MarkImported(std::string const&) { diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index d467cb3..640b5d7 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -8189,8 +8189,8 @@ int __thiscall WXSS::XCompiler::GenExpr(int this, int a2, int a3, WXSS::Token *a if ( (unsigned int)lpuexcpt >= (*(_DWORD *)(*(_DWORD *)a2 + 124) - v4) >> 3 ) break; if ( std::operator==(*(_DWORD *)(v4 + 8 * (_DWORD)lpuexcpt), "DIRECTIVE") - && (v5 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt), - v6 = *(int **)(v5 + 120), + && (v5 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt), // cur + v6 = *(int **)(v5 + 120), // cur->offset_120 (unsigned int)(*(_DWORD *)(v5 + 124) - (_DWORD)v6) > 8) && std::operator==(*v6, "@import") && *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(*(_DWORD *)a2 + 120) + 8 * (_DWORD)lpuexcpt) + 140) ) @@ -8296,9 +8296,10 @@ int __thiscall WXSS::XCompiler::GetPageCss(char *this, int *a2, _DWORD *a3, int } else { + v30 = (int)&v32; // std::string v31 = 0; - v30 = (int)&v32; v32 = 0; + if ( *(_DWORD *)(*(_DWORD *)std::map>::operator[]( v23, (int)a2) @@ -8355,7 +8356,7 @@ int __thiscall WXSS::XCompiler::GetPageCss(char *this, int *a2, _DWORD *a3, int WXML::Rewrite::ToStringCode2((int)&v35, v12); v13 = std::operator<<(v24, &v35); v14 = std::operator<<>(v13, "\""); - std::operator<<>(v14, (char *)&off_50EEF5[2]); + std::operator<<>(v14, (char *)&off_50EEF5[2]); // ']' } std::string::_M_dispose((void **)&v35); std::operator<<>((std::ostream::sentry *)v39, (char *)&off_50EEF5[2]);