Update Settings Shell.

This commit is contained in:
Bruce
2025-11-29 23:02:15 +08:00
parent cf50b09bf0
commit 5796fb40e1
41 changed files with 515 additions and 383 deletions

View File

@@ -28,6 +28,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "appinstaller", "appinstalle
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "settings", "settings\settings.vcxproj", "{AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "settings", "settings\settings.vcxproj", "{AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}"
ProjectSection(ProjectDependencies) = postProject
{3AE2A022-ED83-41F1-948A-12A7593CBD00} = {3AE2A022-ED83-41F1-948A-12A7593CBD00}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reslib", "reslib\reslib.vcxproj", "{3AE2A022-ED83-41F1-948A-12A7593CBD00}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -117,6 +122,16 @@ Global
{AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}.Release|x64.Build.0 = Release|x64 {AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}.Release|x64.Build.0 = Release|x64
{AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}.Release|x86.ActiveCfg = Release|Win32 {AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}.Release|x86.ActiveCfg = Release|Win32
{AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}.Release|x86.Build.0 = Release|Win32 {AD25497F-A15F-4DFF-AC7A-B8ABF5F411D6}.Release|x86.Build.0 = Release|Win32
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Debug|Any CPU.ActiveCfg = Debug|Win32
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Debug|x64.ActiveCfg = Debug|x64
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Debug|x64.Build.0 = Debug|x64
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Debug|x86.ActiveCfg = Debug|Win32
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Debug|x86.Build.0 = Debug|Win32
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Release|Any CPU.ActiveCfg = Release|Win32
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Release|x64.ActiveCfg = Release|x64
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Release|x64.Build.0 = Release|x64
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Release|x86.ActiveCfg = Release|Win32
{3AE2A022-ED83-41F1-948A-12A7593CBD00}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -925,6 +925,7 @@ public ref class _I_Path
void set (String ^dir) { SetCurrentDirectoryW (MPStringToStdW (dir).c_str ()); } void set (String ^dir) { SetCurrentDirectoryW (MPStringToStdW (dir).c_str ()); }
} }
property String ^Program { String ^get () { return CStringToMPString (GetCurrentProgramPathW ()); } } property String ^Program { String ^get () { return CStringToMPString (GetCurrentProgramPathW ()); } }
property String ^Root { String ^get () { return CStringToMPString (GetFileDirectoryW (GetCurrentProgramPathW ())); }}
String ^Combine (String ^l, String ^r) { return CStringToMPString (CombinePath (MPStringToStdW (l), MPStringToStdW (r))); } String ^Combine (String ^l, String ^r) { return CStringToMPString (CombinePath (MPStringToStdW (l), MPStringToStdW (r))); }
String ^GetName (String ^path) String ^GetName (String ^path)
{ {

View File

@@ -169,12 +169,12 @@ public ref class _I_Bridge_Base
{ {
protected: protected:
_I_String ^str = gcnew _I_String (); _I_String ^str = gcnew _I_String ();
_I_Package ^pkg = gcnew _I_Package ();
_I_InitConfig ^initconfig = gcnew _I_InitConfig (); _I_InitConfig ^initconfig = gcnew _I_InitConfig ();
_I_Storage ^storage;
public: public:
property _I_String ^String { _I_String ^get () { return str; }} property _I_String ^String { _I_String ^get () { return str; }}
property _I_Package ^Package { _I_Package ^get () { return pkg; }}
property _I_InitConfig ^Config { _I_InitConfig ^get () { return initconfig; }} property _I_InitConfig ^Config { _I_InitConfig ^get () { return initconfig; }}
property _I_Storage ^Storage { _I_Storage ^get () { return storage; }}
}; };
[ComVisible (true)] [ComVisible (true)]
public interface class IScriptBridge public interface class IScriptBridge

View File

@@ -118,9 +118,21 @@ public ref class _I_Resources
String ^GetFromOthers (String ^filepath, unsigned int resid) String ^GetFromOthers (String ^filepath, unsigned int resid)
{ {
HMODULE module = nullptr; HMODULE module = nullptr;
if (filepath && IsNormalizeStringEmpty (MPStringToStdW (filepath))) module = GetModuleHandleW (MPStringToStdW (filepath).c_str ()); bool needrel = false;
if (filepath && !IsNormalizeStringEmpty (MPStringToStdW (filepath)))
{
HMODULE hRes = LoadLibraryExW (
MPStringToStdW (filepath).c_str (),
NULL,
LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE
);
needrel = hRes;
module = hRes;
}
else module = GetModuleHandleW (NULL); else module = GetModuleHandleW (NULL);
return GetRCStringCli (resid, module); auto ret = GetRCStringCli (resid, module);
if (needrel && module) FreeLibrary (module);
return ret;
} }
}; };
#endif #endif

30
reslib/ReadMe.txt Normal file
View File

@@ -0,0 +1,30 @@
========================================================================
动态链接库reslib 项目概述
========================================================================
应用程序向导已为您创建了此 reslib DLL。
本文件概要介绍组成 reslib 应用程序的每个文件的内容。
reslib.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
reslib.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
reslib.cpp
这是主 DLL 源文件。
/////////////////////////////////////////////////////////////////////////////
其他标准文件:
StdAfx.h, StdAfx.cpp
这些文件用于生成名为 reslib.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
/////////////////////////////////////////////////////////////////////////////
其他注释:
应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
/////////////////////////////////////////////////////////////////////////////

19
reslib/dllmain.cpp Normal file
View File

@@ -0,0 +1,19 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

23
reslib/reslib.cpp Normal file
View File

