Changed the UI and fixed bugs.

This commit is contained in:
Bruce
2026-01-11 15:10:55 +08:00
parent 2e6214a35a
commit 5b7b41a40c
10 changed files with 251 additions and 34 deletions

Binary file not shown.

View File

@@ -1,5 +1,4 @@
#include <Windows.h>
#include <set>
#include <msclr/marshal_cppstd.h>
#include <ShObjIdl.h>
#include <ShlObj.h> // KNOWNFOLDERID, SHGetKnownFolderPath
@@ -286,6 +285,37 @@ public ref class _I_System
return (error == ERROR_OLD_WIN_VERSION) ? FALSE : FALSE;
}
}
property int Archievement
{
int get ()
{
SYSTEM_INFO si;
ZeroMemory (&si, sizeof (si));
typedef VOID (WINAPI *LPFN_GetNativeSystemInfo)(LPSYSTEM_INFO);
LPFN_GetNativeSystemInfo fnGetNativeSystemInfo =
(LPFN_GetNativeSystemInfo)GetProcAddress (
GetModuleHandleW (L"kernel32.dll"),
"GetNativeSystemInfo");
if (fnGetNativeSystemInfo) fnGetNativeSystemInfo (&si);
else GetSystemInfo (&si);
return (int)si.wProcessorArchitecture;
}
}
property _I_Version ^Version
{
_I_Version ^get ()
{
auto ver = Environment::OSVersion->Version;
try
{
return gcnew _I_Version (ver->Major, ver->Minor, ver->Build, ver->Revision);
}
catch (...)
{
return gcnew _I_Version (ver->Major, ver->Minor, ver->Build, 0);
}
}
}
};
public ref class _I_System2: public _I_System
{
@@ -1038,7 +1068,7 @@ public ref class MainHtmlWnd: public System::Windows::Forms::Form, public IScrip
_I_IEFrame ^ieframe;
_I_System3 ^sys;
public:
IBridge (MainHtmlWnd ^wnd): wndinst (wnd), _I_Bridge_Base2 (wnd)
IBridge (MainHtmlWnd ^wnd): wndinst (wnd), _I_Bridge_Base2 (wnd)
{
ieframe = gcnew _I_IEFrame (wnd);
sys = gcnew _I_System3 (wnd);

View File

@@ -88,7 +88,9 @@ std::map <std::string, unsigned> g_nameToId = {
MAKENAMEIDMAP (IDS_MSGBOX_CLOSE),
MAKENAMEIDMAP (IDS_MSGBOX_HELP),
MAKENAMEIDMAP (IDS_MSGBOX_TRYAGAIN),
MAKENAMEIDMAP (IDS_MSGBOX_CONTINUE)
MAKENAMEIDMAP (IDS_MSGBOX_CONTINUE),
MAKENAMEIDMAP (IDS_PREINSTALL_SUPPOS),
MAKENAMEIDMAP (IDS_PREINSTALL_NOSUPPOS)
};
#ifdef MAKENAMEIDMAP

Binary file not shown.

View File

@@ -354,29 +354,55 @@ PCSPRIFILE CreatePriFileInstanceFromPath (LPCWSTR lpswFilePath)
}
return nullptr;
}
//void DestroyPriFileInstance (PCSPRIFILE pFilePri)
//{
// if (!pFilePri) return;
// try
// {
// if (g_tasklist.find (pFilePri) != g_tasklist.end ())
// {
// g_tasklist [pFilePri].bIsRunning = false;
// g_tasklist.erase (pFilePri);
// }
// IntPtr handlePtr = IntPtr (pFilePri);
// System::Runtime::InteropServices::GCHandle handle = System::Runtime::InteropServices::GCHandle::FromIntPtr (handlePtr);
// PriFileInst ^inst = safe_cast <PriFileInst ^> (handle.Target);
// delete inst;
// handle.Free ();
// System::GC::Collect ();
// System::GC::WaitForPendingFinalizers ();
// System::GC::Collect ();
// }
// catch (System::Exception ^e)
// {
// SetPriLastError (MPStringToStdW (e->Message));
// }
//}
void DestroyPriFileInstance (PCSPRIFILE pFilePri)
{
if (!pFilePri) return;
try
{
if (g_tasklist.find (pFilePri) != g_tasklist.end ())
CreateScopedLock (g_threadlock);
auto it = g_tasklist.find (pFilePri);
if (it != g_tasklist.end ())
{
g_tasklist [pFilePri].bIsRunning = false;
g_tasklist.erase (pFilePri);
it->second.bIsRunning = false;
g_tasklist.erase (it);
}
IntPtr handlePtr = IntPtr (pFilePri);
IntPtr handlePtr = IntPtr (pFilePri);
System::Runtime::InteropServices::GCHandle handle = System::Runtime::InteropServices::GCHandle::FromIntPtr (handlePtr);
PriFileInst ^inst = safe_cast <PriFileInst ^> (handle.Target);
delete inst;
handle.Free ();
System::GC::Collect ();
System::GC::WaitForPendingFinalizers ();
System::GC::Collect ();
}
catch (System::Exception ^e)
{
SetPriLastError (MPStringToStdW (e->Message));
}
System::GC::Collect ();
System::GC::WaitForPendingFinalizers ();
System::GC::Collect ();
}
LPCWSTR PriFileGetLastError ()
{
@@ -724,44 +750,96 @@ void PriFileIterateTaskCli (Object^ pFilePriObj)
PCSPRIFILE pFilePri = (PCSPRIFILE)ptr.ToPointer ();
PriFileIterateTask (pFilePri);
}
//void AddPriResourceName (PCSPRIFILE pFilePri, const std::vector <std::wnstring> &urilist)
//{
// if (!pFilePri) return;
// if (!urilist.size ()) return;
// try { g_tasklist.at (pFilePri); } catch (const std::exception &e) { g_tasklist [pFilePri] = TASKINFO_SEARCH (); }
// auto &task = g_tasklist.at (pFilePri);
// bool isallfined = true;
// {
// CreateScopedLock (g_threadlock);
// CreateScopedLock (g_iterlock);
// for (auto &it : urilist)
// {
// if (it.empty ()) continue;
// try
// {
// if (task.mapTasks [TASKITEM_SEARCH (it)].has_search ())
// {
// isallfined = isallfined && true;
// continue;
// }
// else isallfined = isallfined && false;
// }
// catch (const std::exception &e)
// {
// task.mapTasks [TASKITEM_SEARCH (it)] = TASKRESULT_FIND ();
// isallfined = isallfined && false;
// }
// }
// }
// if (isallfined) return;
// // while (task.bIsRunning) { Sleep (200); }
// System::Threading::Thread ^t = nullptr;
// if (!task.bIsRunning)
// {
// // task.bIsRunning = true;
// t = gcnew System::Threading::Thread (gcnew System::Threading::ParameterizedThreadStart (PriFileIterateTaskCli));
// t->IsBackground = true;
// t->Start (IntPtr (pFilePri));
// }
//}
void AddPriResourceName (PCSPRIFILE pFilePri, const std::vector <std::wnstring> &urilist)
{
if (!pFilePri) return;
if (!urilist.size ()) return;
try { g_tasklist.at (pFilePri); } catch (const std::exception &e) { g_tasklist [pFilePri] = TASKINFO_SEARCH (); }
auto &task = g_tasklist.at (pFilePri);
bool isallfined = true;
{
CreateScopedLock (g_threadlock);
if (g_tasklist.find (pFilePri) == g_tasklist.end ())
{
g_tasklist [pFilePri] = TASKINFO_SEARCH ();
}
}
TASKINFO_SEARCH *ptask = nullptr;
{
CreateScopedLock (g_threadlock);
ptask = &g_tasklist.at (pFilePri);
}
auto &task = *ptask;
bool isallfined = true;
{
CreateScopedLock (g_iterlock);
for (auto &it : urilist)
{
if (it.empty ()) continue;
try
TASKITEM_SEARCH key (it);
auto itFound = task.mapTasks.find (key);
if (itFound != task.mapTasks.end ())
{
if (task.mapTasks [TASKITEM_SEARCH (it)].has_search ())
if (itFound->second.has_search ())
{
isallfined = isallfined && true;
continue;
}
else isallfined = isallfined && false;
}
catch (const std::exception &e)
else
{
task.mapTasks [TASKITEM_SEARCH (it)] = TASKRESULT_FIND ();
task.mapTasks [key] = TASKRESULT_FIND ();
isallfined = isallfined && false;
}
}
}
if (isallfined) return;
// while (task.bIsRunning) { Sleep (200); }
System::Threading::Thread ^t = nullptr;
if (!task.bIsRunning)
{
// task.bIsRunning = true;
t = gcnew System::Threading::Thread (gcnew System::Threading::ParameterizedThreadStart (PriFileIterateTaskCli));
t->IsBackground = true;
t->Start (IntPtr (pFilePri));
CreateScopedLock (g_threadlock);
if (!task.bIsRunning)
{
System::Threading::Thread ^t = gcnew System::Threading::Thread (gcnew System::Threading::ParameterizedThreadStart (PriFileIterateTaskCli));
t->IsBackground = true;
t->Start (IntPtr (pFilePri));
}
}
}
void FindPriResource (PCSPRIFILE pFilePri, HLPCWSTRLIST hUriList)

