feat: RenderCode

This commit is contained in:
msojocs 2023-08-11 09:57:06 +08:00
parent 9ee603335a
commit 1e0236bfcc
4 changed files with 38 additions and 10 deletions

View File

@ -95,11 +95,12 @@ namespace WXSS
std::string offset_0;
WXSS::Token offset_24;
bool offset_116; // 类型未确定
bool offset_132; // 类型未确定
std::vector<std::shared_ptr<CSSSyntaxTree>> offset_120;
bool offset_132; // 类型未确定,不是布尔值
std::shared_ptr<std::string> offset_140;
std::string offset_148;
std::string offset_164; // 类型?
int offset_164;
int offset_168;
int offset_172; // 类型未确定
CSSSyntaxTree(/* args */);
~CSSSyntaxTree();
@ -107,14 +108,14 @@ namespace WXSS
void Print2Stream(int, std::stringstream &);
void RenderCode(std::string &,bool);
};
using Offset0Type = int();
class Rule
{
private:
/* data */
public:
Offset0Type *offset_0 = nullptr;
using Offset0Type1 = int(std::shared_ptr<WXSS::CSSTreeLib::Rule>&, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &);
Offset0Type1 *offset_0 = nullptr;
std::vector<std::shared_ptr<WXSS::CSSTreeLib::Rule>> offset_4_vecPtr;
std::vector<std::pair<std::string, std::shared_ptr<WXSS::CSSTreeLib::Rule>>> offset_4_vecPair;
std::vector<std::string> offset_4_vecStr;
@ -129,6 +130,9 @@ namespace WXSS
public:
static LexicalChecker* instance;
static std::mutex m;
/**
*
*/
bool offset_0 = false;
std::shared_ptr<WXSS::CSSTreeLib::Rule> offset_4; // 8字节
LexicalChecker(/* args */);
@ -138,6 +142,7 @@ namespace WXSS
static LexicalChecker* GetInstance(bool);
};
using Offset0Type = int();
class Base
{
private:

View File

@ -20,10 +20,34 @@ namespace WXSS
{
if (!this->offset_172)
{
if (this->offset_132 && a3)
{
a2 += this->offset_132;
}
else
{
a2 += this->offset_24.GetLiteral();
}
for (int i = 0; i < this->offset_120.size(); i++)
{
auto cur = this->offset_120[i];
if (
i
&& cur->offset_164 > this->offset_120[i - 1]->offset_168
&& a2[a2.length() - 1] != '\n'
)
{
a2 += " ";
}
cur->RenderCode(a2, a3);
}
if (this->offset_0 == "MEDIA_RULE" || this->offset_0 == "RULE" || this->offset_0 == "DIRECTIVE")
{
a2 += "\n";
}
}
}
throw "not implement";
}
/**

View File

@ -146,9 +146,8 @@ namespace WXSS
{
if (this->offset_0)
{
this->offset_4->offset_4_vecPtr.back()->offset_0(this->offset_4, a2);
}
throw "not implement";
}
}

View File

@ -44808,7 +44808,7 @@ void __thiscall WXSS::CSSTreeLib::CSSSyntaxTree::RenderCode(int this, WXSS::Toke
v6 = 8 * v4;
if ( v4
&& *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4) + 164) > *(_DWORD *)(*(_DWORD *)(v7 + 8 * v4 - 8) + 168)
&& *(_BYTE *)(*(_DWORD *)a2 + *((_DWORD *)a2 + 1) - 1) != 10 )
&& *(_BYTE *)(*(_DWORD *)a2 + *((_DWORD *)a2 + 1) - 1) != '\n'/*10*/ )
{
std::string::operator+=(a2, " ");
v6 = 8 * v4;