@@ -0,0 +1,23 @@
// reslib.cpp : 定义 DLL 应用程序的导出函数。
//
#include "stdafx.h"
#include "reslib.h"
#include "resource.h"
// 这是导出变量的一个示例
RESLIB_API int nreslib=0;
// 这是导出函数的一个示例。
RESLIB_API int fnreslib(void)
{
return 42;
}
// 这是已导出类的构造函数。
// 有关类定义的信息,请参阅 reslib.h
Creslib::Creslib()
{
return;
}

22
reslib/reslib.h Normal file
View File

@@ -0,0 +1,22 @@
// 下列 ifdef 块是创建使从 DLL 导出更简单的
// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 RESLIB_EXPORTS
// 符号编译的。在使用此 DLL 的
// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
// RESLIB_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
// 符号视为是被导出的。
#ifdef RESLIB_EXPORTS
#define RESLIB_API __declspec(dllexport)
#else
#define RESLIB_API __declspec(dllimport)
#endif
// 此类是从 reslib.dll 导出的
class RESLIB_API Creslib {
public:
Creslib(void);
// TODO: 在此添加您的方法。
};
extern RESLIB_API int nreslib;
RESLIB_API int fnreslib(void);

Binary file not shown.

View File

@@ -19,10 +19,9 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{278BD63A-C1F0-4D9A-90CD-EEB2EBED0ABF}</ProjectGuid> <ProjectGuid>{3AE2A022-ED83-41F1-948A-12A7593CBD00}</ProjectGuid>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <Keyword>Win32Proj</Keyword>
<Keyword>ManagedCProj</Keyword> <RootNamespace>reslib</RootNamespace>
<RootNamespace>uishell</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -30,28 +29,26 @@
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CLRSupport>true</CLRSupport> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CLRSupport>true</CLRSupport> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -86,77 +83,98 @@
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;RESLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>shlwapi.lib;version.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;RESLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies /> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;RESLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>shlwapi.lib;version.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;RESLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies /> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Text Include="ReadMe.txt" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\appinstaller\themeinfo.h" /> <ClInclude Include="reslib.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="Stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="uishell.h" /> <ClInclude Include="targetver.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" /> <ClCompile Include="dllmain.cpp">
<ClCompile Include="Stdafx.cpp"> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="reslib.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="uishell.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="ReadMe.txt" /> <ResourceCompile Include="reslib.rc" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="app.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@@ -15,41 +15,36 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="uishell.h"> <Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Stdafx.h"> <ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="reslib.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\appinstaller\themeinfo.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="uishell.cpp"> <ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="AssemblyInfo.cpp"> <ClCompile Include="reslib.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Stdafx.cpp"> <ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="ReadMe.txt" /> <ResourceCompile Include="reslib.rc">
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc">
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="app.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project> </Project>

BIN
reslib/resource.h Normal file

Binary file not shown.

8
reslib/stdafx.cpp Normal file
View File

@@ -0,0 +1,8 @@
// stdafx.cpp : 只包括标准包含文件的源文件
// reslib.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
// TODO: 在 STDAFX.H 中引用任何所需的附加头文件,
//而不是在此文件中引用

16
reslib/stdafx.h Normal file
View File

@@ -0,0 +1,16 @@
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // 从 Windows 头中排除极少使用的资料
// Windows 头文件:
#include <windows.h>
// TODO: 在此处引用程序需要的其他头文件

8
reslib/targetver.h Normal file
View File

@@ -0,0 +1,8 @@
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h并将
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>

View File

