Fix bugs.

This commit is contained in:
Bruce
2025-12-22 23:58:53 +08:00
parent 4cf0a0a55d
commit 621c6fcfd3
5 changed files with 31 additions and 7 deletions

View File

@@ -191,12 +191,13 @@ int main (int argc, char *argv [])
{ {
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
std::wcout.imbue (std::locale ("", LC_CTYPE)); std::wcout.imbue (std::locale ("", LC_CTYPE));
CoInitializeEx (nullptr, COINIT_MULTITHREADED);
std::wcout << L"Please enter the file path: " << std::endl; std::wcout << L"Please enter the file path: " << std::endl;
std::wcout << L"\\> "; std::wcout << L"\\> ";
std::wstring pkgPathStr = L"E:\\Profiles\\Bruce\\Desktop\\Discourse.appx"; std::wstring pkgPathStr = L"E:\\Profiles\\Bruce\\Desktop\\Discourse.appx";
pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe\\FinanceApp_3.0.4.336_x86.appx"; //pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe\\FinanceApp_3.0.4.336_x86.appx";
//pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe.appxbundle"; //pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe.appxbundle";
//pkgPathStr = L""; pkgPathStr = L"E:\\Profiles\\Bruce\\Desktop\\н¨Îļþ¼Ð\\Microsoft.MSIXPackagingTool_2023.1212.538.0_neutral_~_8wekyb3d8bbwe.Msixbundle";
if (pkgPathStr.empty ()) std::getline (std::wcin, pkgPathStr); if (pkgPathStr.empty ()) std::getline (std::wcin, pkgPathStr);
pkgPathStr.erase ( pkgPathStr.erase (
std::remove (pkgPathStr.begin (), pkgPathStr.end (), L'\"'), std::remove (pkgPathStr.begin (), pkgPathStr.end (), L'\"'),

View File

@@ -368,7 +368,14 @@ class package_reader
{ {
#ifdef _PRI_READER_CLI_HEADER_ #ifdef _PRI_READER_CLI_HEADER_
pribundlereader.destroy (); pribundlereader.destroy ();
for (auto &it : prifilestreams) if (it != nullptr) DestroyAppxFileStream (it); for (auto &it : prifilestreams)
{
if (it != nullptr)
{
DestroyAppxFileStream (it);
it = nullptr;
}
}
prifilestreams.clear (); prifilestreams.clear ();
switch (this->package_type ()) switch (this->package_type ())
{ {
@@ -383,6 +390,7 @@ class package_reader
case PKGTYPE_BUNDLE: { case PKGTYPE_BUNDLE: {
HANDLE hls = nullptr, hss = nullptr; HANDLE hls = nullptr, hss = nullptr;
destruct rel1 ([&hls, &hss] () { destruct rel1 ([&hls, &hss] () {
if (hls == hss) hss = nullptr;
if (hls) DestroyAppxFileStream (hls); if (hls) DestroyAppxFileStream (hls);
if (hss) DestroyAppxFileStream (hss); if (hss) DestroyAppxFileStream (hss);
}); });
@@ -423,6 +431,9 @@ class package_reader
} }
} break; } break;
} }
std::sort (prifilestreams.begin (), prifilestreams.end ());
auto last = std::unique (prifilestreams.begin (), prifilestreams.end ());
prifilestreams.erase (last, prifilestreams.end ());
try try
{ {
std::vector <std::wstring> resnames; std::vector <std::wstring> resnames;
@@ -598,6 +609,7 @@ class package_reader
case PKGTYPE_BUNDLE: { case PKGTYPE_BUNDLE: {
HANDLE pkg = nullptr, pic = nullptr; HANDLE pkg = nullptr, pic = nullptr;
destruct relp ([&pic, &pkg] () { destruct relp ([&pic, &pkg] () {
if (pic == pkg) pkg = nullptr; // 虽然来说这个代码永远无法达到,但是保险起见
if (pic) DestroyAppxFileStream (pic); if (pic) DestroyAppxFileStream (pic);
if (pkg) DestroyAppxFileStream (pkg); if (pkg) DestroyAppxFileStream (pkg);
pkg = nullptr; pkg = nullptr;
@@ -616,12 +628,14 @@ class package_reader
if (lpstr) free (lpstr); if (lpstr) free (lpstr);
HANDLE pkg1 = nullptr, pic1 = nullptr; HANDLE pkg1 = nullptr, pic1 = nullptr;
destruct relp1 ([&pic1, &pkg1] () { destruct relp1 ([&pic1, &pkg1] () {
if (pic1 == pkg1) pkg1 = nullptr; // 虽然来说这个代码永远无法达到,但是保险起见
if (pic1) DestroyAppxFileStream (pic1); if (pic1) DestroyAppxFileStream (pic1);
if (pkg1) DestroyAppxFileStream (pkg1); if (pkg1) DestroyAppxFileStream (pkg1);
pkg1 = nullptr; pkg1 = nullptr;
pic1 = nullptr; pic1 = nullptr;
}); });
pkg1 = GetAppxBundleApplicationPackageFile (hReader); pkg1 = GetAppxBundleApplicationPackageFile (hReader);
if (pkg1 == pkg) pkg = nullptr;
if (pkg1) if (pkg1)
{ {
pic1 = GetFileFromPayloadPackage (pkg1, logo ().c_str ()); pic1 = GetFileFromPayloadPackage (pkg1, logo ().c_str ());
@@ -782,6 +796,7 @@ class package_reader
case PKGTYPE_BUNDLE: { case PKGTYPE_BUNDLE: {
HANDLE pkg = nullptr, pic = nullptr; HANDLE pkg = nullptr, pic = nullptr;
destruct relp ([&pic, &pkg] () { destruct relp ([&pic, &pkg] () {
if (pic == pkg) pkg = nullptr; // 虽然来说这个代码永远无法达到,但是保险起见
if (pic) DestroyAppxFileStream (pic); if (pic) DestroyAppxFileStream (pic);
if (pkg) DestroyAppxFileStream (pkg); if (pkg) DestroyAppxFileStream (pkg);
pkg = nullptr; pkg = nullptr;

View File

@@ -74,7 +74,7 @@
</ul> </ul>
</nav> </nav>
</aside> </aside>
<iframe class="main right"></iframe> <iframe class="main right" defer loading="lazy" async></iframe>
</div> </div>
</div> </div>
</body> </body>

View File

@@ -329,7 +329,15 @@
iframe.contentWindow.Theme.currentColor = color; iframe.contentWindow.Theme.currentColor = color;
iframe.contentWindow.Theme.currentTheme = id; iframe.contentWindow.Theme.currentTheme = id;
};*/ };*/
iframe.src = previewHtml + "?color=" + color + "&id=" + id; setTimeout(function(iframenode, iframesrc) {
iframenode.src = iframesrc;
}, 0, iframe, previewHtml + "?color=" + color + "&id=" + id);
// iframe.src = previewHtml + "?color=" + color + "&id=" + id;
try {
iframe.defer = true;
iframe.loading = "lazy";
iframe.async = true;
} catch (e) {}
item.appendChild(iframe); item.appendChild(iframe);
var colorstr = "light"; var colorstr = "light";
if (color === Theme.ColorType.dark) colorstr = "dark"; if (color === Theme.ColorType.dark) colorstr = "dark";
@@ -467,7 +475,7 @@
<br> <br>
<h3 data-res-fromfile="publicRes (174)"></h3> <h3 data-res-fromfile="publicRes (174)"></h3>
<label data-res-fromfile="publicRes (175)"></label><br> <label data-res-fromfile="publicRes (175)"></label><br>
<iframe src="../../preview.html" id="theme-custom-preview"></iframe> <iframe src="../../preview.html" id="theme-custom-preview" defer loading="lazy" async></iframe>
<br><br> <br><br>
<button id="jump-editpage" data-res-fromfile="publicRes (176)"></button> <button id="jump-editpage" data-res-fromfile="publicRes (176)"></button>
<script> <script>

View File

@@ -46,7 +46,7 @@
</ul> </ul>
</nav> </nav>
</aside> </aside>
<iframe class="main right"></iframe> <iframe class="main right" defer loading="lazy" async></iframe>
</div> </div>
</div> </div>
</body> </body>