View File

@@ -328,7 +328,7 @@ progress.win-ring:indeterminate::-ms-fill {
position: relative;
width: 100%;
max-width: 100%;
min-height: 10%;
min-height: 5%;
overflow-x: hidden;
overflow-y: auto;
max-height: calc(100% - 10.5em);
@@ -648,4 +648,24 @@ progress.win-ring:indeterminate::-ms-fill {
.page.installsuccess>.controls>.command button:nth-of-type(2),
.page.installfailed>.controls>.command button:nth-of-type(2) {
display: none;
}
.page .content .pkgsupport {
display: none;
}
.page.preinstall .content .pkgsupport.preinstall {
display: block;
}
.page .content .pkgsupport>* {
display: none;
}
.page .content .pkgsupport.support>.support {
display: block;
}
.page .content .pkgsupport.not-support>.not-support {
display: block;
}

View File

@@ -257,7 +257,12 @@
<p class="pkgtitle multiple" data-res-byname="IDS_PREINSTALL_MPKGNAME"></p>
<p class="pkgapplabel" data-res-byname="IDS_MSAPP"></p>
<p class="pkgpublisher" data-res-byname="IDS_PUBLISHER"></p>
<p class="pkgversion" data-res-byname="IDS_VERSION"></p><br />
<p class="pkgversion" data-res-byname="IDS_VERSION"></p>
<p class="pkgsupport preinstall">
<span class="support" data-res-byname="IDS_PREINSTALL_SUPPOS"></span>
<span class="not-support" data-res-byname="IDS_PREINSTALL_NOSUPPOS"></span>
</p>
<br />
<p class="pkgfunctions-label" data-res-byname="IDS_FUNCTIONNAME"></p>
<div class="functions">
<ul>
@@ -317,6 +322,7 @@
var slfilter = storelogo.querySelector(".filter");
var pi = Bridge.Package.pkginfo(this.value);
var reason = page.querySelector(".reason textarea");
var support = page.querySelector(".pkgsupport");
if (pi && pi.valid) {
var res = Bridge.Resources;
pkgtitle.textContent = strutils.format(res.byname("IDS_PREINSTALL_MPKGNAME"), pi.properties.display_name);
@@ -355,7 +361,16 @@
storelogo.style.backgroundColor = bc;
slfilter.style.background = Color.genTileBackFilter(bc);
}
setFlyoutDisplayInfo(pi);
var support = setFlyoutDisplayInfo(pi);
var supportDisplay = page.querySelector(".pkgsupport");
if (support.architectureSupport && support.osminversionSupport) {
supportDisplay.classList.add("support");
supportDisplay.classList.remove("not-support");
} else {
supportDisplay.classList.add("not-support");
supportDisplay.classList.remove("support");
}
supportDisplay.setAttribute("title", strutils.format("OS Min Version: {0}, Architecture: {1}", support.showOsminversionText, support.showArchitectureText));
var hres = Bridge.Package.installResult(this.value);
if (hres && hres.failed) {
reason.textContent = hres.message;

View File

@@ -113,6 +113,7 @@
push_nonull(titlepart, content.querySelector(".pkgapplabel"));
push_nonull(titlepart, content.querySelector(".pkgpublisher"));
push_nonull(titlepart, content.querySelector(".pkgversion"));
push_nonull(titlepart, content.querySelector(".pkgsupport"));
push_nonull(textpart, content.querySelector(".pkgfunctions-label"));
push_nonull(textpart, content.querySelector(".functions"));
push_nonull(textpart, content.querySelector(".moreinfo"));
@@ -320,6 +321,13 @@
function setFlyoutDisplayInfo(pkginfo) {
var flyout = document.getElementById("moreinfo-flyout");
var content = document.getElementById("moreinfo-flyout-content");
var ret = {
architectureSupport: false,
osminversionSupport: false,
showArchitectureText: "",
showOsminversionText: "",
};
var sysArch = Bridge.External.System.Archievement;
(function() {
var name = content.querySelector(".id.name");
name.textContent = pkginfo.identity.name;
@@ -328,32 +336,52 @@
var version = content.querySelector(".id.version");
version.textContent = stringifyVersion(pkginfo.identity.realver);
var arch = content.querySelector(".id.arch");
console.log(pkginfo.identity.architecture);
if (pkginfo.type === 1) {
switch (pkginfo.identity.architecture) {
case 1:
arch.textContent = "x86";
if (sysArch == 0 || sysArch == 9) ret.architectureSupport = true;
break;
case 2:
arch.textContent = "x64";
if (sysArch == 9) ret.architectureSupport = true;
break;
case 4:
arch.textContent = "ARM";
if (sysArch == 5 || sysArch == 12) ret.architectureSupport = true;
break;
case 8:
arch.textContent = "ARM64";
if (sysArch == 12) ret.architectureSupport = true;
break;
case 16:
case 15:
arch.textContent = "Neutral";
if (sysArch != 6 && sysArch > 0) ret.architectureSupport = true;
break;
}
ret.showArchitectureText = arch.textContent;
} else if (pkginfo.type === 2) {
var varch = pkginfo.identity.architecture;
var strarr = [];
if (varch & 1) strarr.push("x86");
if (varch & 2) strarr.push("x64");
if (varch & 4) strarr.push("ARM");
if (varch & 8) strarr.push("ARM64");
if (varch & 1) {
strarr.push("x86");
if (sysArch == 0 || sysArch == 9) ret.architectureSupport = true;
}
if (varch & 2) {
strarr.push("x64");
if (sysArch == 9) ret.architectureSupport = true;
}
if (varch & 4) {
strarr.push("ARM");
if (sysArch == 5 || sysArch == 12) ret.architectureSupport = true;
}
if (varch & 8) {
strarr.push("ARM64");
if (sysArch == 12) ret.architectureSupport = true;
}
arch.textContent = strarr.join(", ");
ret.showArchitectureText = arch.textContent;
}
var family = content.querySelector(".id.family");
family.textContent = pkginfo.identity.package_family_name;
@@ -370,6 +398,24 @@
var sys = content.querySelector(".info.sys");
var strutils = Bridge.External.String;
sys.textContent = strutils.format(Bridge.Resources.byname("IDS_MOREINFO_INFOSYS_VALUE"), pkginfo.prerequisites.os_min_version_description, stringifyVersion(pkginfo.prerequisites.os_min_version));
var pkgSupportVer = pkginfo.prerequisites.os_min_version;
var systemSupportVer = Bridge.External.System.Version;
ret.showOsminversionText = stringifyVersion(pkgSupportVer);
if (pkgSupportVer.major < systemSupportVer.major) {
ret.osminversionSupport = true;
} else if (pkgSupportVer.major == systemSupportVer.major) {
if (pkgSupportVer.minor < systemSupportVer.minor) {
ret.osminversionSupport = true;
} else if (pkgSupportVer.minor == systemSupportVer.minor) {
if (pkgSupportVer.major == 6 && pkgSupportVer.minor == 3 && pkgSupportVer.build == 1) {
if (pkginfo.identity.architecture & (4 | 8)) {
ret.osminversionSupport = true;
}
} else {
ret.osminversionSupport = true;
}
}
}
var lang = content.querySelector(".info.langs");
lang.innerHTML = "";
for (var i = 0; i < pkginfo.resources.languages.length; i++) {
@@ -379,6 +425,7 @@
lang.appendChild(li);
}
})();
return ret;
}
function noticeLoadPreinstallPage(ismul) {
@@ -451,7 +498,16 @@
funclist.appendChild(li);
}
}
setFlyoutDisplayInfo(pkginfo);
var support = setFlyoutDisplayInfo(pkginfo);
var supportDisplay = page.querySelector(".pkgsupport");
if (support.architectureSupport && support.osminversionSupport) {
supportDisplay.classList.add("support");
supportDisplay.classList.remove("not-support");
} else {
supportDisplay.classList.add("not-support");
supportDisplay.classList.remove("support");
}
supportDisplay.setAttribute("title", strutils.format("OS Min Version: {0}, Architecture: {1}", support.showOsminversionText, support.showArchitectureText));
}
}

View File

@@ -30,12 +30,20 @@
}
.page .reason textarea {
background-color: rgba (255, 255, 255, 0);
background-color: rgba(255, 255, 255, 0);
color: white;
border: 2px solid white;
box-sizing: border-box;
}
.page .content .pkgsupport.support>.support {
color: rgb(84, 197, 52);
}
.page .content .pkgsupport.not-support>.not-support {
color: rgb(209, 57, 46);
}
/* App Launch List */

View File

@@ -20,6 +20,14 @@
color: #0078d7;
}
.page .content .pkgsupport.support>.support {
color: rgb(0, 138, 23);
}
.page .content .pkgsupport.not-support>.not-support {
color: rgb(236, 28, 36);
}
/* App Launch List */