@@ -925,6 +925,11 @@ public ref class _I_Path
void set (String ^dir) { SetCurrentDirectoryW (MPStringToStdW (dir).c_str ()); } void set (String ^dir) { SetCurrentDirectoryW (MPStringToStdW (dir).c_str ()); }
} }
property String ^Program { String ^get () { return CStringToMPString (GetCurrentProgramPathW ()); } } property String ^Program { String ^get () { return CStringToMPString (GetCurrentProgramPathW ()); } }
property String ^Root { String ^get () {
std::wstring program = GetCurrentProgramPathW ();
std::wstring path = GetFileDirectoryW (program);
return CStringToMPString (GetFileDirectoryW (GetCurrentProgramPathW ()));
}}
String ^Combine (String ^l, String ^r) { return CStringToMPString (CombinePath (MPStringToStdW (l), MPStringToStdW (r))); } String ^Combine (String ^l, String ^r) { return CStringToMPString (CombinePath (MPStringToStdW (l), MPStringToStdW (r))); }
String ^GetName (String ^path) String ^GetName (String ^path)
{ {

View File

@@ -130,14 +130,115 @@ public ref class _I_InitConfig
Win32::InitConfig ^GetConfig () { return Create (CStringToMPString (g_initfile.filepath)); } Win32::InitConfig ^GetConfig () { return Create (CStringToMPString (g_initfile.filepath)); }
}; };
[ComVisible (true)] [ComVisible (true)]
public ref class _I_VisualElement
{
protected:
String ^appid;
public:
_I_VisualElement (String ^appid): appid (appid) {}
_I_VisualElement (): appid (String::Empty) {}
property String ^Id { String ^get () { return appid; } void set (String ^value) { appid = value; } }
#define PROPERTY_VELEMENT(_PropertyName_, _MethodName_) \
property String ^_PropertyName_ { \
String ^get() { \
return CStringToMPString(g_vemani._MethodName_(MPStringToStdW(appid))); \
} \
}
PROPERTY_VELEMENT (DisplayName, display_name)
PROPERTY_VELEMENT (Logo, logo)
PROPERTY_VELEMENT (SmallLogo, small_logo)
property String ^ForegroundText { String ^get () { return g_vemani.foreground_text (MPStringToStdW (appid)) == vemanifest::TextColor::light ? "light" : "dark"; }}
PROPERTY_VELEMENT (Lnk32x32Logo, lnk_32x32_logo)
PROPERTY_VELEMENT (ItemDisplayLogo, item_display_logo)
property bool ShowNameOnTile { bool get () { return g_vemani.show_name_on_tile (MPStringToStdW (appid)); }}
PROPERTY_VELEMENT (BackgroundColor, background_color)
PROPERTY_VELEMENT (SplashScreenImage, splash_screen_image)
PROPERTY_VELEMENT (SplashScreenBackgroundColor, splash_screen_backgroundcolor)
PROPERTY_VELEMENT (SplashScreenBackgroundColorDarkMode, splash_screen_backgroundcolor_darkmode)
#ifdef PROPERTY_VELEMENT
#undef PROPERTY_VELEMENT
#endif
Object ^Get (String ^propertyName)
{
String ^str = propertyName->ToLower ()->Trim ();
if (str == "displayname") return DisplayName;
else if (str == "logo") return Logo;
else if (str == "smalllogo") return SmallLogo;
else if (str == "foregroundtext") return ForegroundText;
else if (str == "lnk32x32logo") return Lnk32x32Logo;
else if (str == "shownameontile") return ShowNameOnTile;
else if (str == "backgroundcolor") return BackgroundColor;
else if (str == "splashscreenimage") return SplashScreenImage;
else if (str == "splashscreenbackgroundcolor") return SplashScreenBackgroundColor;
else if (str == "splashscreenbackgroundcolordarkmode") return SplashScreenBackgroundColorDarkMode;
return String::Empty;
}
Object ^operator [] (String ^propertyName) { return Get (propertyName); }
};
[ComVisible (true)]
public ref class _I_VisualElements
{
public:
array <String ^> ^GetIds ()
{
std::vector <std::wstring> res;
g_vemani.app_ids (res);
auto ret = gcnew array <String ^> (res.size ());
for (size_t i = 0; i < res.size (); i ++) ret [i] = CStringToMPString (res [i]);
return ret;
}
String ^GetIdsToJson () { return StringArrayToJson (GetIds ()); }
_I_VisualElement ^Get (String ^id) { return gcnew _I_VisualElement (id); }
_I_VisualElement ^operator [] (String ^id) { return Get (id); }
#define ATTRIBUTE_METHODS(_FunctionName_, _MethodName_) \
String^ _FunctionName_(String^ appid) { \
return CStringToMPString(g_vemani._MethodName_(MPStringToStdW(appid))); \
}
ATTRIBUTE_METHODS (DisplayName, display_name)
ATTRIBUTE_METHODS (Logo, logo)
ATTRIBUTE_METHODS (SmallLogo, small_logo)
String ^ForegroundText (String ^appid)
{
return g_vemani.foreground_text (MPStringToStdW (appid)) == vemanifest::TextColor::light ? "light" : "dark";
}
ATTRIBUTE_METHODS (Lnk32x32Logo, lnk_32x32_logo)
ATTRIBUTE_METHODS (ItemDisplayLogo, item_display_logo)
bool ShowNameOnTile (String ^appid) { return g_vemani.show_name_on_tile (MPStringToStdW (appid)); }
ATTRIBUTE_METHODS (BackgroundColor, background_color)
ATTRIBUTE_METHODS (SplashScreenImage, splash_screen_image)
ATTRIBUTE_METHODS (SplashScreenBackgroundColor, splash_screen_backgroundcolor)
ATTRIBUTE_METHODS (SplashScreenBackgroundColorDarkMode, splash_screen_backgroundcolor_darkmode)
#ifdef ATTRIBUTE_METHODS
#undef ATTRIBUTE_METHODS
#endif
Object ^GetValue (String ^appid, String ^attributeName)
{
auto attr = attributeName->ToLower ()->Trim ();
if (attr == "displayname") return DisplayName (appid);
else if (attr == "logo") return Logo (appid);
else if (attr == "smalllogo") return SmallLogo (appid);
else if (attr == "foregroundtext") return ForegroundText (appid);
else if (attr == "lnk32x32logo") return Lnk32x32Logo (appid);
else if (attr == "itemdisplaylogo") return ItemDisplayLogo (appid);
else if (attr == "shownameontile") return ShowNameOnTile (appid);
else if (attr == "backgroundcolor") return BackgroundColor (appid);
else if (attr == "splashscreenimage") return SplashScreenImage (appid);
else if (attr == "splashscreenbackgroundcolor") return SplashScreenBackgroundColor (appid);
else if (attr == "splashscreenbackgroundcolordarkmode") return SplashScreenBackgroundColorDarkMode (appid);
else return String::Empty;
}
};
[ComVisible (true)]
public ref class _I_Bridge_Base public ref class _I_Bridge_Base
{ {
protected: protected:
_I_String ^str = gcnew _I_String (); _I_String ^str = gcnew _I_String ();
_I_InitConfig ^initconfig = gcnew _I_InitConfig (); _I_InitConfig ^initconfig = gcnew _I_InitConfig ();
_I_Storage ^storage;
public: public:
property _I_String ^String { _I_String ^get () { return str; }} property _I_String ^String { _I_String ^get () { return str; }}
property _I_InitConfig ^Config { _I_InitConfig ^get () { return initconfig; }} property _I_InitConfig ^Config { _I_InitConfig ^get () { return initconfig; }}
property _I_Storage ^Storage { _I_Storage ^get () { return storage; }}
}; };
[ComVisible (true)] [ComVisible (true)]
public interface class IScriptBridge public interface class IScriptBridge
@@ -541,6 +642,12 @@ public ref class MainHtmlWnd: public System::Windows::Forms::Form, public IScrip
void FadeOutSplash () { wndinst->SplashScreen->FadeOut (); } void FadeOutSplash () { wndinst->SplashScreen->FadeOut (); }
}; };
[ComVisible (true)] [ComVisible (true)]
ref class _I_VisualElements2: public _I_VisualElements
{
public:
property _I_VisualElement ^Current {_I_VisualElement ^get () { return Get (CStringToMPString (g_idInVe)); }}
};
[ComVisible (true)]
ref class IBridge: public _I_Bridge_Base2 ref class IBridge: public _I_Bridge_Base2
{ {
private: private:
@@ -574,17 +681,18 @@ public ref class MainHtmlWnd: public System::Windows::Forms::Form, public IScrip
private: private:
_I_IEFrame ^ieframe; _I_IEFrame ^ieframe;
_I_System3 ^sys; _I_System3 ^sys;
_I_Storage ^storage; _I_VisualElements2 ^ve;
public: public:
IBridge (MainHtmlWnd ^wnd): wndinst (wnd), _I_Bridge_Base2 (wnd) IBridge (MainHtmlWnd ^wnd): wndinst (wnd), _I_Bridge_Base2 (wnd)
{ {
ieframe = gcnew _I_IEFrame (wnd); ieframe = gcnew _I_IEFrame (wnd);
sys = gcnew _I_System3 (wnd); sys = gcnew _I_System3 (wnd);
storage = gcnew _I_Storage (); storage = gcnew _I_Storage ();
ve = gcnew _I_VisualElements2 ();
} }
property _I_IEFrame ^IEFrame { _I_IEFrame ^get () { return ieframe; }} property _I_IEFrame ^IEFrame { _I_IEFrame ^get () { return ieframe; }}
property _I_System3 ^System { _I_System3 ^get () { return sys; }} property _I_System3 ^System { _I_System3 ^get () { return sys; }}
property _I_Storage ^Storage { _I_Storage ^get () { return storage; }} property _I_VisualElements2 ^VisualElements { _I_VisualElements2 ^get () { return ve; } }
}; };
protected: protected:
property WebBrowser ^WebUI { WebBrowser ^get () { return this->webui; } } property WebBrowser ^WebUI { WebBrowser ^get () { return this->webui; } }

View File

@@ -9,7 +9,12 @@ std::map <std::string, unsigned> g_nameToId = {
MAKENAMEIDMAP (IDS_DEFAULTWIDTH), MAKENAMEIDMAP (IDS_DEFAULTWIDTH),
MAKENAMEIDMAP (IDS_DEFAULTHEIGHT), MAKENAMEIDMAP (IDS_DEFAULTHEIGHT),
MAKENAMEIDMAP (IDS_MINWIDTH), MAKENAMEIDMAP (IDS_MINWIDTH),
MAKENAMEIDMAP (IDS_MINHIEHGT) MAKENAMEIDMAP (IDS_MINHIEHGT),
MAKENAMEIDMAP (IDS_TITLE),
MAKENAMEIDMAP (IDS_GUIDE),
MAKENAMEIDMAP (IDS_GUIDETEXT),
MAKENAMEIDMAP (IDS_TITLEFORMAT),
MAKENAMEIDMAP (IDS_GUIDETEXT_COMMON)
}; };
#ifdef MAKENAMEIDMAP #ifdef MAKENAMEIDMAP
@@ -39,9 +44,21 @@ public ref class _I_Resources
String ^GetFromOthers (String ^filepath, unsigned int resid) String ^GetFromOthers (String ^filepath, unsigned int resid)
{ {
HMODULE module = nullptr; HMODULE module = nullptr;
if (filepath && !IsNormalizeStringEmpty (MPStringToStdW (filepath))) module = GetModuleHandleW (MPStringToStdW (filepath).c_str ()); bool needrel = false;
if (filepath && !IsNormalizeStringEmpty (MPStringToStdW (filepath)))
{
HMODULE hRes = LoadLibraryExW (
MPStringToStdW (filepath).c_str (),
NULL,
LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE
);
needrel = hRes;
module = hRes;
}
else module = GetModuleHandleW (NULL); else module = GetModuleHandleW (NULL);
return GetRCStringCli (resid, module); auto ret = GetRCStringCli (resid, module);
if (needrel && module) FreeLibrary (module);
return ret;
} }
}; };
#endif #endif

Binary file not shown.

Binary file not shown.

View File

@@ -39,6 +39,9 @@
byid: function(resid) { return ext.System.Resources.GetById(resid); }, byid: function(resid) { return ext.System.Resources.GetById(resid); },
nameToId: function(resname) { return ext.System.Resources.ToId(resname); }, nameToId: function(resname) { return ext.System.Resources.ToId(resname); },
idToName: function(resid) { return ext.System.Resources.ToName(resid); }, idToName: function(resid) { return ext.System.Resources.ToName(resid); },
fromOthers: function(filepath, resid) { return ext.System.Resources.GetFromOthers(filepath, resid); },
fromFile: function(filepath, resid) { return ext.System.Resources.GetFromOthers(filepath, resid); },
fromfile: function(filepath, resid) { return ext.System.Resources.GetFromOthers(filepath, resid); },
}, },
Package: { Package: {
filepaths: function() { filepaths: function() {

View File

@@ -482,5 +482,65 @@
var json = JSON.parse(window.external.IEFrame.ParseHtmlColor(str)); var json = JSON.parse(window.external.IEFrame.ParseHtmlColor(str));
return new Color(json.r, json.g, json.b, json.a); return new Color(json.r, json.g, json.b, json.a);
} }
Color.getSuitableForegroundTextColor = function(backgroundColor, foregroundColorArray) {
// 将 0255 转为 W3C 的 01并做 gamma 校正
function gammaCorrect(c) {
c /= 255;
if (c <= 0.03928) return c / 12.92;
return Math.pow((c + 0.055) / 1.055, 2.4);
}
// 计算相对亮度 L01
function relativeLuminance(color) {
var R = gammaCorrect(color.red);
var G = gammaCorrect(color.green);
var B = gammaCorrect(color.blue);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
// 计算对比度 (L1+0.05)/(L2+0.05)
function contrastRatio(l1, l2) {
var light = Math.max(l1, l2);
var dark = Math.min(l1, l2);
return (light + 0.05) / (dark + 0.05);
}
// 混合背景透明度:背景 alpha 与白色混合
function blendWithWhite(color) {
const a = (color.alpha !== undefined ? color.alpha : 255) / 255;
return {
red: color.red * a + 255 * (1 - a),
green: color.green * a + 255 * (1 - a),
blue: color.blue * a + 255 * (1 - a),
alpha: 255
};
}
// 透明背景视为与白色叠加
const bg = blendWithWhite(backgroundColor);
const bgL = relativeLuminance(bg);
// 找出和背景对比度最高的前景色
let bestColor = null;
let bestContrast = -1;
for (var i = 0; i < foregroundColorArray.length; i++) {
var fg = foregroundColorArray[i];
var fgBlended = blendWithWhite(fg); // 若前景也有透明度
var fgL = relativeLuminance(fgBlended);
var cr = contrastRatio(bgL, fgL);
if (cr > bestContrast) {
bestContrast = cr;
bestColor = fg;
}
}
return bestColor;
}
Color.Const = {
white: new Color(255, 255, 255),
black: new Color(0, 0, 0),
red: new Color(255, 0, 0),
green: new Color(0, 255, 0),
blue: new Color(0, 0, 255),
yellow: new Color(255, 255, 0),
cyan: new Color(0, 255, 255),
magenta: new Color(255, 0, 255),
transparent: new Color(0, 0, 0, 0),
};
module.exports = { Color: Color }; module.exports = { Color: Color };
})(this); })(this);

View File

@@ -1,5 +1,17 @@
(function(global) { (function(global) {
"use strict"; "use strict";
var storage = Bridge.External.Storage;
var path = storage.path;
var root = path.getDir(path.program);
var respath = path.combine(root, "reslib.dll");
var res = Bridge.Resources;
global.respath = respath;
global.getPublicRes = function(resId) {
return res.fromfile(respath, resId);
}
global.publicRes = function(resId) {
return getFileResPair(respath, resId);
}
function ready(e) { function ready(e) {
function nextstep() { function nextstep() {

View File

@@ -12,17 +12,27 @@
} }
var byName = el.getAttribute('data-res-byname'); var byName = el.getAttribute('data-res-byname');
var byId = el.getAttribute('data-res-byid'); var byId = el.getAttribute('data-res-byid');
if ((byName && !Bridge.NString.empty(byName)) || (byId && parseInt(byId, 10) > 0)) { var fromFile = el.getAttribute('data-res-fromfile');
if ((byName && !Bridge.NString.empty(byName)) || (byId && parseInt(byId, 10) > 0) || (fromFile && !Bridge.NString.empty(fromFile))) {
result.push(el); result.push(el);
} }
} }
return result; // 返回符合条件的元素数组 return result; // 返回符合条件的元素数组
} }
module.exports = {
getFileResPair: function(filepath, resid) {
return {
filepath: filepath,
resid: resid
};
}
};
module.exports = { module.exports = {
Resources: { Resources: {
processAll: function() { processAll: function() {
var nodes = getAllNodesHasResource(); var nodes = getAllNodesHasResource();
var resources = Bridge.Resources;
for (var i = 0; i < nodes.length; i++) { for (var i = 0; i < nodes.length; i++) {
if (nodes[i].hasAttribute('data-res-byname')) { if (nodes[i].hasAttribute('data-res-byname')) {
var resName = nodes[i].getAttribute('data-res-byname'); var resName = nodes[i].getAttribute('data-res-byname');
@@ -30,6 +40,13 @@
} else if (nodes[i].hasAttribute('data-res-byid')) { } else if (nodes[i].hasAttribute('data-res-byid')) {
var resId = parseInt(nodes[i].getAttribute('data-res-byid'), 10); var resId = parseInt(nodes[i].getAttribute('data-res-byid'), 10);
nodes[i].textContent = Bridge.Resources.byid(resId); nodes[i].textContent = Bridge.Resources.byid(resId);
} else if (nodes[i].hasAttribute('data-res-fromfile')) {
try {
var obj = eval(nodes[i].getAttribute('data-res-fromfile'));
nodes[i].textContent = resources.fromfile(obj.filepath, obj.resid);
} catch (e) {
nodes[i].textContent = "";
}
} else { } else {
nodes[i].textContent = ""; nodes[i].textContent = "";
} }

View File

@@ -37,7 +37,7 @@
<header aria-label="Header content" role="banner" class="titlebanner" id="pagebanner" style="height: 120px;"> <header aria-label="Header content" role="banner" class="titlebanner" id="pagebanner" style="height: 120px;">
<button id="back" class="win-backbutton pagetitlewb-backbutton" onclick="Bridge.Frame.callEvent ('InvokeBackPage')" style="margin-left: 20px; transform: scale(0.72);" disabled></button> <button id="back" class="win-backbutton pagetitlewb-backbutton" onclick="Bridge.Frame.callEvent ('InvokeBackPage')" style="margin-left: 20px; transform: scale(0.72);" disabled></button>
<h2 class="titlearea win-type-ellipsis" id="apptitle" style=""> <h2 class="titlearea win-type-ellipsis" id="apptitle" style="">
<span class="pagetitlewb-title" id="apptitlestr" style="margin-left: 10px; margin-right: 20px;">Settings</span> <span class="pagetitlewb-title" id="apptitlestr" style="margin-left: 10px; margin-right: 20px;" data-res-byname="IDS_TITLE"></span>
</h2> </h2>
</header> </header>
<nav class="container"> <nav class="container">
@@ -46,8 +46,8 @@
</nav> </nav>
</aside> </aside>
<main class="main right padding"> <main class="main right padding">
<h2>设置</h2> <h2 data-res-byname="IDS_GUIDE"></h2>
<p>通过左侧的导航页,载入相应的设置。</p> <p data-res-byname="IDS_GUIDETEXT"></p>
</main> </main>
</div> </div>
</div> </div>

View File

@@ -26,6 +26,7 @@
<script type="text/javascript" src="../js/init.js"></script> <script type="text/javascript" src="../js/init.js"></script>
<script type="text/javascript" src="initsame.js"></script> <script type="text/javascript" src="initsame.js"></script>
<link rel="stylesheet" type="text/css" href="page.css"> <link rel="stylesheet" type="text/css" href="page.css">
<script type="text/javascript" src="appinstaller/preinit.js"></script>
<script type="text/javascript" src="appinstaller/items.js"></script> <script type="text/javascript" src="appinstaller/items.js"></script>
<script type="text/javascript" src="appinstaller/init.js"></script> <script type="text/javascript" src="appinstaller/init.js"></script>
</head> </head>
@@ -37,14 +38,11 @@
<header aria-label="Header content" role="banner" class="titlebanner" id="pagebanner" style="height: 120px;"> <header aria-label="Header content" role="banner" class="titlebanner" id="pagebanner" style="height: 120px;">
<button id="back" class="win-backbutton pagetitlewb-backbutton" onclick="Bridge.Frame.callEvent ('InvokeBackPage')" style="margin-left: 20px; transform: scale(0.72);"></button> <button id="back" class="win-backbutton pagetitlewb-backbutton" onclick="Bridge.Frame.callEvent ('InvokeBackPage')" style="margin-left: 20px; transform: scale(0.72);"></button>
<h2 class="titlearea win-type-ellipsis" id="apptitle" style=""> <h2 class="titlearea win-type-ellipsis" id="apptitle" style="">
<span class="pagetitlewb-title" id="apptitlestr" style="margin-left: 10px; margin-right: 20px;">Settings</span> <span class="pagetitlewb-title" id="apptitlestr" style="margin-left: 10px; margin-right: 20px;" data-res-fromfile="getFileResPair(exepath, 300)"></span>
</h2> </h2>
</header> </header>
<nav class="container"> <nav class="container">
<ul class="list"> <ul class="list">
<li role="button" tabindex="0">项1</li>
<li role="button" tabindex="0" class="selected">项2</li>
<li role="button" tabindex="0">项3</li>
</ul> </ul>
</nav> </nav>
</aside> </aside>

View File

@@ -26,13 +26,26 @@
<script type="text/javascript" src="../../js/init.js"></script> <script type="text/javascript" src="../../js/init.js"></script>
<link rel="stylesheet" type="text/css" href="../page.css"> <link rel="stylesheet" type="text/css" href="../page.css">
<link rel="stylesheet" type="text/css" href="../subpage.css"> <link rel="stylesheet" type="text/css" href="../subpage.css">
<script type="text/javascript" src="preinit.js"></script>
<script type="text/javascript" src="initsame.js"></script> <script type="text/javascript" src="initsame.js"></script>
</head> </head>
<body> <body>
<div class="section padding"> <div class="section padding">
<h2>App Installer Settings</h2> <h2 id="guide-title"></h2>
<p id="guide-desc" style="white-space: pre-wrap;"></p>
</div> </div>
<script>
(function() {
"use strict";
var res = Bridge.Resources;
var stru = Bridge.String;
var title = document.getElementById("guide-title");
title.textContent = stru.format(res.byname("IDS_TITLEFORMAT"), res.fromfile(exepath, 300));
var text = document.getElementById("guide-desc");
text.textContent = res.byname("IDS_GUIDETEXT_COMMON");
})();
</script>
</body> </body>
</html> </html>

View File

@@ -8,9 +8,9 @@
}; };
} }
var pages = { var pages = {
general: getPage("appinstaller/general.html", "General"), general: getPage("appinstaller/general.html", getPublicRes(101)),
theme: getPage("appinstaller/theme.html", "Theme"), theme: getPage("appinstaller/theme.html", getPublicRes(102)),
update: getPage("update.html", "Update") update: getPage("update.html", getPublicRes(103))
}; };
Object.defineProperty(global, "pages", { Object.defineProperty(global, "pages", {
get: function() { get: function() {

View File

@@ -0,0 +1,12 @@
(function(global) {
var storage = Bridge.External.Storage;
var path = storage.path;
var root = path.getDir(path.program);
var exepath = path.combine(root, "appinstaller.exe");
var id = "App";
var ve = Bridge.External.VisualElements.get(id);
var slideback = ve["BackgroundColor"];
global.slideback = slideback;
global.exepath = exepath;
global.visual = ve;
})(this);

View File

@@ -8,7 +8,17 @@
var content = guide.querySelector(".main"); var content = guide.querySelector(".main");
var shead = slide.querySelector("header"); var shead = slide.querySelector("header");
var list = slide.querySelector("ul"); var list = slide.querySelector("ul");
try { slide.style.backgroundColor = Bridge.UI.themeColor; } catch (e) {} var apptitle = shead.querySelector("#apptitle");
var backbtn = shead.querySelector("#back");
if (backbtn && backbtn.disabled) {
apptitle.style.marginLeft = backbtn.style.marginLeft;
} else {
apptitle.style.marginLeft = "";
}
try {
slide.style.backgroundColor = Bridge.UI.themeColor;
slide.style.color = Color.getSuitableForegroundTextColor(Color.parse(slide.style.backgroundColor), [Color.Const.white, Color.Const.black]);
} catch (e) {}
setTimeout(function() { setTimeout(function() {
slide.style.transition = "all 0.5s cubic-bezier(0.1, 0.9, 0.2, 1)"; slide.style.transition = "all 0.5s cubic-bezier(0.1, 0.9, 0.2, 1)";
}, 0); }, 0);

View File

@@ -1,5 +1,14 @@
(function(global) { (function(global) {
"use strict"; "use strict";
var res = Bridge.Resources;
var storage = Bridge.External.Storage;
var path = storage.path;
var root = path.getDir(path.program);
function getLibRes(libfilename, resid) {
var libpath = path.combine(root, libfilename);
return res.fromfile(libpath, resid);
}
function getSettingsItem(page, displayName) { function getSettingsItem(page, displayName) {
return { return {
@@ -8,7 +17,7 @@
}; };
} }
var settingItems = { var settingItems = {
appinstaller: getSettingsItem("appinstaller.html", "App Installer") appinstaller: getSettingsItem("appinstaller.html", getLibRes("appinstaller.exe", 300))
}; };
Object.defineProperty(global, "settingPages", { Object.defineProperty(global, "settingPages", {
get: function() { return settingItems; } get: function() { return settingItems; }

View File

@@ -121,7 +121,7 @@ aside.left {
left: 0px; left: 0px;
width: 300px; width: 300px;
box-sizing: border-box; box-sizing: border-box;
padding: 0; padding: 0 1px 0 0;
background-color: rgb(20, 0, 68); background-color: rgb(20, 0, 68);
color: white; color: white;
} }
@@ -157,11 +157,12 @@ aside .container ul li {
align-content: center; align-content: center;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
transition: all 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
} }
aside .container ul li.selected { aside .container ul li.selected {
/* background-color: rgba(101, 38, 254, 0.61); */ /* background-color: rgba(101, 38, 254, 0.61); */
background-color: rgba(95, 95, 95, 0.45); background-color: rgba(170, 170, 170, 0.45);
} }
aside .container ul li:hover { aside .container ul li:hover {
@@ -171,12 +172,17 @@ aside .container ul li:hover {
aside .container ul li:active { aside .container ul li:active {
background-color: white; background-color: white;
color: black; color: black;
transform: scale(0.9594);
} }
aside .container ul li:focus { aside .container ul li:focus {
border: 1px solid white; border: 1px solid white;
} }
#back:disabled {
display: none;
}
.main.right { .main.right {
position: absolute; position: absolute;
top: 0px; top: 0px;

View File

@@ -1,38 +0,0 @@
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
//
[assembly:AssemblyTitleAttribute(L"uishell")];
[assembly:AssemblyDescriptionAttribute(L"")];
[assembly:AssemblyConfigurationAttribute(L"")];
[assembly:AssemblyCompanyAttribute(L"")];
[assembly:AssemblyProductAttribute(L"uishell")];
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2025")];
[assembly:AssemblyTrademarkAttribute(L"")];
[assembly:AssemblyCultureAttribute(L"")];
//
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 您可以指定所有值,也可以使用“修订号”和“生成号”的默认值,
// 方法是按如下所示使用“*”: :
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];

View File

@@ -1,38 +0,0 @@
========================================================================
DYNAMIC LINK LIBRARY : uishell Project Overview
========================================================================
AppWizard has created this uishell DLL for you.
This file contains a summary of what you will find in each of the files that
make up your uishell application.
uishell.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
uishell.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
uishell.cpp
This is the main DLL source file.
uishell.h
This file contains a class declaration.
AssemblyInfo.cpp
Contains custom attributes for modifying assembly metadata.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,5 +0,0 @@
// stdafx.cpp : 只包括标准包含文件的源文件
// uishell.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"

View File

@@ -1,17 +0,0 @@
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
#pragma once
#include <Windows.h>
#include <set>
#include <msclr/marshal_cppstd.h>
#include <ShObjIdl.h>
#include <MsHTML.h>
#include <ExDisp.h>
#include <atlbase.h>
#include <fstream>
#include <comdef.h>
#include <vcclr.h>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -1,3 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

View File

@@ -1 +0,0 @@
../appinstaller/themeinfo.h

View File

@@ -1,6 +0,0 @@
// 这是主 DLL 文件。
#include "stdafx.h"
#include "uishell.h"

View File

@@ -1,197 +0,0 @@
// uishell.h
#pragma once
using namespace System;
using namespace System::Windows::Forms;
using namespace System::Runtime::InteropServices;
namespace Win32
{
using WebBrowserCli = System::Windows::Forms::WebBrowser;
public ref class SplashForm: Form
{
private:
PictureBox ^picbox;
Timer ^timer;
System::Drawing::Image ^splashimg = nullptr;
System::Drawing::Color background = System::Drawing::Color::Transparent;
double opastep = 0.05;
void InitForm ()
{
this->DoubleBuffered = true;
InitializeComponent ();
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->StartPosition = System::Windows::Forms::FormStartPosition::Manual;
this->ShowInTaskbar = false;
this->AllowTransparency = true;
this->Opacity = 1.0;
}
void InitializeComponent ()
{
double dDpi = GetDPI () * 0.01;
this->picbox = gcnew System::Windows::Forms::PictureBox ();
this->picbox->Size = System::Drawing::Size (620 * dDpi, 300 * dDpi);
this->picbox->BackColor = System::Drawing::Color::Transparent;
picbox->Anchor = System::Windows::Forms::AnchorStyles::None;
picbox->SizeMode = System::Windows::Forms::PictureBoxSizeMode::Zoom;
}
void OnFadeTimer (Object ^sender, EventArgs ^e)
{
auto fadeTimer = timer;
auto opacityStep = opastep;
if (this->Opacity > 0)
{
this->Opacity -= opacityStep;
}
else
{
fadeTimer->Stop ();
this->Close ();
}
}
void OnLoad (Object ^sender, EventArgs ^e)
{
this->ChangePosAndSize ();
this->Visible = true;
}
void OnResize (Object ^sender, EventArgs ^e)
{
if (IsHandleCreated && picbox->IsHandleCreated)
{
Drawing::Size sz = this->ClientSize;
this->picbox->Location = Drawing::Point (
(sz.Width - picbox->Width) * 0.5,
(sz.Height - picbox->Height) * 0.5
);
}
}
void OnResizeOwner (Object ^sender, EventArgs ^e) { this->ChangePosAndSize (); }
void OnLocationChangedOwner (Object ^sender, EventArgs ^e) { this->ChangePosAndSize (); }
protected:
virtual void OnHandleCreated (EventArgs^ e) override
{
Form::OnHandleCreated (e);
if (Environment::OSVersion->Version->Major >= 6)
{
INT mr = 0;
MARGINS margins = {mr, mr, mr, mr};
HRESULT hr = DwmExtendFrameIntoClientArea ((HWND)this->Handle.ToPointer (), &margins);
}
}
public:
SplashForm (System::String ^imgpath, System::Drawing::Color backcolor, System::Windows::Forms::Form ^owner)
{
if (owner != nullptr) this->Owner = owner;
InitForm ();
std::wstring filefullpath = MPStringToStdW (imgpath);
if (filefullpath.find (L'%') != filefullpath.npos) filefullpath = ProcessEnvVars (filefullpath);
filefullpath = GetFullPathName (imgpath ? MPStringToStdW (imgpath) : L"");
try
{
auto img = System::Drawing::Image::FromFile (gcnew System::String (filefullpath.c_str ()));
if (img != nullptr)
{
splashimg = img;
picbox->Image = img;
}
}
catch (...) {}
if (splashimg) picbox->Image = splashimg;
try
{
if (backcolor != Drawing::Color::Transparent)
{
background = backcolor;
picbox->BackColor = backcolor;
this->BackColor = backcolor;
}
else
{
picbox->BackColor = background;
this->BackColor = background;
}
}
catch (...) {}
if (this->Owner != nullptr)
{
this->Owner->Resize += gcnew System::EventHandler (this, &SplashForm::OnResizeOwner);
this->Owner->LocationChanged += gcnew System::EventHandler (this, &SplashForm::OnLocationChangedOwner);
}
this->Controls->Add (picbox);
this->Resize += gcnew EventHandler (this, &SplashForm::OnResize);
timer = gcnew System::Windows::Forms::Timer ();
timer->Interval = 15;
timer->Tick += gcnew System::EventHandler (this, &SplashForm::OnFadeTimer);
this->Load += gcnew EventHandler (this, &SplashForm::OnLoad);
}
void ReInit ()
{
InitForm ();
picbox = gcnew System::Windows::Forms::PictureBox ();
picbox->BackColor = background;
if (splashimg) picbox->Image = splashimg;
picbox->SizeMode = System::Windows::Forms::PictureBoxSizeMode::Zoom;
picbox->Anchor = System::Windows::Forms::AnchorStyles::None;
double dDpi = GetDPI () * 0.01;
picbox->Size = Drawing::Size (620 * dDpi, 300 * dDpi);
this->BackColor = background;
this->Controls->Clear ();
this->Controls->Add (picbox);
timer = gcnew System::Windows::Forms::Timer ();
timer->Interval = 15;
timer->Tick += gcnew EventHandler (this, &SplashForm::OnFadeTimer);
this->Resize += gcnew EventHandler (this, &SplashForm::OnResize);
this->Load += gcnew EventHandler (this, &SplashForm::OnLoad);
ChangePosAndSize ();
this->Opacity = 1.0;
}
void ChangePosAndSize ()
{
if (this->Owner && this->Owner->IsHandleCreated)
{
this->Owner->Update ();
System::Drawing::Point pt = this->Owner->PointToScreen (this->Owner->ClientRectangle.Location);
this->Location = pt;
this->Size = this->Owner->ClientSize;
}
else if (this->Parent && this->Parent->IsHandleCreated)
{
this->Parent->Update ();
System::Drawing::Point pt = this->Parent->PointToScreen (this->Parent->ClientRectangle.Location);
this->Location = pt;
this->Size = this->Parent->ClientSize;
}
if (IsHandleCreated && picbox->IsHandleCreated)
{
Drawing::Size sz = this->ClientSize;
this->picbox->Location = Drawing::Point (
(sz.Width - picbox->Width) * 0.5,
(sz.Height - picbox->Height) * 0.5
);
}
}
void SetSplashImage (System::Drawing::Image ^img) { if (picbox && picbox->IsHandleCreated) { splashimg = img; picbox->Image = splashimg; } else splashimg = img; }
void SetSplashImage (System::String ^imgpath) { try { SetSplashImage (System::Drawing::Image::FromFile (imgpath)); } catch (...) {} }
void SetSplashImage (const std::wstring &imgpath) { SetSplashImage (CStringToMPString (imgpath)); }
void SetSplashBackgroundColor (System::Drawing::Color color) { background = color; picbox->BackColor = color; this->BackColor = color; }
// 渐变消失
void FadeOut () { timer->Start (); }
// 立即消失(并没有)
void FadeAway () { timer->Start (); }
~SplashForm ()
{
if (this->Owner != nullptr)
{
this->Owner->Resize -= gcnew System::EventHandler (this, &SplashForm::OnResizeOwner);
this->Owner->LocationChanged -= gcnew System::EventHandler (this, &SplashForm::OnLocationChangedOwner);
}
}
};
public ref class WebBrowserForm: Form
{
private:
WebBrowserCli ^webui;
};
}