mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-04-11 17:57:19 +10:00
Update Reader.
This commit is contained in:
@@ -48,6 +48,10 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -70,6 +74,7 @@
|
||||
<Compile Include="PriFileNative.cs" />
|
||||
<Compile Include="PriReader.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataUtils\DataUtils.csproj">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,8 @@ namespace NativeWrappers
|
||||
using UINT64 = System.UInt64;
|
||||
using HRESULT = System.Int32;
|
||||
using ULONG = System.UInt32;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public static class PackageReadHelper
|
||||
{
|
||||
@@ -304,6 +306,7 @@ namespace NativeWrappers
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// ================= Manifest Reader =================
|
||||
|
||||
[DllImport (DllName, CallingConvention = CallConv, CharSet = CharSet.Unicode)]
|
||||
@@ -404,5 +407,160 @@ namespace NativeWrappers
|
||||
[DllImport (DllName, CallingConvention = CallConv, CharSet = CharSet.Unicode)]
|
||||
public static extern IntPtr GetManifestPrerequistieSystemVersionName (IntPtr hReader, string lpName);
|
||||
|
||||
// ========== Appx Bundle Resource Packages ==========
|
||||
[DllImport (DllName, CallingConvention = CallConv)]
|
||||
private static extern IntPtr GetAppxBundleAllResourcePackageFileNames (IntPtr hReader);
|
||||
|
||||
[DllImport (DllName, CallingConvention = CallConv)]
|
||||
private static extern void FreeAppxBundlePayloadsFileNameList (IntPtr hStringList);
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Bundle 包中所有资源包的文件名列表。
|
||||
/// </summary>
|
||||
/// <param name="hReader">由 CreatePackageReader 创建的读取器句柄</param>
|
||||
/// <returns>资源包文件名数组,若无资源包或非 bundle 类型则返回空数组</returns>
|
||||
public static string [] GetAppxBundleAllResourcePackageFileNameList (IntPtr hReader)
|
||||
{
|
||||
IntPtr hList = GetAppxBundleAllResourcePackageFileNames (hReader);
|
||||
if (hList == IntPtr.Zero)
|
||||
return new string [0];
|
||||
|
||||
try
|
||||
{
|
||||
return ReadWStringList (hList);
|
||||
}
|
||||
finally
|
||||
{
|
||||
FreeAppxBundlePayloadsFileNameList (hList);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (DllName, CallingConvention = CallConv)]
|
||||
private static extern IntPtr GetAppxBundleAllLocaleResourcePackageFileNames (IntPtr hReader);
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Bundle 包中所有区域设置资源包的文件名列表。
|
||||
/// </summary>
|
||||
/// <param name="hReader">由 CreatePackageReader 创建的读取器句柄</param>
|
||||
/// <returns>区域设置资源包文件名数组,若无则返回空数组</returns>
|
||||
public static string [] GetAppxBundleAllLocaleResourcePackageFileNameList (IntPtr hReader)
|
||||
{
|
||||
IntPtr hList = GetAppxBundleAllLocaleResourcePackageFileNames (hReader);
|
||||
if (hList == IntPtr.Zero)
|
||||
return new string [0];
|
||||
|
||||
try
|
||||
{
|
||||
return ReadWStringList (hList);
|
||||
}
|
||||
finally
|
||||
{
|
||||
FreeAppxBundlePayloadsFileNameList (hList);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (DllName, CallingConvention = CallConv)]
|
||||
private static extern IntPtr GetAppxBundleAllFileResourcePackageFileNames (IntPtr hReader);
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Bundle 包中所有文件资源包的文件名列表。
|
||||
/// </summary>
|
||||
/// <param name="hReader">由 CreatePackageReader 创建的读取器句柄</param>
|
||||
/// <returns>文件资源包文件名数组,若无则返回空数组</returns>
|
||||
public static string [] GetAppxBundleAllFileResourcePackageFileNameList (IntPtr hReader)
|
||||
{
|
||||
IntPtr hList = GetAppxBundleAllFileResourcePackageFileNames (hReader);
|
||||
if (hList == IntPtr.Zero)
|
||||
return new string [0];
|
||||
|
||||
try
|
||||
{
|
||||
return ReadWStringList (hList);
|
||||
}
|
||||
finally
|
||||
{
|
||||
FreeAppxBundlePayloadsFileNameList (hList);
|
||||
}
|
||||
}
|
||||
|
||||
// 用于更新应用项名称列表(设置要查询的项)
|
||||
[DllImport (DllName, CallingConvention = CallConv, CharSet = CharSet.Unicode)]
|
||||
public static extern void UpdatePackageApplicationItemGetName (
|
||||
[In] IntPtr [] lpNames, // 传入一个 IntPtr 数组,每个元素指向一个 Unicode 字符串
|
||||
uint dwArrLen
|
||||
);
|
||||
|
||||
// 回调委托声明
|
||||
[UnmanagedFunctionPointer (CallConv)]
|
||||
public delegate void IterWStringCallback ([MarshalAs (UnmanagedType.LPWStr)] string lpString);
|
||||
|
||||
// 枚举当前列表中的项(通过回调逐个返回)
|
||||
[DllImport (DllName, CallingConvention = CallConv, CharSet = CharSet.Unicode)]
|
||||
public static extern void GetPackageApplicationItemGetNameList (
|
||||
IterWStringCallback pfCallback // 回调函数指针
|
||||
);
|
||||
/// <summary>
|
||||
/// 更新内部的应用项名称列表(设置要查询的项)
|
||||
/// </summary>
|
||||
/// <param name="names">要设置的项名称集合</param>
|
||||
public static void SetApplicationItemNames (IEnumerable<string> names)
|
||||
{
|
||||
if (names == null)
|
||||
{
|
||||
// 传入空数组,清空列表
|
||||
UpdatePackageApplicationItemGetName (new IntPtr [0], 0);
|
||||
return;
|
||||
}
|
||||
|
||||
var nameList = names.ToList ();
|
||||
if (nameList.Count == 0)
|
||||
{
|
||||
UpdatePackageApplicationItemGetName (new IntPtr [0], 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// 为每个字符串分配非托管内存
|
||||
IntPtr [] ptrs = new IntPtr [nameList.Count];
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < nameList.Count; i++)
|
||||
{
|
||||
ptrs [i] = Marshal.StringToHGlobalUni (nameList [i]);
|
||||
}
|
||||
|
||||
UpdatePackageApplicationItemGetName (ptrs, (uint)nameList.Count);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 释放分配的内存
|
||||
foreach (var ptr in ptrs)
|
||||
{
|
||||
if (ptr != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal (ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取当前内部的应用项名称列表(通过回调收集所有项)
|
||||
/// </summary>
|
||||
/// <returns>应用项名称数组</returns>
|
||||
public static string [] GetApplicationItemNames ()
|
||||
{
|
||||
var result = new List<string> ();
|
||||
|
||||
// 定义回调:将收到的字符串添加到列表
|
||||
IterWStringCallback callback = (str) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty (str))
|
||||
result.Add (str);
|
||||
};
|
||||
|
||||
// 调用本机函数,传入委托
|
||||
GetPackageApplicationItemGetNameList (callback);
|
||||
|
||||
// 注意:GC 需要保持 callback 的存活直到本机调用结束,这里通过局部变量引用即可,
|
||||
// 因为本机函数是同步调用的,不会在函数返回后继续使用回调。
|
||||
return result.ToArray ();
|
||||
}
|
||||
}
|
||||
}
|
||||
67
AppxPackage/Utils.cs
Normal file
67
AppxPackage/Utils.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
internal static class Utils
|
||||
{
|
||||
public static string PascalToCamel (string pascalCase)
|
||||
{
|
||||
if (string.IsNullOrEmpty (pascalCase))
|
||||
return pascalCase;
|
||||
|
||||
// 已经是小驼峰或首字母小写,直接返回
|
||||
if (char.IsLower (pascalCase [0]))
|
||||
return pascalCase;
|
||||
|
||||
// 按大写字母边界拆分单词(处理连续大写字母作为一个单词)
|
||||
// 正则解释:
|
||||
// (?<=[a-z])(?=[A-Z]) 小写后跟大写 -> 分割
|
||||
// | 或
|
||||
// (?<=[A-Z])(?=[A-Z][a-z]) 大写后跟大写+小写(如 XMLR 中的 X 和 MLR)-> 分割
|
||||
string [] words = Regex.Split (pascalCase, @"(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])");
|
||||
|
||||
StringBuilder result = new StringBuilder ();
|
||||
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
{
|
||||
string word = words [i];
|
||||
if (string.IsNullOrEmpty (word))
|
||||
continue;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
// 第一个单词:全部转为小写
|
||||
result.Append (word.ToLowerInvariant ());
|
||||
}
|
||||
else
|
||||
{
|
||||
// 后续单词:首字母大写,其余小写
|
||||
result.Append (char.ToUpperInvariant (word [0]));
|
||||
if (word.Length > 1)
|
||||
result.Append (word.Substring (1).ToLowerInvariant ());
|
||||
}
|
||||
}
|
||||
|
||||
return result.ToString ();
|
||||
}
|
||||
/// <summary>
|
||||
/// 表示应用清单中用于定义文件/资源路径的属性名称
|
||||
/// </summary>
|
||||
public static readonly List<string> AppFileProperties = new List<string>
|
||||
{
|
||||
"Executable",
|
||||
"LockScreenLogo",
|
||||
"Logo",
|
||||
"SmallLogo",
|
||||
"Square150x150Logo",
|
||||
"Square30x30Logo",
|
||||
"Square310x310Logo",
|
||||
"Square44x44Logo",
|
||||
"Square70x70Logo",
|
||||
"Square71x71Logo",
|
||||
"StartPage",
|
||||
"Tall150x310Logo",
|
||||
"WideLogo",
|
||||
"Wide310x150Logo"
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net40" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -539,8 +539,7 @@ namespace DataUtils
|
||||
public void File (string filter, string initDir, object jsCallback)
|
||||
{
|
||||
IWin32Window owner = GetActiveWindowOwner ();
|
||||
Thread t = new Thread (() =>
|
||||
{
|
||||
Thread t = new Thread (() => {
|
||||
string result = string.Empty;
|
||||
try
|
||||
{
|
||||
@@ -565,8 +564,7 @@ namespace DataUtils
|
||||
public void Files (string filter, string initDir, object jsCallback)
|
||||
{
|
||||
IWin32Window owner = GetActiveWindowOwner ();
|
||||
Thread t = new Thread (() =>
|
||||
{
|
||||
Thread t = new Thread (() => {
|
||||
string result = "[]";
|
||||
try
|
||||
{
|
||||
@@ -591,8 +589,7 @@ namespace DataUtils
|
||||
public void Dir (string initDir, object jsCallback)
|
||||
{
|
||||
IWin32Window owner = GetActiveWindowOwner ();
|
||||
Thread t = new Thread (() =>
|
||||
{
|
||||
Thread t = new Thread (() => {
|
||||
string result = string.Empty;
|
||||
try
|
||||
{
|
||||
@@ -616,8 +613,7 @@ namespace DataUtils
|
||||
public void Dirs (string initDir, object jsCallback)
|
||||
{
|
||||
IWin32Window owner = GetActiveWindowOwner ();
|
||||
Thread t = new Thread (() =>
|
||||
{
|
||||
Thread t = new Thread (() => {
|
||||
string result = "[]";
|
||||
try
|
||||
{
|
||||
@@ -649,8 +645,71 @@ namespace DataUtils
|
||||
}
|
||||
[ComVisible (true)]
|
||||
[ClassInterface (ClassInterfaceType.AutoDual)]
|
||||
public class _I_Folder
|
||||
{
|
||||
[DllImport ("shell32.dll")]
|
||||
private static extern int SHGetKnownFolderPath (
|
||||
[MarshalAs (UnmanagedType.LPStruct)] Guid rfid,
|
||||
uint dwFlags,
|
||||
IntPtr hToken,
|
||||
out IntPtr ppszPath);
|
||||
private static string KF (Guid g)
|
||||
{
|
||||
IntPtr p;
|
||||
SHGetKnownFolderPath (g, 0, IntPtr.Zero, out p);
|
||||
string s = Marshal.PtrToStringUni (p);
|
||||
Marshal.FreeCoTaskMem (p);
|
||||
return s;
|
||||
}
|
||||
private static readonly Guid FOLDERID_Downloads = new Guid ("374DE290-123F-4565-9164-39C4925E467B");
|
||||
private static readonly Guid FOLDERID_SavedPictures = new Guid ("3B193882-D3AD-4EAB-965A-69829D1FB59F");
|
||||
private static readonly Guid FOLDERID_SavedGames = new Guid ("4C5C32FF-BB9D-43B0-BF90-45A0FEEB6D0E");
|
||||
private static readonly Guid FOLDERID_Links = new Guid ("BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968");
|
||||
private static readonly Guid FOLDERID_Contacts = new Guid ("56784854-C6CB-462B-8169-88E350ACB882");
|
||||
private static readonly Guid FOLDERID_Searches = new Guid ("7D1D3A04-DEBB-4115-95CF-2F29DA2920DA");
|
||||
public string ProgramFiles => Environment.GetFolderPath (Environment.SpecialFolder.ProgramFiles);
|
||||
public string ProgramFilesX86 => Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86);
|
||||
public string Windows => Environment.GetFolderPath (Environment.SpecialFolder.Windows);
|
||||
public string System32 => Environment.SystemDirectory;
|
||||
public string UserProfile => Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
|
||||
public string Desktop => Environment.GetFolderPath (Environment.SpecialFolder.Desktop);
|
||||
public string Documents => Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
|
||||
public string Pictures => Environment.GetFolderPath (Environment.SpecialFolder.MyPictures);
|
||||
public string Music => Environment.GetFolderPath (Environment.SpecialFolder.MyMusic);
|
||||
public string Videos => Environment.GetFolderPath (Environment.SpecialFolder.MyVideos);
|
||||
public string AppDataRoaming => Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
|
||||
public string AppDataLocal => Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData);
|
||||
public string AppDataLocalLow => Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData) + "\\Low";
|
||||
public string Temp => System.IO.Path.GetTempPath ();
|
||||
public string PublicDesktop => Environment.GetFolderPath (Environment.SpecialFolder.CommonDesktopDirectory);
|
||||
public string PublicDocuments => Environment.GetFolderPath (Environment.SpecialFolder.CommonDocuments);
|
||||
public string PublicPictures => Environment.GetFolderPath (Environment.SpecialFolder.CommonPictures);
|
||||
public string PublicMusic => Environment.GetFolderPath (Environment.SpecialFolder.CommonMusic);
|
||||
public string PublicVideos => Environment.GetFolderPath (Environment.SpecialFolder.CommonVideos);
|
||||
public string Downloads => KF (FOLDERID_Downloads);
|
||||
public string SavedPictures => KF (FOLDERID_SavedPictures);
|
||||
public string SavedGames => KF (FOLDERID_SavedGames);
|
||||
public string Links => KF (FOLDERID_Links);
|
||||
public string Contacts => KF (FOLDERID_Contacts);
|
||||
public string Searches => KF (FOLDERID_Searches);
|
||||
}
|
||||
[ComVisible (true)]
|
||||
[ClassInterface (ClassInterfaceType.AutoDual)]
|
||||
public class _I_Storage
|
||||
{
|
||||
[DllImport ("user32.dll")]
|
||||
private static extern IntPtr GetForegroundWindow ();
|
||||
class WindowWrapper: IWin32Window
|
||||
{
|
||||
private IntPtr _hwnd;
|
||||
public WindowWrapper (IntPtr handle) { _hwnd = handle; }
|
||||
public IntPtr Handle { get { return _hwnd; } }
|
||||
}
|
||||
private static IWin32Window GetActiveWindowOwner ()
|
||||
{
|
||||
IntPtr hWnd = GetForegroundWindow ();
|
||||
return hWnd != IntPtr.Zero ? new WindowWrapper (hWnd) : null;
|
||||
}
|
||||
private static void CallJS (object jsFunc, params object [] args)
|
||||
{
|
||||
if (jsFunc == null) return;
|
||||
@@ -680,6 +739,35 @@ namespace DataUtils
|
||||
public _I_Directory GetDirectory (string path) { return new _I_Directory (path); }
|
||||
public _I_Directory GetDir (string path) { return GetDirectory (path); }
|
||||
public _I_Explorer Explorer => new _I_Explorer ();
|
||||
public void Save (string filter, string initDir, string defaultName, object jsCallback)
|
||||
{
|
||||
IWin32Window owner = GetActiveWindowOwner ();
|
||||
Thread t = new Thread (() => {
|
||||
string result = string.Empty;
|
||||
try
|
||||
{
|
||||
using (SaveFileDialog dlg = new SaveFileDialog ())
|
||||
{
|
||||
dlg.Filter = filter;
|
||||
dlg.InitialDirectory = string.IsNullOrEmpty (initDir)
|
||||
? Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments)
|
||||
: initDir;
|
||||
if (!string.IsNullOrEmpty (defaultName))
|
||||
dlg.FileName = defaultName;
|
||||
dlg.OverwritePrompt = true;
|
||||
dlg.AddExtension = true;
|
||||
if (dlg.ShowDialog (owner) == DialogResult.OK)
|
||||
result = dlg.FileName;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
CallJS (jsCallback, result);
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.SetApartmentState (ApartmentState.STA);
|
||||
t.Start ();
|
||||
}
|
||||
public _I_Folder Folders => new _I_Folder ();
|
||||
}
|
||||
// Small shell helpers that P/Invoke for folder retrieval using CSIDL or Known Folder GUIDs
|
||||
internal static class ShellHelpers
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Reader
|
||||
}
|
||||
catch { }
|
||||
InitSize ();
|
||||
Text = Bridge.ResXmlStore.StringRes.Get ("MANAGER_APPTITLE");
|
||||
Text = Bridge.ResXmlStore.StringRes.Get ("READER_APPTITLE");
|
||||
this.Load += Form_Load;
|
||||
}
|
||||
private void InitSize ()
|
||||
|
||||
@@ -1221,6 +1221,124 @@ void PackageReaderFreeString (LPWSTR lpStrFromThisDll)
|
||||
free (lpStrFromThisDll);
|
||||
}
|
||||
|
||||
HLIST_PVOID GetAppxBundleAllResourcePackageFileNames (_In_ HPKGREAD hReader)
|
||||
{
|
||||
auto ptr = ToPtrPackage (hReader);
|
||||
if (!ptr) return nullptr;
|
||||
if (ptr->type () == PackageType::bundle)
|
||||
{
|
||||
auto br = ptr->bundle_reader ();
|
||||
std::vector <appx_info::appx_iditem> rpi;
|
||||
br.package_id_items ().resource_packages (rpi);
|
||||
auto buf = (HLIST_PVOID)malloc (sizeof (LIST_PVOID) + sizeof (LPWSTR) * rpi.size ());
|
||||
buf->dwSize = rpi.size ();
|
||||
for (size_t i = 0; i < rpi.size (); i ++)
|
||||
{
|
||||
auto &it = rpi [i];
|
||||
buf->alpVoid [i] = _wcsdup (it.file_name ().c_str ());
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
HLIST_PVOID GetAppxBundleAllLocaleResourcePackageFileNames (_In_ HPKGREAD hReader)
|
||||
{
|
||||
auto ptr = ToPtrPackage (hReader);
|
||||
if (!ptr) return nullptr;
|
||||
if (ptr->type () == PackageType::bundle)
|
||||
{
|
||||
auto br = ptr->bundle_reader ();
|
||||
std::vector <appx_info::appx_iditem> rpi;
|
||||
br.package_id_items ().resource_packages (rpi);
|
||||
std::vector <std::wstring> localePkgNames;
|
||||
for (size_t i = 0; i < rpi.size (); i ++)
|
||||
{
|
||||
auto &it = rpi [i];
|
||||
auto qres = it.qualified_resources ();
|
||||
std::vector <std::wstring> langs;
|
||||
std::vector <UINT32> temp;
|
||||
std::vector <DX_FEATURE_LEVEL> dxt;
|
||||
qres.qualified_resources (&langs, &temp, &dxt);
|
||||
if (temp.size () > 0 || dxt.size () > 0) continue;
|
||||
localePkgNames.push_back (it.file_name ());
|
||||
}
|
||||
auto buf = (HLIST_PVOID)malloc (sizeof (LIST_PVOID) + sizeof (LPWSTR) * localePkgNames.size ());
|
||||
buf->dwSize = localePkgNames.size ();
|
||||
for (size_t i = 0; i < localePkgNames.size (); i ++)
|
||||
{
|
||||
buf->alpVoid [i] = _wcsdup (localePkgNames [i].c_str ());
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
HLIST_PVOID GetAppxBundleAllFileResourcePackageFileNames (_In_ HPKGREAD hReader)
|
||||
{
|
||||
auto ptr = ToPtrPackage (hReader);
|
||||
if (!ptr) return nullptr;
|
||||
if (ptr->type () == PackageType::bundle)
|
||||
{
|
||||
auto br = ptr->bundle_reader ();
|
||||
std::vector <appx_info::appx_iditem> rpi;
|
||||
br.package_id_items ().resource_packages (rpi);
|
||||
std::vector <std::wstring> filePkgNames;
|
||||
for (size_t i = 0; i < rpi.size (); i ++)
|
||||
{
|
||||
auto &it = rpi [i];
|
||||
auto qres = it.qualified_resources ();
|
||||
std::vector <std::wstring> langs;
|
||||
std::vector <UINT32> temp;
|
||||
std::vector <DX_FEATURE_LEVEL> dxt;
|
||||
qres.qualified_resources (&langs, &temp, &dxt);
|
||||
if (temp.size () > 0)
|
||||
filePkgNames.push_back (it.file_name ());
|
||||
}
|
||||
auto buf = (HLIST_PVOID)malloc (sizeof (LIST_PVOID) + sizeof (LPWSTR) * filePkgNames.size ());
|
||||
buf->dwSize = filePkgNames.size ();
|
||||
for (size_t i = 0; i < filePkgNames.size (); i ++)
|
||||
{
|
||||
buf->alpVoid [i] = _wcsdup (filePkgNames [i].c_str ());
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void FreeAppxBundlePayloadsFileNameList (_In_ HLIST_PVOID hStringList)
|
||||
{
|
||||
if (!hStringList) return;
|
||||
for (size_t i = 0; i < hStringList->dwSize; i ++)
|
||||
{
|
||||
auto ptr = hStringList->alpVoid [i];
|
||||
if (!ptr) continue;
|
||||
free (ptr);
|
||||
}
|
||||
free (hStringList);
|
||||
}
|
||||
void UpdatePackageApplicationItemGetName (_In_ LPCWSTR *lpNames, _In_ DWORD dwArrLen)
|
||||
{
|
||||
bool clearAll = !lpNames || !dwArrLen;
|
||||
if (clearAll)
|
||||
{
|
||||
appitems.clear ();
|
||||
return;
|
||||
}
|
||||
appitems.clear ();
|
||||
for (size_t i = 0; i < dwArrLen; i ++)
|
||||
{
|
||||
auto ptr = lpNames [i];
|
||||
if (strnull (ptr)) continue;
|
||||
push_unique (appitems, std::wstring (ptr));
|
||||
}
|
||||
}
|
||||
void GetPackageApplicationItemGetNameList (_In_ ITER_WSTRING_CALLBACK pfCallback)
|
||||
{
|
||||
if (!pfCallback) return;
|
||||
for (auto &it : appitems)
|
||||
{
|
||||
pfCallback (it.c_str ());
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 以下是对清单文件的读取 ==========
|
||||
#define ToHandleMRead(_cpp_ptr_) reinterpret_cast <HPKGMANIFESTREAD> (_cpp_ptr_)
|
||||
#define ToPtrManifest(_cpp_ptr_) reinterpret_cast <manifest *> (_cpp_ptr_)
|
||||
|
||||
@@ -290,6 +290,16 @@ extern "C"
|
||||
// 其实通过 free 释放即可,但考虑到环境问题,那么另写了个函数
|
||||
PKGREAD_API void PackageReaderFreeString (LPWSTR lpStrFromThisDll);
|
||||
|
||||
PKGREAD_API HLIST_PVOID GetAppxBundleAllResourcePackageFileNames (_In_ HPKGREAD hReader);
|
||||
|
||||
PKGREAD_API HLIST_PVOID GetAppxBundleAllLocaleResourcePackageFileNames (_In_ HPKGREAD hReader);
|
||||
|
||||
PKGREAD_API HLIST_PVOID GetAppxBundleAllFileResourcePackageFileNames (_In_ HPKGREAD hReader);
|
||||
PKGREAD_API void FreeAppxBundlePayloadsFileNameList (_In_ HLIST_PVOID hStringList);
|
||||
|
||||
PKGREAD_API void UpdatePackageApplicationItemGetName (_In_ LPCWSTR *lpNames, _In_ DWORD dwArrLen);
|
||||
typedef void (*ITER_WSTRING_CALLBACK) (LPCWSTR lpString);
|
||||
PKGREAD_API void GetPackageApplicationItemGetNameList (_In_ ITER_WSTRING_CALLBACK pfCallback);
|
||||
// ========= 以下是针对于应用清单的读取器,一些常量和类型等是复用的 =========
|
||||
|
||||
TEMPLATE_STRUCT (PKGMANIFESTREAD);
|
||||
|
||||
@@ -1055,6 +1055,10 @@ size_t GetPriScaleAndTargetSizeFileList (
|
||||
auto value = quali->Value;
|
||||
qualis->Add (type, value);
|
||||
}
|
||||
if (qualis->Count == 0 && tasktype == 1)
|
||||
{
|
||||
qualis->Add (QualifierType::Scale, 100);
|
||||
}
|
||||
if (qualis->ContainsKey (QualifierType::Language))
|
||||
{
|
||||
resc = PRI_MAKE_STRING (LocaleCodeToLcidW (MPStringToStdW (qualis [QualifierType::Language]->ToString ())));
|
||||
|
||||
BIN
reslib/reslib.rc
BIN
reslib/reslib.rc
Binary file not shown.
Binary file not shown.
@@ -24,6 +24,18 @@
|
||||
BackgroundColor="#159d9d" DarkModeBackgroundColor='#2e1e5c' />
|
||||
</VisualElements>
|
||||
</Application>
|
||||
<Application Id='Reader'>
|
||||
<VisualElements
|
||||
DisplayName='Package Manager'
|
||||
Logo='Settings.Assets\Logo.png'
|
||||
SmallLogo='Settings.Assets\SmallLogo.png'
|
||||
ForegroundText='light'
|
||||
BackgroundColor='#004fe2'>
|
||||
<DefaultTile ShowName='allLogos' />
|
||||
<SplashScreen Image="VisualElements\splash\manager\splash.png"
|
||||
BackgroundColor="#004fe2" DarkModeBackgroundColor='#002770' />
|
||||
</VisualElements>
|
||||
</Application>
|
||||
<Application Id='Settings'>
|
||||
<VisualElements
|
||||
DisplayName='Settings'
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
<script type="text/javascript" src="js/pages.js"></script>
|
||||
<script type="text/javascript" src="js/load.js"></script>
|
||||
<script type="text/javascript" src="js/init.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="theme/light/default/default.css" id="theme-style">
|
||||
|
||||
@@ -216,3 +216,317 @@
|
||||
};
|
||||
}
|
||||
})(this);
|
||||
(function(global) {
|
||||
if (typeof global.Map === "undefined") {
|
||||
function Map() {
|
||||
this.elements = new Array();
|
||||
// 获取Map元素个数
|
||||
this.size = function() {
|
||||
return this.elements.length;
|
||||
},
|
||||
// 判断Map是否为空
|
||||
this.isEmpty = function() {
|
||||
return (this.elements.length < 1);
|
||||
},
|
||||
// 删除Map所有元素
|
||||
this.clear = function() {
|
||||
this.elements = new Array();
|
||||
},
|
||||
// 向Map中增加元素(key, value)
|
||||
this.put = function(_key, _value) {
|
||||
if (this.containsKey(_key) == true) {
|
||||
if (this.containsValue(_value)) {
|
||||
if (this.remove(_key) == true) {
|
||||
this.elements.push({
|
||||
key: _key,
|
||||
value: _value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.elements.push({
|
||||
key: _key,
|
||||
value: _value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.elements.push({
|
||||
key: _key,
|
||||
value: _value
|
||||
});
|
||||
}
|
||||
},
|
||||
// 向Map中增加元素(key, value)
|
||||
this.set = function(_key, _value) {
|
||||
if (this.containsKey(_key) == true) {
|
||||
if (this.containsValue(_value)) {
|
||||
if (this.remove(_key) == true) {
|
||||
this.elements.push({
|
||||
key: _key,
|
||||
value: _value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.elements.push({
|
||||
key: _key,
|
||||
value: _value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.elements.push({
|
||||
key: _key,
|
||||
value: _value
|
||||
});
|
||||
}
|
||||
},
|
||||
// 删除指定key的元素,成功返回true,失败返回false
|
||||
this.remove = function(_key) {
|
||||
var bln = false;
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].key == _key) {
|
||||
this.elements.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bln = false;
|
||||
}
|
||||
return bln;
|
||||
},
|
||||
|
||||
// 删除指定key的元素,成功返回true,失败返回false
|
||||
this.delete = function(_key) {
|
||||
var bln = false;
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].key == _key) {
|
||||
this.elements.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bln = false;
|
||||
}
|
||||
return bln;
|
||||
},
|
||||
|
||||
// 获取指定key的元素值value,失败返回null
|
||||
this.get = function(_key) {
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].key == _key) {
|
||||
return this.elements[i].value;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
// set指定key的元素值value
|
||||
this.setValue = function(_key, _value) {
|
||||
var bln = false;
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].key == _key) {
|
||||
this.elements[i].value = _value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bln = false;
|
||||
}
|
||||
return bln;
|
||||
},
|
||||
|
||||
// 获取指定索引的元素(使用element.key,element.value获取key和value),失败返回null
|
||||
this.element = function(_index) {
|
||||
if (_index < 0 || _index >= this.elements.length) {
|
||||
return null;
|
||||
}
|
||||
return this.elements[_index];
|
||||
},
|
||||
|
||||
// 判断Map中是否含有指定key的元素
|
||||
this.containsKey = function(_key) {
|
||||
var bln = false;
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].key == _key) {
|
||||
bln = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bln = false;
|
||||
}
|
||||
return bln;
|
||||
},
|
||||
|
||||
// 判断Map中是否含有指定key的元素
|
||||
this.has = function(_key) {
|
||||
var bln = false;
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].key == _key) {
|
||||
bln = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bln = false;
|
||||
}
|
||||
return bln;
|
||||
},
|
||||
|
||||
// 判断Map中是否含有指定value的元素
|
||||
this.containsValue = function(_value) {
|
||||
var bln = false;
|
||||
try {
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
if (this.elements[i].value == _value) {
|
||||
bln = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
bln = false;
|
||||
}
|
||||
return bln;
|
||||
},
|
||||
|
||||
// 获取Map中所有key的数组(array)
|
||||
this.keys = function() {
|
||||
var arr = new Array();
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
arr.push(this.elements[i].key);
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
|
||||
// 获取Map中所有value的数组(array)
|
||||
this.values = function() {
|
||||
var arr = new Array();
|
||||
for (i = 0; i < this.elements.length; i++) {
|
||||
arr.push(this.elements[i].value);
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
|
||||
/**
|
||||
* map遍历数组
|
||||
* @param callback [function] 回调函数;
|
||||
* @param context [object] 上下文;
|
||||
*/
|
||||
this.forEach = function forEach(callback, context) {
|
||||
context = context || window;
|
||||
|
||||
//IE6-8下自己编写回调函数执行的逻辑
|
||||
var newAry = new Array();
|
||||
for (var i = 0; i < this.elements.length; i++) {
|
||||
if (typeof callback === 'function') {
|
||||
var val = callback.call(context, this.elements[i].value, this.elements[i].key, this.elements);
|
||||
newAry.push(this.elements[i].value);
|
||||
}
|
||||
}
|
||||
return newAry;
|
||||
}
|
||||
|
||||
}
|
||||
global.Map = Map;
|
||||
}
|
||||
})(this);
|
||||
(function(global) {
|
||||
if (typeof global.Set === "undefined") {
|
||||
function Set() {
|
||||
var items = {};
|
||||
this.size = 0;
|
||||
// 实现has方法
|
||||
// has(val)方法
|
||||
this.has = function(val) {
|
||||
// 对象都有hasOwnProperty方法,判断是否拥有特定属性
|
||||
return items.hasOwnProperty(val);
|
||||
};
|
||||
|
||||
// 实现add
|
||||
this.add = function(val) {
|
||||
if (!this.has(val)) {
|
||||
items[val] = val;
|
||||
this.size++; // 累加集合成员数量
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// delete(val)方法
|
||||
this.delete = function(val) {
|
||||
if (this.has(val)) {
|
||||
delete items[val]; // 将items对象上的属性删掉
|
||||
this.size--;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
// clear方法
|
||||
this.clear = function() {
|
||||
items = {}; // 直接将集合赋一个空对象即可
|
||||
this.size = 0;
|
||||
};
|
||||
|
||||
// keys()方法
|
||||
this.keys = function() {
|
||||
return Object.keys(items); // 返回遍历集合的所有键名的数组
|
||||
};
|
||||
// values()方法
|
||||
this.values = function() {
|
||||
return Object.values(items); // 返回遍历集合的所有键值的数组
|
||||
};
|
||||
|
||||
// forEach(fn, context)方法
|
||||
this.forEach = function(fn, context) {
|
||||
for (var i = 0; i < this.size; i++) {
|
||||
var item = Object.keys(items)[i];
|
||||
fn.call(context, item, item, items);
|
||||
}
|
||||
};
|
||||
|
||||
// 并集
|
||||
this.union = function(other) {
|
||||
var union = new Set();
|
||||
var values = this.values();
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
union.add(values[i]);
|
||||
}
|
||||
values = other.values(); // 将values重新赋值为新的集合
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
union.add(values[i]);
|
||||
}
|
||||
|
||||
return union;
|
||||
};
|
||||
// 交集
|
||||
this.intersect = function(other) {
|
||||
var intersect = new Set();
|
||||
var values = this.values();
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
if (other.has(values[i])) { // 查看是否也存在于other中
|
||||
intersect.add(values[i]); // 存在的话就像intersect中添加元素
|
||||
}
|
||||
}
|
||||
return intersect;
|
||||
};
|
||||
|
||||
// 差集
|
||||
this.difference = function(other) {
|
||||
var difference = new Set();
|
||||
var values = this.values();
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
if (!other.has(values[i])) { // 将不存在于other集合中的添加到新的集合中
|
||||
difference.add(values[i]);
|
||||
}
|
||||
}
|
||||
return difference;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
global.Set = Set;
|
||||
}
|
||||
})(this);
|
||||
@@ -1,110 +0,0 @@
|
||||
.win-contentdialog {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
transition: all 0.15s linear;
|
||||
opacity: 1;
|
||||
z-index: 100;
|
||||
}
|
||||
.win-contentdialog.hide {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
.win-contentdialog .win-contentdialog-dialog {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 20px 0;
|
||||
background-color: rgb(31, 0, 104);
|
||||
transition: all 0.5s cubic-bezier(0.1, 0.9, 0.2, 1);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-title {
|
||||
font-size: 20pt;
|
||||
font-weight: normal;
|
||||
padding: 0 172px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content {
|
||||
padding: 0 172px;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
max-height: calc(100vh - 200px);
|
||||
margin: 10px 0 20px 0;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-commands {
|
||||
padding: 0 172px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-commands > button {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content p {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dt,
|
||||
.win-contentdialog .win-contentdialog-content dl dd {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
box-sizing: border-box;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dt {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
text-align: left;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dd {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dd * {
|
||||
max-width: 100%;
|
||||
}
|
||||
.win-contentdialog-dialog-template {
|
||||
display: none;
|
||||
}
|
||||
.win-contentdialog .win-contentdialog-content .win-contentdialog-dialog-template {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.win-ui-light .win-contentdialog .win-contentdialog-dialog,
|
||||
.win-contentdialog.win-ui-light .win-contentdialog-dialog {
|
||||
background-color: white;
|
||||
}
|
||||
.win-ui-dark .win-contentdialog .win-contentdialog-dialog,
|
||||
.win-contentdialog.win-ui-dark .win-contentdialog-dialog {
|
||||
background-color: rgb(31, 0, 104);
|
||||
}
|
||||
117
shared/html/libs/msgbox/contentdlg.css
Normal file
117
shared/html/libs/msgbox/contentdlg.css
Normal file
@@ -0,0 +1,117 @@
|
||||
.win-contentdialog {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
transition: all 0.15s linear;
|
||||
opacity: 1;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.win-contentdialog.hide {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-dialog {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 20px 0;
|
||||
background-color: rgb(31, 0, 104);
|
||||
/*transition: all 0.5s cubic-bezier(0.1, 0.9, 0.2, 1);*/
|
||||
transition: height, max-height, min-height 0.5s cubic-bezier(0.1, 0.9, 0.2, 1);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-title {
|
||||
font-size: 20pt;
|
||||
font-weight: normal;
|
||||
padding: 0 172px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content {
|
||||
padding: 0 172px;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
max-height: calc(100vh - 200px);
|
||||
margin: 10px 0 20px 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-commands {
|
||||
padding: 0 172px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-commands>button {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content p {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dt,
|
||||
.win-contentdialog .win-contentdialog-content dl dd {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
box-sizing: border-box;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dt {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
text-align: left;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dd {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content dl dd * {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.win-contentdialog-dialog-template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.win-contentdialog .win-contentdialog-content .win-contentdialog-dialog-template {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.win-ui-light .win-contentdialog .win-contentdialog-dialog,
|
||||
.win-contentdialog.win-ui-light .win-contentdialog-dialog {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.win-ui-dark .win-contentdialog .win-contentdialog-dialog,
|
||||
.win-contentdialog.win-ui-dark .win-contentdialog-dialog {
|
||||
background-color: rgb(31, 0, 104);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
(function (global) {
|
||||
"use strict";
|
||||
|
||||
if (typeof global.toStaticHTML === "undefined") global.toStaticHTML = function (str) { return str; };
|
||||
if (typeof global.WinJS === "undefined" || !global.WinJS) global.WinJS = {};
|
||||
if (typeof global.WinJS.UI === "undefined" || !global.WinJS.UI) global.WinJS.UI = {};
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* 表示 ContentDialog 中的一个按钮命令。
|
||||
* @class
|
||||
* @param {string} label 按钮显示文本
|
||||
* @param {function(Event=): (boolean|void)} [handler] 按钮点击处理函数
|
||||
* @param {string} [commandId] 命令唯一标识
|
||||
*/
|
||||
* 表示 ContentDialog 中的一个按钮命令。
|
||||
* @class
|
||||
* @param {string} label 按钮显示文本
|
||||
* @param {function(Event=): (boolean|void)} [handler] 按钮点击处理函数
|
||||
* @param {string} [commandId] 命令唯一标识
|
||||
*/
|
||||
function ContentDialogCommand(label, handler, commandId) {
|
||||
this.label = label;
|
||||
this.handler = handler;
|
||||
@@ -30,16 +30,17 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟 WinRT ContentDialog 的对话框
|
||||
* @class
|
||||
* @memberof WinJS.UI
|
||||
* @param {HTMLElement} element 容器
|
||||
* @param {Object} [options] 初始化选项
|
||||
*/
|
||||
* 模拟 WinRT ContentDialog 的对话框
|
||||
* @class
|
||||
* @memberof WinJS.UI
|
||||
* @param {HTMLElement} element 容器
|
||||
* @param {Object} [options] 初始化选项
|
||||
*/
|
||||
function ContentDialog(element, options) {
|
||||
var container = element;
|
||||
container.innerHTML = toStaticHTML('<div class="win-contentdialog-dialog"><div class="win-contentdialog-title"></div><div class="win-contentdialog-content"></div><div class="win-contentdialog-commands"></div></div>');
|
||||
container.innerHTML = toStaticHTML('<div class="win-contentdialog-dialog notice-body"><div class="win-contentdialog-title notice-title"></div><div class="win-contentdialog-content notice-text"></div><div class="win-contentdialog-commands notice-controls"></div></div>');
|
||||
container.classList.add("win-contentdialog");
|
||||
container.classList.add("notice-back");
|
||||
container.classList.add("hide");
|
||||
|
||||
var title = container.querySelector(".win-contentdialog-title");
|
||||
@@ -62,6 +63,7 @@
|
||||
}
|
||||
self._commands.forEach(function (cmd, index) {
|
||||
var btn = document.createElement("button");
|
||||
btn.classList.add ("notice-btn");
|
||||
btn.textContent = cmd.label;
|
||||
btn.setAttribute("data-command-id", cmd.commandId || index);
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
.notice-back {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: auto;
|
||||
width: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: column;
|
||||
-ms-flex-wrap: nowrap;
|
||||
-ms-flex-line-pack: center;
|
||||
/* align-content: center */
|
||||
-ms-flex-pack: center;
|
||||
/* justify-content: center */
|
||||
transition: all 0.15s linear;
|
||||
opacity: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.notice-body {
|
||||
background: #0078d7;
|
||||
padding: 25px 172px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: auto;
|
||||
bottom: auto;
|
||||
max-height: 80%;
|
||||
height: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: column;
|
||||
-ms-flex-wrap: nowrap;
|
||||
min-height: 0 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.notice-body>h1,
|
||||
.notice-body>h2,
|
||||
.notice-body>h3,
|
||||
.notice-body>h4,
|
||||
.notice-body>h5,
|
||||
.notice-body>h6,
|
||||
.notice-body>p,
|
||||
.notice-body>a,
|
||||
.notice-body>span {
|
||||
font-family: "Microsoft YaHei", "Segoe UI", "Ebrima", "Nirmala", "Gadugi", "Segoe UI Emoji", "Segoe UI Symbol", "Meiryo", "Leelawadee", "Microsoft JhengHei", "Malgun Gothic", "Estrangelo Edessa", "Microsoft Himalaya", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Tai Le", "Microsoft Yi Baiti", "Mongolian Baiti", "MV Boli", "Myanmar Text", "Javanese Text", "Cambria Math";
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
color: white;
|
||||
font-weight: normal;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
color: white;
|
||||
font-weight: normal;
|
||||
white-space: pre-wrap;
|
||||
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||
}
|
||||
|
||||
.notice-controls {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: row;
|
||||
-ms-flex-wrap: nowrap;
|
||||
-ms-flex-line-pack: center;
|
||||
/* align-content: center(几乎无效,保留即可) */
|
||||
-ms-flex-pack: end;
|
||||
/* justify-content: flex-end */
|
||||
-ms-flex-align: center;
|
||||
/* align-items: center */
|
||||
margin-top: 10px;
|
||||
/*gap: 20px;*/
|
||||
}
|
||||
|
||||
.notice-btn {
|
||||
margin-left: 20px;
|
||||
}
|
||||
95
shared/html/libs/msgbox/msgbox.elder.css
Normal file
95
shared/html/libs/msgbox/msgbox.elder.css
Normal file
@@ -0,0 +1,95 @@
|
||||
.notice-back {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: auto;
|
||||
width: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: column;
|
||||
-ms-flex-wrap: nowrap;
|
||||
-ms-flex-line-pack: center;
|
||||
/* align-content: center */
|
||||
-ms-flex-pack: center;
|
||||
/* justify-content: center */
|
||||
transition: all 0.15s linear;
|
||||
opacity: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.notice-body {
|
||||
background: #0078d7;
|
||||
padding: 25px 172px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: auto;
|
||||
bottom: auto;
|
||||
max-height: 80%;
|
||||
height: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: column;
|
||||
-ms-flex-wrap: nowrap;
|
||||
min-height: 0 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.notice-body>h1,
|
||||
.notice-body>h2,
|
||||
.notice-body>h3,
|
||||
.notice-body>h4,
|
||||
.notice-body>h5,
|
||||
.notice-body>h6,
|
||||
.notice-body>p,
|
||||
.notice-body>a,
|
||||
.notice-body>span {
|
||||
font-family: "Microsoft YaHei", "Segoe UI", "Ebrima", "Nirmala", "Gadugi", "Segoe UI Emoji", "Segoe UI Symbol", "Meiryo", "Leelawadee", "Microsoft JhengHei", "Malgun Gothic", "Estrangelo Edessa", "Microsoft Himalaya", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Tai Le", "Microsoft Yi Baiti", "Mongolian Baiti", "MV Boli", "Myanmar Text", "Javanese Text", "Cambria Math";
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
color: white;
|
||||
font-weight: normal;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
color: white;
|
||||
font-weight: normal;
|
||||
white-space: pre-wrap;
|
||||
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||
}
|
||||
|
||||
.notice-controls {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: row;
|
||||
-ms-flex-wrap: nowrap;
|
||||
-ms-flex-line-pack: center;
|
||||
/* align-content: center(几乎无效,保留即可) */
|
||||
-ms-flex-pack: end;
|
||||
/* justify-content: flex-end */
|
||||
-ms-flex-align: center;
|
||||
/* align-items: center */
|
||||
margin-top: 10px;
|
||||
/*gap: 20px;*/
|
||||
}
|
||||
|
||||
.notice-btn {
|
||||
margin-left: 20px;
|
||||
}
|
||||
532
shared/html/libs/msgbox/msgbox.elder.js
Normal file
532
shared/html/libs/msgbox/msgbox.elder.js
Normal file
@@ -0,0 +1,532 @@
|
||||
function IsBlackLabel(text) {
|
||||
if (text === null || text === undefined) return true;
|
||||
var trimmed = String(text).replace(/^\s+|\s+$/g, '');
|
||||
return trimmed === '';
|
||||
}
|
||||
|
||||
var MBFLAGS = {
|
||||
MB_OK: 0x00000000,
|
||||
MB_OKCANCEL: 0x00000001,
|
||||
MB_ABORTRETRYIGNORE: 0x00000002,
|
||||
MB_YESNOCANCEL: 0x00000003,
|
||||
MB_YESNO: 0x00000004,
|
||||
MB_RETRYCANCEL: 0x00000005,
|
||||
MB_CANCELTRYCONTINUE: 0x00000006,
|
||||
MB_HELP: 0x00004000,
|
||||
MB_DEFBUTTON1: 0x00000000,
|
||||
MB_DEFBUTTON2: 0x00000100,
|
||||
MB_DEFBUTTON3: 0x00000200,
|
||||
MB_DEFBUTTON4: 0x00000300,
|
||||
MB_ICONERROR: 0x00000010,
|
||||
MB_ICONWARNING: 0x00000030,
|
||||
MB_ICONINFORMATION: 0x00000040
|
||||
};
|
||||
|
||||
var MBRET = {
|
||||
IDOK: 1,
|
||||
IDCANCEL: 2,
|
||||
IDABORT: 3,
|
||||
IDRETRY: 4,
|
||||
IDIGNORE: 5,
|
||||
IDYES: 6,
|
||||
IDNO: 7,
|
||||
IDCLOSE: 8,
|
||||
IDHELP: 9,
|
||||
IDTRYAGAIN: 10,
|
||||
IDCONTINUE: 11
|
||||
};
|
||||
|
||||
Object.freeze(MBFLAGS);
|
||||
Object.freeze(MBRET);
|
||||
|
||||
(function(global) {
|
||||
try {
|
||||
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);
|
||||
}
|
||||
} catch (e) {}
|
||||
})(this);
|
||||
|
||||
function GetLocaleStringFromResId(resId) { try { return getPublicRes(resId); } catch (e) {} }
|
||||
var msgboxResult = {};
|
||||
|
||||
function MessageBox(_lpText, _lpCaption, _uType, _objColor) {
|
||||
var id = MessageBoxForJS(_lpText, _lpCaption, _uType, _objColor, function(valueReturn) {
|
||||
getRes = valueReturn;
|
||||
msgboxResult[id] = valueReturn;
|
||||
});
|
||||
return id;
|
||||
}
|
||||
|
||||
function GetMessageBoxResult(msgboxId) {
|
||||
var result = msgboxResult[msgboxId];
|
||||
if (result === undefined || result === null) return null;
|
||||
msgboxResult[msgboxId] = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
function ClearAllMessageBoxResults() {
|
||||
msgboxResult = null;
|
||||
msgboxResult = {};
|
||||
}
|
||||
|
||||
// 注意:callback 函数无返回值,传入参数:整数型 按下的按钮值。
|
||||
/*
|
||||
使用示例:
|
||||
MessageBoxForJS("请选择一个按钮", "", MBFLAGS.MB_OKCANCEL, "#0078d7", function(value) {
|
||||
console.log("MessageBoxForJS callback value: " + value);
|
||||
})
|
||||
*/
|
||||
function MessageBoxForJS(_lpText, _lpCaption, _uType, _objColor, _callback) {
|
||||
var msgbox = document.createElement("div");
|
||||
msgbox.classList.add("notice-back");
|
||||
msgbox.classList.add("win-ui-dark");
|
||||
var uniqueId = "msgbox_" + new Date().getTime();
|
||||
msgbox.id = uniqueId;
|
||||
var msgbody = document.createElement("div");
|
||||
msgbody.classList.add("notice-body");
|
||||
if (!IsBlackLabel(_objColor)) {
|
||||
msgbody.style.backgroundColor = _objColor;
|
||||
}
|
||||
msgbox.appendChild(msgbody);
|
||||
var msgcontainter = document.createElement("div");
|
||||
msgcontainter.style.height = "100%";
|
||||
msgcontainter.style.width = "100%";
|
||||
msgcontainter.style.maxHeight = "100%";
|
||||
msgcontainter.style.minHeight = "0px";
|
||||
msgcontainter.style.boxSizing = "border-box";
|
||||
msgbody.appendChild(msgcontainter);
|
||||
var msgcaption = document.createElement("div");
|
||||
msgcontainter.appendChild(msgcaption);
|
||||
msgcontainter.style.display = "flex";
|
||||
msgcontainter.style.flexDirection = "column";
|
||||
var msgcontent = document.createElement("div");
|
||||
msgcontent.style.flex = "1 1 auto";
|
||||
msgcontent.style.marginRight = "3px";
|
||||
msgcontent.style.overflowX = "hidden";
|
||||
msgcontent.style.overflowY = "auto";
|
||||
msgcontent.style.minHeight = "0px";
|
||||
msgcontainter.appendChild(msgcontent);
|
||||
if (_lpCaption instanceof HTMLElement) {
|
||||
msgcaption.appendChild(_lpCaption);
|
||||
msgcaption.classList.add("notice-title");
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpCaption)) {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = _lpCaption;
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
} else {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = "";
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
}
|
||||
}
|
||||
if (_lpText instanceof HTMLElement || _lpText instanceof HTMLDivElement || typeof _lpText !== "string") {
|
||||
try {
|
||||
_lpText.classList.add("notice-text");
|
||||
msgcontent.appendChild(_lpText);
|
||||
} catch (e) {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
var msgctrls = document.createElement("div");
|
||||
msgctrls.classList.add("notice-controls");
|
||||
msgcontainter.appendChild(msgctrls);
|
||||
var cnt = 0;
|
||||
var cbFuncPress = function(valueReturn) {
|
||||
getRes = valueReturn;
|
||||
msgbox.style.opacity = 0;
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(msgbox);
|
||||
}, 500);
|
||||
if (_callback) {
|
||||
_callback(valueReturn);
|
||||
}
|
||||
};
|
||||
var pfCreateButton = function(displayNameResId, valueReturn) {
|
||||
var btn = document.createElement("button");
|
||||
btn.innerHTML = GetLocaleStringFromResId(displayNameResId);
|
||||
btn.classList.add("notice-btn");
|
||||
btn.addEventListener("click", function() {
|
||||
cbFuncPress(valueReturn);
|
||||
});
|
||||
msgctrls.appendChild(btn);
|
||||
};
|
||||
if ((_uType & MBFLAGS.MB_HELP) === MBFLAGS.MB_HELP) {
|
||||
pfCreateButton(808, MBRET.IDHELP);
|
||||
}
|
||||
for (cnt = 0; cnt <= MBFLAGS.MB_RETRYCANCEL; cnt++) {
|
||||
if ((_uType & 0xF) === cnt) {
|
||||
switch (cnt) {
|
||||
case MBFLAGS.MB_OK:
|
||||
{
|
||||
pfCreateButton(800, MBRET.IDOK);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_OKCANCEL:
|
||||
{
|
||||
pfCreateButton(800, MBRET.IDOK);
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_ABORTRETRYIGNORE:
|
||||
{
|
||||
pfCreateButton(802, MBRET.IDABORT);
|
||||
pfCreateButton(803, MBRET.IDRETRY);
|
||||
pfCreateButton(804, MBRET.IDIGNORE);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_YESNOCANCEL:
|
||||
{
|
||||
pfCreateButton(805, MBRET.IDYES);
|
||||
pfCreateButton(806, MBRET.IDNO);
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_YESNO:
|
||||
{
|
||||
pfCreateButton(805, MBRET.IDYES);
|
||||
pfCreateButton(806, MBRET.IDNO);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_RETRYCANCEL:
|
||||
{
|
||||
pfCreateButton(803, MBRET.IDRETRY);
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_CANCELTRYCONTINUE:
|
||||
{
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
pfCreateButton(803, MBRET.IDRETRY);
|
||||
pfCreateButton(810, MBRET.IDCONTINUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var btns = msgctrls.querySelectorAll("button");
|
||||
var defaultBtnCnt = 0;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON1) === MBFLAGS.MB_DEFBUTTON1) defaultBtnCnt = 0;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON2) === MBFLAGS.MB_DEFBUTTON2) defaultBtnCnt = 1;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON3) === MBFLAGS.MB_DEFBUTTON3) defaultBtnCnt = 2;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON4) === MBFLAGS.MB_DEFBUTTON4) defaultBtnCnt = 3;
|
||||
for (cnt = 0; cnt < btns.length; cnt++) {
|
||||
if (cnt === defaultBtnCnt) {
|
||||
btns[cnt].focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.body.appendChild(msgbox);
|
||||
setTimeout(function() {
|
||||
msgbox.style.opacity = 1;
|
||||
}, 1);
|
||||
return msgbox.id;
|
||||
}
|
||||
|
||||
function MsgBoxObj() {
|
||||
this.elementId = "";
|
||||
this.callback = null;
|
||||
this.type = MBFLAGS.MB_OK;
|
||||
this._boundCallback = this._internalCallback.bind(this);
|
||||
this._text = "";
|
||||
this._title = "";
|
||||
this._color = "#0078d7";
|
||||
this.show = function() {
|
||||
this.elementId = MessageBoxForJS(
|
||||
this._text,
|
||||
this._title,
|
||||
this.type,
|
||||
this._color,
|
||||
this._boundCallback
|
||||
);
|
||||
setTimeout(function() {
|
||||
var element = document.getElementById(this.elementId);
|
||||
if (element) {
|
||||
var bodyElement = element.querySelector(".notice-body");
|
||||
if (bodyElement) {
|
||||
bodyElement.style.transition = "all 0.5s linear";
|
||||
}
|
||||
}
|
||||
}.bind(this), 100);
|
||||
}
|
||||
Object.defineProperty(this, "text", {
|
||||
get: function() {
|
||||
return this._text;
|
||||
},
|
||||
set: function(value) {
|
||||
this._text = value;
|
||||
if (this.elementId) {
|
||||
var element = document.getElementById(this.elementId);
|
||||
if (element) {
|
||||
var textElement = element.querySelector(".notice-text");
|
||||
if (textElement) {
|
||||
if (value instanceof HTMLElement) {
|
||||
value.classList.add("notice-text");
|
||||
textElement.parentNode.replaceChild(value, textElement);
|
||||
} else {
|
||||
textElement.innerHTML = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, "title", {
|
||||
get: function() {
|
||||
return this._title;
|
||||
},
|
||||
set: function(value) {
|
||||
this._title = value;
|
||||
if (this.elementId) {
|
||||
var element = document.getElementById(this.elementId);
|
||||
if (element) {
|
||||
var titleElement = element.querySelector(".notice-title");
|
||||
if (titleElement) {
|
||||
titleElement.innerHTML = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, "color", {
|
||||
get: function() {
|
||||
return this._color;
|
||||
},
|
||||
set: function(value) {
|
||||
this._color = value;
|
||||
if (this.elementId) {
|
||||
var element = document.getElementById(this.elementId);
|
||||
if (element) {
|
||||
var bodyElement = element.querySelector(".notice-body");
|
||||
if (bodyElement) {
|
||||
bodyElement.style.backgroundColor = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.getElement = function() {
|
||||
return document.getElementById(this.elementId);
|
||||
};
|
||||
}
|
||||
|
||||
MsgBoxObj.prototype._internalCallback = function(returnValue) {
|
||||
if (typeof this.callback === "function") {
|
||||
this.callback(returnValue);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 异步显示消息框,返回一个 Promise 对象。
|
||||
* @param {string | HTMLElement} swText 内容
|
||||
* @param {string} swTitle 标题
|
||||
* @param {MBFLAGS} uType 标志,使用 MBFLAGS 常量
|
||||
* @param {string} swColor 背景颜色文本。
|
||||
* @returns {Promise}
|
||||
*/
|
||||
function messageBoxAsync(swText, swTitle, uType, swColor, pfCallback) {
|
||||
if (typeof Promise === "undefined") {
|
||||
console.error("Promise is not supported in this environment.");
|
||||
MessageBoxForJS(swText, swTitle, uType, swColor, pfCallback);
|
||||
}
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
MessageBoxForJS(swText, swTitle, uType, swColor, function(valueReturn) {
|
||||
if (resolve) resolve(valueReturn);
|
||||
});
|
||||
} catch (ex) {
|
||||
if (reject) reject(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function MessageBoxButton(swDisplayName, nValueReturn) {
|
||||
this.displayName = swDisplayName;
|
||||
this.value = nValueReturn;
|
||||
}
|
||||
|
||||
function messageBoxAdvance(swText, swCaption, aCommands, swColor, pfCallback) {
|
||||
var _lpText = swText;
|
||||
var _lpCaption = swCaption;
|
||||
var msgbox = document.createElement("div");
|
||||
msgbox.classList.add("notice-back");
|
||||
msgbox.classList.add("win-ui-dark");
|
||||
var uniqueId = "msgbox_" + new Date().getTime();
|
||||
msgbox.id = uniqueId;
|
||||
var msgbody = document.createElement("div");
|
||||
msgbody.classList.add("notice-body");
|
||||
if (!IsBlackLabel(swColor)) {
|
||||
msgbody.style.backgroundColor = swColor;
|
||||
}
|
||||
msgbox.appendChild(msgbody);
|
||||
var msgcontainter = document.createElement("div");
|
||||
msgcontainter.style.height = "100%";
|
||||
msgcontainter.style.width = "100%";
|
||||
msgcontainter.style.maxHeight = "100%";
|
||||
msgcontainter.style.minHeight = "0px";
|
||||
msgcontainter.style.boxSizing = "border-box";
|
||||
msgbody.appendChild(msgcontainter);
|
||||
var msgcaption = document.createElement("div");
|
||||
msgcontainter.appendChild(msgcaption);
|
||||
msgcontainter.style.display = "flex";
|
||||
msgcontainter.style.flexDirection = "column";
|
||||
var msgcontent = document.createElement("div");
|
||||
msgcontent.style.flex = "1 1 auto";
|
||||
msgcontent.style.marginRight = "3px";
|
||||
msgcontent.style.overflowX = "hidden";
|
||||
msgcontent.style.overflowY = "auto";
|
||||
msgcontent.style.minHeight = "0px";
|
||||
msgcontainter.appendChild(msgcontent);
|
||||
if (_lpCaption instanceof HTMLElement) {
|
||||
msgcaption.appendChild(_lpCaption);
|
||||
msgcaption.classList.add("notice-title");
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpCaption)) {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = _lpCaption;
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
} else {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = "";
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
}
|
||||
}
|
||||
if (_lpText instanceof HTMLElement || _lpText instanceof HTMLDivElement || typeof _lpText !== "string") {
|
||||
try {
|
||||
_lpText.classList.add("notice-text");
|
||||
msgcontent.appendChild(_lpText);
|
||||
} catch (e) {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
var msgctrls = document.createElement("div");
|
||||
msgctrls.classList.add("notice-controls");
|
||||
msgcontainter.appendChild(msgctrls);
|
||||
if (aCommands.length <= 0) {
|
||||
aCommands.push(new MessageBoxButton(GetLocaleStringFromResId(800) || "OK", MBRET.IDOK));
|
||||
}
|
||||
for (var i = 0; i < aCommands.length; i++) {
|
||||
var cmd = aCommands[i];
|
||||
var btn = document.createElement("button");
|
||||
btn.textContent = cmd.displayName;
|
||||
btn.setAttribute("data-msgbox-value", cmd.value);
|
||||
Windows.UI.Event.Util.addEvent(btn, "click", function(event) {
|
||||
var btns = this.parentNode.querySelectorAll("button");
|
||||
var lastbtnstatus = [];
|
||||
for (var j = 0; j < btns.length; j++) {
|
||||
lastbtnstatus.push(btns[j].disabled);
|
||||
btns[j].disabled = true;
|
||||
}
|
||||
try {
|
||||
pfCallback(this.getAttribute("data-msgbox-value"));
|
||||
} catch (e) {}
|
||||
msgbox.style.opacity = 0;
|
||||
setTimeout(function(nodes, laststatus) {
|
||||
for (var k = 0; k < nodes.length; k++) {
|
||||
nodes[k].disabled = laststatus[k];
|
||||
}
|
||||
document.body.removeChild(msgbox);
|
||||
}, 500, btns, lastbtnstatus);
|
||||
});
|
||||
msgctrls.appendChild(btn);
|
||||
}
|
||||
document.body.appendChild(msgbox);
|
||||
setTimeout(function() {
|
||||
msgbox.style.opacity = 1;
|
||||
}, 1);
|
||||
return msgbox.id;
|
||||
}
|
||||
|
||||
function messageBoxAdvanceAsync(swText, swCaption, aCommands, swColor) {
|
||||
if (typeof Promise === "undefined") {
|
||||
console.error("Promise is not supported in this environment.");
|
||||
messageBoxAdvance(swText, swCaption, aCommands, swColor);
|
||||
}
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
messageBoxAdvance(swText, swCaption, aCommands, swColor, function(valueReturn) {
|
||||
if (resolve) resolve(valueReturn);
|
||||
});
|
||||
} catch (ex) {
|
||||
if (reject) reject(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -39,6 +39,7 @@ var MBRET = {
|
||||
Object.freeze(MBFLAGS);
|
||||
Object.freeze(MBRET);
|
||||
|
||||
// ==================== 资源加载部分(保持不变) ====================
|
||||
(function(global) {
|
||||
try {
|
||||
var storage = Bridge.External.Storage;
|
||||
@@ -53,15 +54,197 @@ Object.freeze(MBRET);
|
||||
} catch (e) {}
|
||||
})(this);
|
||||
|
||||
function GetLocaleStringFromResId(resId) { try { return getPublicRes(resId); } catch (e) {} }
|
||||
function GetLocaleStringFromResId(resId) {
|
||||
try { return getPublicRes(resId); } catch (e) { return ""; }
|
||||
}
|
||||
|
||||
// ==================== 全局结果存储 ====================
|
||||
var msgboxResult = {};
|
||||
|
||||
function MessageBox(_lpText, _lpCaption, _uType, _objColor) {
|
||||
var id = MessageBoxForJS(_lpText, _lpCaption, _uType, _objColor, function(valueReturn) {
|
||||
getRes = valueReturn;
|
||||
msgboxResult[id] = valueReturn;
|
||||
function ClearAllMessageBoxResults() {
|
||||
msgboxResult = {};
|
||||
}
|
||||
|
||||
// ==================== 辅助函数 ====================
|
||||
var _msgboxIdCounter = 0;
|
||||
|
||||
function _generateMsgBoxId() {
|
||||
return "msgbox_" + new Date().getTime() + "_" + (++_msgboxIdCounter);
|
||||
}
|
||||
|
||||
// 根据 MBFLAGS 生成命令列表(返回 { commands, defaultIndex })
|
||||
function _buildCommandsFromFlags(uType) {
|
||||
var commands = [];
|
||||
var baseType = uType & 0xF;
|
||||
var defaultIndex = 0;
|
||||
var hasHelp = (uType & MBFLAGS.MB_HELP) === MBFLAGS.MB_HELP;
|
||||
|
||||
// 辅助添加命令
|
||||
function addCommand(resId, returnValue) {
|
||||
var label = GetLocaleStringFromResId(resId);
|
||||
if (!label) label = "Button";
|
||||
commands.push({ label: label, value: returnValue });
|
||||
}
|
||||
|
||||
// 先处理帮助按钮(原实现中帮助按钮总是在最前面)
|
||||
if (hasHelp) {
|
||||
addCommand(808, MBRET.IDHELP);
|
||||
}
|
||||
|
||||
// 根据基础类型添加按钮
|
||||
switch (baseType) {
|
||||
case MBFLAGS.MB_OK:
|
||||
addCommand(800, MBRET.IDOK);
|
||||
break;
|
||||
case MBFLAGS.MB_OKCANCEL:
|
||||
addCommand(800, MBRET.IDOK);
|
||||
addCommand(801, MBRET.IDCANCEL);
|
||||
break;
|
||||
case MBFLAGS.MB_ABORTRETRYIGNORE:
|
||||
addCommand(802, MBRET.IDABORT);
|
||||
addCommand(803, MBRET.IDRETRY);
|
||||
addCommand(804, MBRET.IDIGNORE);
|
||||
break;
|
||||
case MBFLAGS.MB_YESNOCANCEL:
|
||||
addCommand(805, MBRET.IDYES);
|
||||
addCommand(806, MBRET.IDNO);
|
||||
addCommand(801, MBRET.IDCANCEL);
|
||||
break;
|
||||
case MBFLAGS.MB_YESNO:
|
||||
addCommand(805, MBRET.IDYES);
|
||||
addCommand(806, MBRET.IDNO);
|
||||
break;
|
||||
case MBFLAGS.MB_RETRYCANCEL:
|
||||
addCommand(803, MBRET.IDRETRY);
|
||||
addCommand(801, MBRET.IDCANCEL);
|
||||
break;
|
||||
case MBFLAGS.MB_CANCELTRYCONTINUE:
|
||||
addCommand(801, MBRET.IDCANCEL);
|
||||
addCommand(803, MBRET.IDRETRY);
|
||||
addCommand(810, MBRET.IDCONTINUE);
|
||||
break;
|
||||
default:
|
||||
addCommand(800, MBRET.IDOK);
|
||||
break;
|
||||
}
|
||||
|
||||
// 确定默认按钮索引(考虑帮助按钮占位)
|
||||
var defFlag = uType & 0x300; // MB_DEFBUTTON1~4
|
||||
var defButtonNumber = 0;
|
||||
if (defFlag === MBFLAGS.MB_DEFBUTTON2) defButtonNumber = 1;
|
||||
else if (defFlag === MBFLAGS.MB_DEFBUTTON3) defButtonNumber = 2;
|
||||
else if (defFlag === MBFLAGS.MB_DEFBUTTON4) defButtonNumber = 3;
|
||||
else defButtonNumber = 0;
|
||||
|
||||
// 默认索引需要加上帮助按钮的偏移
|
||||
var finalDefaultIndex = (hasHelp ? 1 : 0) + defButtonNumber;
|
||||
if (finalDefaultIndex >= commands.length) finalDefaultIndex = commands.length - 1;
|
||||
if (finalDefaultIndex < 0) finalDefaultIndex = 0;
|
||||
|
||||
return { commands: commands, defaultIndex: finalDefaultIndex };
|
||||
}
|
||||
|
||||
// 创建 ContentDialog 并应用公共属性
|
||||
function _createContentDialog(title, content, bgColor, commands, defaultIndex, callback) {
|
||||
var container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
|
||||
var dialog = new WinJS.UI.ContentDialog(container, {
|
||||
//title: typeof title === "string" ? title : "",
|
||||
//content: typeof content === "string" ? content : "",
|
||||
autoShow: false
|
||||
});
|
||||
return id;
|
||||
dialog.title = title;
|
||||
dialog.content = content;
|
||||
// 处理标题为 HTMLElement
|
||||
if (title instanceof HTMLElement) {
|
||||
var titleContainer = container.querySelector(".win-contentdialog-title");
|
||||
if (titleContainer) {
|
||||
while (titleContainer.firstChild) titleContainer.removeChild(titleContainer.firstChild);
|
||||
titleContainer.appendChild(title);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理内容为 HTMLElement
|
||||
if (content instanceof HTMLElement) {
|
||||
var contentContainer = container.querySelector(".win-contentdialog-content");
|
||||
if (contentContainer) {
|
||||
while (contentContainer.firstChild) contentContainer.removeChild(contentContainer.firstChild);
|
||||
contentContainer.appendChild(content);
|
||||
}
|
||||
}
|
||||
|
||||
// 背景色
|
||||
if (!IsBlackLabel(bgColor)) {
|
||||
dialog.backgroundColor = bgColor;
|
||||
}
|
||||
|
||||
// 添加命令
|
||||
for (var i = 0; i < commands.length; i++) {
|
||||
var cmd = commands[i];
|
||||
var dialogCmd = new WinJS.UI.ContentDialogCommand(cmd.label, function(evt) {
|
||||
// 阻止多次点击
|
||||
if (dialog._isClosing) return;
|
||||
dialog._isClosing = true;
|
||||
|
||||
// 调用回调传递返回值
|
||||
if (callback) callback(cmd.value);
|
||||
|
||||
// 关闭并移除对话框
|
||||
dialog.hide().then(function() {
|
||||
try { document.body.removeChild(container); } catch (e) {}
|
||||
dialog._isClosing = false;
|
||||
});
|
||||
|
||||
// 返回 false 会阻止关闭,但我们手动关闭,所以返回 undefined 即可
|
||||
}, cmd.value.toString());
|
||||
dialog.commands.push(dialogCmd);
|
||||
}
|
||||
|
||||
// 设置默认按钮
|
||||
if (defaultIndex >= 0 && defaultIndex < dialog.commands.length) {
|
||||
dialog.primaryCommandIndex = defaultIndex;
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
// ==================== 核心 API 实现 ====================
|
||||
|
||||
// 新版 MessageBoxForJS(完全基于 ContentDialog)
|
||||
function MessageBoxForJS(_lpText, _lpCaption, _uType, _objColor, _callback) {
|
||||
var dialogId = _generateMsgBoxId();
|
||||
var commandsInfo = _buildCommandsFromFlags(_uType);
|
||||
|
||||
var dialog = _createContentDialog(
|
||||
_lpCaption,
|
||||
_lpText,
|
||||
_objColor,
|
||||
commandsInfo.commands,
|
||||
commandsInfo.defaultIndex,
|
||||
function(returnValue) {
|
||||
if (_callback) _callback(returnValue);
|
||||
}
|
||||
);
|
||||
|
||||
// 存储 dialog 引用以便可能的后续操作(如 GetMessageBoxResult 不需要,但保留)
|
||||
if (!window._activeDialogs) window._activeDialogs = {};
|
||||
window._activeDialogs[dialogId] = dialog;
|
||||
dialog.element.id = dialogId;
|
||||
// 显示对话框
|
||||
dialog.show().then(null, function(err) { console.error("ContentDialog show error:", err); });
|
||||
|
||||
return dialogId;
|
||||
}
|
||||
|
||||
// MessageBox:返回 ID,结果通过 GetMessageBoxResult 获取
|
||||
function MessageBox(_lpText, _lpCaption, _uType, _objColor) {
|
||||
var msgboxId = _generateMsgBoxId();
|
||||
MessageBoxForJS(_lpText, _lpCaption, _uType, _objColor, function(valueReturn) {
|
||||
msgboxResult[msgboxId] = valueReturn;
|
||||
if (window._activeDialogs) delete window._activeDialogs[msgboxId];
|
||||
});
|
||||
return msgboxId;
|
||||
}
|
||||
|
||||
function GetMessageBoxResult(msgboxId) {
|
||||
@@ -71,201 +254,84 @@ function GetMessageBoxResult(msgboxId) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function ClearAllMessageBoxResults() {
|
||||
msgboxResult = null;
|
||||
msgboxResult = {};
|
||||
}
|
||||
|
||||
// 注意:callback 函数无返回值,传入参数:整数型 按下的按钮值。
|
||||
/*
|
||||
使用示例:
|
||||
MessageBoxForJS("请选择一个按钮", "", MBFLAGS.MB_OKCANCEL, "#0078d7", function(value) {
|
||||
console.log("MessageBoxForJS callback value: " + value);
|
||||
})
|
||||
*/
|
||||
function MessageBoxForJS(_lpText, _lpCaption, _uType, _objColor, _callback) {
|
||||
var msgbox = document.createElement("div");
|
||||
msgbox.classList.add("notice-back");
|
||||
msgbox.classList.add("win-ui-dark");
|
||||
var uniqueId = "msgbox_" + new Date().getTime();
|
||||
msgbox.id = uniqueId;
|
||||
var msgbody = document.createElement("div");
|
||||
msgbody.classList.add("notice-body");
|
||||
if (!IsBlackLabel(_objColor)) {
|
||||
msgbody.style.backgroundColor = _objColor;
|
||||
// 异步版本(返回 Promise)
|
||||
function messageBoxAsync(swText, swTitle, uType, swColor, pfCallback) {
|
||||
if (typeof Promise === "undefined") {
|
||||
console.error("Promise is not supported in this environment.");
|
||||
MessageBoxForJS(swText, swTitle, uType, swColor, pfCallback);
|
||||
return null;
|
||||
}
|
||||
msgbox.appendChild(msgbody);
|
||||
var msgcontainter = document.createElement("div");
|
||||
msgcontainter.style.height = "100%";
|
||||
msgcontainter.style.width = "100%";
|
||||
msgcontainter.style.maxHeight = "100%";
|
||||
msgcontainter.style.minHeight = "0px";
|
||||
msgcontainter.style.boxSizing = "border-box";
|
||||
msgbody.appendChild(msgcontainter);
|
||||
var msgcaption = document.createElement("div");
|
||||
msgcontainter.appendChild(msgcaption);
|
||||
msgcontainter.style.display = "flex";
|
||||
msgcontainter.style.flexDirection = "column";
|
||||
var msgcontent = document.createElement("div");
|
||||
msgcontent.style.flex = "1 1 auto";
|
||||
msgcontent.style.marginRight = "3px";
|
||||
msgcontent.style.overflowX = "hidden";
|
||||
msgcontent.style.overflowY = "auto";
|
||||
msgcontent.style.minHeight = "0px";
|
||||
msgcontainter.appendChild(msgcontent);
|
||||
if (_lpCaption instanceof HTMLElement) {
|
||||
msgcaption.appendChild(_lpCaption);
|
||||
msgcaption.classList.add("notice-title");
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpCaption)) {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = _lpCaption;
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
} else {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = "";
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
}
|
||||
}
|
||||
if (_lpText instanceof HTMLElement || _lpText instanceof HTMLDivElement || typeof _lpText !== "string") {
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
_lpText.classList.add("notice-text");
|
||||
msgcontent.appendChild(_lpText);
|
||||
} catch (e) {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
MessageBoxForJS(swText, swTitle, uType, swColor, function(valueReturn) {
|
||||
if (pfCallback) pfCallback(valueReturn);
|
||||
resolve(valueReturn);
|
||||
});
|
||||
} catch (ex) {
|
||||
reject(ex);
|
||||
}
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
var msgctrls = document.createElement("div");
|
||||
msgctrls.classList.add("notice-controls");
|
||||
msgcontainter.appendChild(msgctrls);
|
||||
var cnt = 0;
|
||||
var cbFuncPress = function(valueReturn) {
|
||||
getRes = valueReturn;
|
||||
msgbox.style.opacity = 0;
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(msgbox);
|
||||
}, 500);
|
||||
if (_callback) {
|
||||
_callback(valueReturn);
|
||||
}
|
||||
};
|
||||
var pfCreateButton = function(displayNameResId, valueReturn) {
|
||||
var btn = document.createElement("button");
|
||||
btn.innerHTML = GetLocaleStringFromResId(displayNameResId);
|
||||
btn.classList.add("notice-btn");
|
||||
btn.addEventListener("click", function() {
|
||||
cbFuncPress(valueReturn);
|
||||
});
|
||||
msgctrls.appendChild(btn);
|
||||
};
|
||||
if ((_uType & MBFLAGS.MB_HELP) === MBFLAGS.MB_HELP) {
|
||||
pfCreateButton(808, MBRET.IDHELP);
|
||||
}
|
||||
for (cnt = 0; cnt <= MBFLAGS.MB_RETRYCANCEL; cnt++) {
|
||||
if ((_uType & 0xF) === cnt) {
|
||||
switch (cnt) {
|
||||
case MBFLAGS.MB_OK:
|
||||
{
|
||||
pfCreateButton(800, MBRET.IDOK);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_OKCANCEL:
|
||||
{
|
||||
pfCreateButton(800, MBRET.IDOK);
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_ABORTRETRYIGNORE:
|
||||
{
|
||||
pfCreateButton(802, MBRET.IDABORT);
|
||||
pfCreateButton(803, MBRET.IDRETRY);
|
||||
pfCreateButton(804, MBRET.IDIGNORE);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_YESNOCANCEL:
|
||||
{
|
||||
pfCreateButton(805, MBRET.IDYES);
|
||||
pfCreateButton(806, MBRET.IDNO);
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_YESNO:
|
||||
{
|
||||
pfCreateButton(805, MBRET.IDYES);
|
||||
pfCreateButton(806, MBRET.IDNO);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_RETRYCANCEL:
|
||||
{
|
||||
pfCreateButton(803, MBRET.IDRETRY);
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
}
|
||||
break;
|
||||
case MBFLAGS.MB_CANCELTRYCONTINUE:
|
||||
{
|
||||
pfCreateButton(801, MBRET.IDCANCEL);
|
||||
pfCreateButton(803, MBRET.IDRETRY);
|
||||
pfCreateButton(810, MBRET.IDCONTINUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var btns = msgctrls.querySelectorAll("button");
|
||||
var defaultBtnCnt = 0;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON1) === MBFLAGS.MB_DEFBUTTON1) defaultBtnCnt = 0;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON2) === MBFLAGS.MB_DEFBUTTON2) defaultBtnCnt = 1;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON3) === MBFLAGS.MB_DEFBUTTON3) defaultBtnCnt = 2;
|
||||
if ((_uType & MBFLAGS.MB_DEFBUTTON4) === MBFLAGS.MB_DEFBUTTON4) defaultBtnCnt = 3;
|
||||
for (cnt = 0; cnt < btns.length; cnt++) {
|
||||
if (cnt === defaultBtnCnt) {
|
||||
btns[cnt].focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.body.appendChild(msgbox);
|
||||
setTimeout(function() {
|
||||
msgbox.style.opacity = 1;
|
||||
}, 1);
|
||||
return msgbox.id;
|
||||
});
|
||||
}
|
||||
|
||||
// MessageBoxButton 类(保持不变)
|
||||
function MessageBoxButton(swDisplayName, nValueReturn) {
|
||||
this.displayName = swDisplayName;
|
||||
this.value = nValueReturn;
|
||||
}
|
||||
|
||||
// 高级自定义按钮对话框
|
||||
function messageBoxAdvance(swText, swCaption, aCommands, swColor, pfCallback) {
|
||||
var dialogId = _generateMsgBoxId();
|
||||
|
||||
// 转换 aCommands 为内部格式
|
||||
var commands = [];
|
||||
for (var i = 0; i < aCommands.length; i++) {
|
||||
var cmd = aCommands[i];
|
||||
commands.push({
|
||||
label: cmd.displayName,
|
||||
value: cmd.value
|
||||
});
|
||||
}
|
||||
if (commands.length === 0) {
|
||||
commands.push({ label: GetLocaleStringFromResId(800) || "OK", value: MBRET.IDOK });
|
||||
}
|
||||
|
||||
var dialog = _createContentDialog(
|
||||
swCaption,
|
||||
swText,
|
||||
swColor,
|
||||
commands,
|
||||
0, // 默认第一个按钮为默认
|
||||
function(returnValue) {
|
||||
if (pfCallback) pfCallback(returnValue);
|
||||
}
|
||||
);
|
||||
dialog.element.id = dialogId;
|
||||
if (!window._activeDialogs) window._activeDialogs = {};
|
||||
window._activeDialogs[dialogId] = dialog;
|
||||
|
||||
dialog.show();
|
||||
return dialogId;
|
||||
}
|
||||
|
||||
function messageBoxAdvanceAsync(swText, swCaption, aCommands, swColor) {
|
||||
if (typeof Promise === "undefined") {
|
||||
console.error("Promise is not supported in this environment.");
|
||||
messageBoxAdvance(swText, swCaption, aCommands, swColor);
|
||||
return null;
|
||||
}
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
messageBoxAdvance(swText, swCaption, aCommands, swColor, function(valueReturn) {
|
||||
resolve(valueReturn);
|
||||
});
|
||||
} catch (ex) {
|
||||
reject(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ==================== MsgBoxObj 类(保持原接口,内部已适配) ====================
|
||||
function MsgBoxObj() {
|
||||
this.elementId = "";
|
||||
this.callback = null;
|
||||
@@ -274,28 +340,31 @@ function MsgBoxObj() {
|
||||
this._text = "";
|
||||
this._title = "";
|
||||
this._color = "#0078d7";
|
||||
|
||||
this.show = function() {
|
||||
var self = this;
|
||||
this.elementId = MessageBoxForJS(
|
||||
this._text,
|
||||
this._title,
|
||||
this.type,
|
||||
this._color,
|
||||
this._boundCallback
|
||||
function(valueReturn) {
|
||||
self._boundCallback(valueReturn);
|
||||
}
|
||||
);
|
||||
setTimeout(function() {
|
||||
var element = document.getElementById(this.elementId);
|
||||
var element = document.getElementById(self.elementId);
|
||||
if (element) {
|
||||
var bodyElement = element.querySelector(".notice-body");
|
||||
if (bodyElement) {
|
||||
bodyElement.style.transition = "all 0.5s linear";
|
||||
}
|
||||
}
|
||||
}.bind(this), 100);
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
Object.defineProperty(this, "text", {
|
||||
get: function() {
|
||||
return this._text;
|
||||
},
|
||||
get: function() { return this._text; },
|
||||
set: function(value) {
|
||||
this._text = value;
|
||||
if (this.elementId) {
|
||||
@@ -314,10 +383,9 @@ function MsgBoxObj() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "title", {
|
||||
get: function() {
|
||||
return this._title;
|
||||
},
|
||||
get: function() { return this._title; },
|
||||
set: function(value) {
|
||||
this._title = value;
|
||||
if (this.elementId) {
|
||||
@@ -331,10 +399,9 @@ function MsgBoxObj() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "color", {
|
||||
get: function() {
|
||||
return this._color;
|
||||
},
|
||||
get: function() { return this._color; },
|
||||
set: function(value) {
|
||||
this._color = value;
|
||||
if (this.elementId) {
|
||||
@@ -348,6 +415,7 @@ function MsgBoxObj() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.getElement = function() {
|
||||
return document.getElementById(this.elementId);
|
||||
};
|
||||
@@ -358,175 +426,3 @@ MsgBoxObj.prototype._internalCallback = function(returnValue) {
|
||||
this.callback(returnValue);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 异步显示消息框,返回一个 Promise 对象。
|
||||
* @param {string | HTMLElement} swText 内容
|
||||
* @param {string} swTitle 标题
|
||||
* @param {MBFLAGS} uType 标志,使用 MBFLAGS 常量
|
||||
* @param {string} swColor 背景颜色文本。
|
||||
* @returns {Promise}
|
||||
*/
|
||||
function messageBoxAsync(swText, swTitle, uType, swColor, pfCallback) {
|
||||
if (typeof Promise === "undefined") {
|
||||
console.error("Promise is not supported in this environment.");
|
||||
MessageBoxForJS(swText, swTitle, uType, swColor, pfCallback);
|
||||
}
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
MessageBoxForJS(swText, swTitle, uType, swColor, function(valueReturn) {
|
||||
if (resolve) resolve(valueReturn);
|
||||
});
|
||||
} catch (ex) {
|
||||
if (reject) reject(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function MessageBoxButton(swDisplayName, nValueReturn) {
|
||||
this.displayName = swDisplayName;
|
||||
this.value = nValueReturn;
|
||||
}
|
||||
|
||||
function messageBoxAdvance(swText, swCaption, aCommands, swColor, pfCallback) {
|
||||
var _lpText = swText;
|
||||
var _lpCaption = swCaption;
|
||||
var msgbox = document.createElement("div");
|
||||
msgbox.classList.add("notice-back");
|
||||
msgbox.classList.add("win-ui-dark");
|
||||
var uniqueId = "msgbox_" + new Date().getTime();
|
||||
msgbox.id = uniqueId;
|
||||
var msgbody = document.createElement("div");
|
||||
msgbody.classList.add("notice-body");
|
||||
if (!IsBlackLabel(swColor)) {
|
||||
msgbody.style.backgroundColor = swColor;
|
||||
}
|
||||
msgbox.appendChild(msgbody);
|
||||
var msgcontainter = document.createElement("div");
|
||||
msgcontainter.style.height = "100%";
|
||||
msgcontainter.style.width = "100%";
|
||||
msgcontainter.style.maxHeight = "100%";
|
||||
msgcontainter.style.minHeight = "0px";
|
||||
msgcontainter.style.boxSizing = "border-box";
|
||||
msgbody.appendChild(msgcontainter);
|
||||
var msgcaption = document.createElement("div");
|
||||
msgcontainter.appendChild(msgcaption);
|
||||
msgcontainter.style.display = "flex";
|
||||
msgcontainter.style.flexDirection = "column";
|
||||
var msgcontent = document.createElement("div");
|
||||
msgcontent.style.flex = "1 1 auto";
|
||||
msgcontent.style.marginRight = "3px";
|
||||
msgcontent.style.overflowX = "hidden";
|
||||
msgcontent.style.overflowY = "auto";
|
||||
msgcontent.style.minHeight = "0px";
|
||||
msgcontainter.appendChild(msgcontent);
|
||||
if (_lpCaption instanceof HTMLElement) {
|
||||
msgcaption.appendChild(_lpCaption);
|
||||
msgcaption.classList.add("notice-title");
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpCaption)) {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = _lpCaption;
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
} else {
|
||||
var msgtitle = document.createElement("h2");
|
||||
msgtitle.textContent = "";
|
||||
msgtitle.classList.add("notice-title");
|
||||
msgcaption.appendChild(msgtitle);
|
||||
}
|
||||
}
|
||||
if (_lpText instanceof HTMLElement || _lpText instanceof HTMLDivElement || typeof _lpText !== "string") {
|
||||
try {
|
||||
_lpText.classList.add("notice-text");
|
||||
msgcontent.appendChild(_lpText);
|
||||
} catch (e) {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!IsBlackLabel(_lpText)) {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.textContent = _lpText;
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
} else {
|
||||
var msgtext = document.createElement("p");
|
||||
msgtext.innerText = "";
|
||||
msgtext.classList.add("notice-text");
|
||||
if (IsBlackLabel(_lpCaption)) {
|
||||
msgtext.style.marginTop = "0";
|
||||
}
|
||||
msgcontent.appendChild(msgtext);
|
||||
}
|
||||
}
|
||||
var msgctrls = document.createElement("div");
|
||||
msgctrls.classList.add("notice-controls");
|
||||
msgcontainter.appendChild(msgctrls);
|
||||
if (aCommands.length <= 0) {
|
||||
aCommands.push(new MessageBoxButton(GetLocaleStringFromResId(800) || "OK", MBRET.IDOK));
|
||||
}
|
||||
for (var i = 0; i < aCommands.length; i++) {
|
||||
var cmd = aCommands[i];
|
||||
var btn = document.createElement("button");
|
||||
btn.textContent = cmd.displayName;
|
||||
btn.setAttribute("data-msgbox-value", cmd.value);
|
||||
Windows.UI.Event.Util.addEvent(btn, "click", function(event) {
|
||||
var btns = this.parentNode.querySelectorAll("button");
|
||||
var lastbtnstatus = [];
|
||||
for (var j = 0; j < btns.length; j++) {
|
||||
lastbtnstatus.push(btns[j].disabled);
|
||||
btns[j].disabled = true;
|
||||
}
|
||||
try {
|
||||
pfCallback(this.getAttribute("data-msgbox-value"));
|
||||
} catch (e) {}
|
||||
msgbox.style.opacity = 0;
|
||||
setTimeout(function(nodes, laststatus) {
|
||||
for (var k = 0; k < nodes.length; k++) {
|
||||
nodes[k].disabled = laststatus[k];
|
||||
}
|
||||
document.body.removeChild(msgbox);
|
||||
}, 500, btns, lastbtnstatus);
|
||||
});
|
||||
msgctrls.appendChild(btn);
|
||||
}
|
||||
document.body.appendChild(msgbox);
|
||||
setTimeout(function() {
|
||||
msgbox.style.opacity = 1;
|
||||
}, 1);
|
||||
return msgbox.id;
|
||||
}
|
||||
|
||||
function messageBoxAdvanceAsync(swText, swCaption, aCommands, swColor) {
|
||||
if (typeof Promise === "undefined") {
|
||||
console.error("Promise is not supported in this environment.");
|
||||
messageBoxAdvance(swText, swCaption, aCommands, swColor);
|
||||
}
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
messageBoxAdvance(swText, swCaption, aCommands, swColor, function(valueReturn) {
|
||||
if (resolve) resolve(valueReturn);
|
||||
});
|
||||
} catch (ex) {
|
||||
if (reject) reject(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -27,6 +27,8 @@
|
||||
<script type="text/javascript" src="js/event.js"></script>
|
||||
<script type="text/javascript" src="js/tileback.js"></script>
|
||||
<script type="text/javascript" src="js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="js/init.js"></script>
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
<script type="text/javascript" src="js/event.js"></script>
|
||||
<script type="text/javascript" src="js/tileback.js"></script>
|
||||
<script type="text/javascript" src="js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="js/init.js"></script>
|
||||
@@ -60,14 +62,14 @@
|
||||
<div>
|
||||
<label for="read-pkgpath">文件路径</label>
|
||||
<div class="itemrow">
|
||||
<input type="text" id="read-pkgpath">
|
||||
<button id="read-browse" style="margin-left: 5px;">浏览</button>
|
||||
<input type="text" id="read-pkgpath" style="margin-right: 10px;">
|
||||
<button id="read-browse">浏览</button>
|
||||
</div>
|
||||
<script>
|
||||
(function() {
|
||||
var readBrowse = document.getElementById("read-browse");
|
||||
var readPkgpath = document.getElementById("read-pkgpath");
|
||||
var lastDir = "";
|
||||
var lastDir = external.Storage.Folders.desktop;
|
||||
readBrowse.onclick = function() {
|
||||
var explorer = external.Storage.Explorer;
|
||||
explorer.file(
|
||||
@@ -76,6 +78,7 @@
|
||||
function(result) {
|
||||
if (!result) return;
|
||||
readPkgpath.value = result;
|
||||
lastDir = external.Storage.Path.getDir(result);
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -83,44 +86,283 @@
|
||||
</script>
|
||||
</div>
|
||||
<div class="itemrow">
|
||||
<input type="checkbox" id="read-usepri">
|
||||
<input type="checkbox" id="read-usepri" style="margin-left: 0;">
|
||||
<label for="read-usepri">需要解析 PRI 资源文件</label>
|
||||
</div>
|
||||
<button id="read-btn">读取</button>
|
||||
<p>读取结果:</p>
|
||||
<div id="read-result"></div>
|
||||
<style>
|
||||
.part-read-button {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<button id="read-btn" class="part-read-button">读取</button>
|
||||
<button id="read-result-save" class="part-read-button">将读取结果保存为文件</button>
|
||||
<button id="read-result-xml" class="part-read-button">保存为 XML 文件</button>
|
||||
<button id="read-result-json" class="part-read-button">保存为 JSON 文件</button>
|
||||
<br>
|
||||
<progress id="read-loading" style="display: none;"></progress>
|
||||
<p style="margin-bottom: 2px; margin-top: 5px;">读取结果:</p>
|
||||
<iframe id="read-result" width="100%" frameborder="0" src="report.html"></iframe>
|
||||
<script>
|
||||
(function() {
|
||||
function generateHtmlReport(pi) {
|
||||
var pkg = pi.json;
|
||||
if (!pi.valid) {
|
||||
var ret = document.createElement("p");
|
||||
ret.textContent = "错误:无效的包文件";
|
||||
return ret;
|
||||
}
|
||||
var readResult = document.getElementById("read-result");
|
||||
var de = DomEvent;
|
||||
|
||||
function readResultResizeEvent(e) {
|
||||
var parent = readResult.parentElement.parentElement;
|
||||
var newHeight = parent.getBoundingClientRect().height - readResult.getBoundingClientRect().top - 24;
|
||||
//console.log(e, parent.getBoundingClientRect().height, readResult.getBoundingClientRect().top, newHeight);
|
||||
readResult.style.height = parseInt(newHeight) + "px";
|
||||
}
|
||||
var de_rrre = de.Utils.debounce(readResultResizeEvent, 200);
|
||||
de.Monitor.observe(readResult, de.Types.position, de_rrre);
|
||||
de.Monitor.observe(readResult.parentElement.parentElement, de.Types.resize, de_rrre);
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
(function(global) {
|
||||
var readBtn = document.getElementById("read-btn");
|
||||
var readResult = document.getElementById("read-result");
|
||||
var readPkgpath = document.getElementById("read-pkgpath");
|
||||
var readBrowse = document.getElementById("read-browse");
|
||||
var readUsepri = document.getElementById("read-usepri");
|
||||
var readLoading = document.getElementById("read-loading");
|
||||
var readSave = document.getElementById("read-result-save");
|
||||
var readToXml = document.getElementById("read-result-xml");
|
||||
var readToJson = document.getElementById("read-result-json");
|
||||
readResult.style.display = "none";
|
||||
readBtn.onclick = function() {
|
||||
var self = this;
|
||||
self.disabled = true;
|
||||
readResult.style.display = "none";
|
||||
readLoading.style.display = "";
|
||||
readPkgpath.disabled = true;
|
||||
readBrowse.disabled = true;
|
||||
readSave.disabled = true;
|
||||
readToXml.disabled = true;
|
||||
readToJson.disabled = true;
|
||||
readUsepri.disabled = true;
|
||||
|
||||
function onCompleted() {
|
||||
self.disabled = false;
|
||||
readPkgpath.disabled = false;
|
||||
readBrowse.disabled = false;
|
||||
readSave.disabled = false;
|
||||
readToXml.disabled = false;
|
||||
readToJson.disabled = false;
|
||||
readUsepri.disabled = false;
|
||||
}
|
||||
if (!readPkgpath.value) {
|
||||
readResult.textContent = "错误:请选择一个有效文件";
|
||||
readResult.style.display = "";
|
||||
readLoading.style.display = "none";
|
||||
onCompleted();
|
||||
readResult.contentWindow.setReport({
|
||||
status: false,
|
||||
message: "请选择一个有效文件"
|
||||
});
|
||||
self.disabled = false;
|
||||
return;
|
||||
}
|
||||
var pr = Package.reader;
|
||||
|
||||
pr.readFromPackage(readPkgpath.value, readUsepri.checked).then(function(pi) {
|
||||
readResult.textContent = JSON.stringify(pi);
|
||||
readLoading.style.display = "none";
|
||||
readResult.style.display = "";
|
||||
readResult.contentWindow.setReport(pi);
|
||||
}, function(err) {
|
||||
readResult.textContent = JSON.stringify(err);
|
||||
}).done(function() {
|
||||
self.disabled = false;
|
||||
}, function() {
|
||||
self.disabled = false;
|
||||
readLoading.style.display = "none";
|
||||
readResult.style.display = "";
|
||||
readResult.contentWindow.setReport(err);
|
||||
}).done(onCompleted, onCompleted);
|
||||
};
|
||||
readSave.onclick = function() {
|
||||
var container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
var dlg = new WinJS.UI.ContentDialog(container);
|
||||
dlg.content = (function() {
|
||||
var cont = document.createElement("div");
|
||||
var progress = document.createElement("progress");
|
||||
progress.classList.add("win-ring");
|
||||
progress.style.color = "white";
|
||||
var span = document.createElement("span");
|
||||
span.textContent = "正在保存文件";
|
||||
progress.style.marginRight = "10px";
|
||||
cont.setAttribute("style", "display: flex; flex-direction: row; align-items: center; display: -ms-flexbox; -ms-flex-direction: row; -ms-align-items: center;")
|
||||
cont.appendChild(progress);
|
||||
cont.appendChild(span);
|
||||
return cont;
|
||||
})();
|
||||
dlg.commands.splice(0, dlg.commands.length);
|
||||
var lastDir = external.Storage.Folders.desktop;
|
||||
return dlg.show().then(function(id) {
|
||||
return new Promise(function(c, e) {
|
||||
external.Storage.save(
|
||||
"{htmlfile}|*.html;*.htm",
|
||||
lastDir,
|
||||
"report-" + new Date().getTime(),
|
||||
c
|
||||
);
|
||||
});
|
||||
}).then(function(filepath) {
|
||||
if (!filepath) return dlg.hide().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
var file = external.Storage.getFile(filepath);
|
||||
file.content = readResult.contentWindow.getReport();
|
||||
return dlg.hide().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
}).then(null, function(err) {
|
||||
dlg.hide().then(function() {
|
||||
dlg.title = "保存时发生问题";
|
||||
dlg.content = err.message || err;
|
||||
dlg.commands.push(new WinJS.UI.ContentDialogCommand(
|
||||
getPublicRes(800)
|
||||
));
|
||||
return dlg.showAsync().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
})();
|
||||
};
|
||||
readToJson.onclick = function() {
|
||||
var self = this;
|
||||
var container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
var dlg = new WinJS.UI.ContentDialog(container);
|
||||
dlg.content = (function() {
|
||||
var cont = document.createElement("div");
|
||||
var progress = document.createElement("progress");
|
||||
progress.classList.add("win-ring");
|
||||
progress.style.color = "white";
|
||||
var span = document.createElement("span");
|
||||
span.textContent = "正在生成 JSON 文件,请稍候... \n这可能需要比较长的时间。";
|
||||
progress.style.marginRight = "10px";
|
||||
cont.setAttribute("style", "display: flex; flex-direction: row; align-items: center; display: -ms-flexbox; -ms-flex-direction: row; -ms-align-items: center;")
|
||||
cont.appendChild(progress);
|
||||
cont.appendChild(span);
|
||||
return cont;
|
||||
})();
|
||||
dlg.commands.splice(0, dlg.commands.length);
|
||||
var lastDir = external.Storage.Folders.desktop;
|
||||
return dlg.show().then(function(id) {
|
||||
return new Promise(function(c, e) {
|
||||
external.Storage.save(
|
||||
"{jsonzipfile}|*.zip",
|
||||
lastDir,
|
||||
"report-" + new Date().getTime(),
|
||||
c
|
||||
);
|
||||
});
|
||||
}).then(function(filepath) {
|
||||
return new Promise(function(c, e) {
|
||||
if (!readPkgpath.value) {
|
||||
e(new Error("请选择一个有效文件"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var pkg = Package.reader.package(readPkgpath.value);
|
||||
pkg.saveJsonFileAsync(filepath, function() {
|
||||
try {
|
||||
pkg.dispose();
|
||||
} catch (ex) {}
|
||||
c();
|
||||
}, function(ex) {
|
||||
try {
|
||||
pkg.dispose();
|
||||
} catch (ex2) {}
|
||||
e(ex);
|
||||
});
|
||||
} catch (pex) {
|
||||
e(pex);
|
||||
}
|
||||
}).then(function() {
|
||||
return dlg.hide().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
}).then(null, function(err) {
|
||||
dlg.hide().then(function() {
|
||||
dlg.title = "保存时发生问题";
|
||||
dlg.content = err.message || err;
|
||||
dlg.commands.push(new WinJS.UI.ContentDialogCommand(
|
||||
getPublicRes(800)
|
||||
));
|
||||
return dlg.showAsync().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
readToXml.onclick = function() {
|
||||
var self = this;
|
||||
var container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
var dlg = new WinJS.UI.ContentDialog(container);
|
||||
dlg.content = (function() {
|
||||
var cont = document.createElement("div");
|
||||
var progress = document.createElement("progress");
|
||||
progress.classList.add("win-ring");
|
||||
progress.style.color = "white";
|
||||
var span = document.createElement("span");
|
||||
span.textContent = "正在生成 XML 文件,请稍候... \n这可能需要比较长的时间。";
|
||||
progress.style.marginRight = "10px";
|
||||
cont.setAttribute("style", "display: flex; flex-direction: row; align-items: center; display: -ms-flexbox; -ms-flex-direction: row; -ms-align-items: center;")
|
||||
cont.appendChild(progress);
|
||||
cont.appendChild(span);
|
||||
return cont;
|
||||
})();
|
||||
dlg.commands.splice(0, dlg.commands.length);
|
||||
var lastDir = external.Storage.Folders.desktop;
|
||||
return dlg.show().then(function(id) {
|
||||
return new Promise(function(c, e) {
|
||||
external.Storage.save(
|
||||
"{xmlzipfile}|*.zip",
|
||||
lastDir,
|
||||
"report-" + new Date().getTime(),
|
||||
c
|
||||
);
|
||||
});
|
||||
}).then(function(filepath) {
|
||||
return new Promise(function(c, e) {
|
||||
try {
|
||||
if (!readPkgpath.value) {
|
||||
e(new Error("请选择一个有效文件"));
|
||||
return;
|
||||
}
|
||||
var pkg = Package.reader.package(readPkgpath.value);
|
||||
pkg.saveXmlFileAsync(filepath, function() {
|
||||
try {
|
||||
pkg.dispose();
|
||||
} catch (ex) {}
|
||||
c();
|
||||
}, function(ex) {
|
||||
try {
|
||||
pkg.dispose();
|
||||
} catch (ex2) {}
|
||||
e(ex);
|
||||
});
|
||||
} catch (pex) {
|
||||
e(pex);
|
||||
}
|
||||
}).then(function() {
|
||||
return dlg.hide().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
}).then(null, function(err) {
|
||||
dlg.hide().then(function() {
|
||||
dlg.title = "保存时发生问题";
|
||||
dlg.content = err.message || err;
|
||||
dlg.commands.push(new WinJS.UI.ContentDialogCommand(
|
||||
getPublicRes(800)
|
||||
));
|
||||
return dlg.showAsync().then(function() {
|
||||
return dlg.dispose();
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
})(this);
|
||||
</script>
|
||||
</div>
|
||||
</main>
|
||||
@@ -130,7 +372,7 @@
|
||||
<li class="title">
|
||||
<div role="img"></div>
|
||||
<!--<div role="placeholder"></div>-->
|
||||
<span class="win-type-base" data-res-resxml="MANAGER_APPTITLE"></span>
|
||||
<span class="win-type-base" data-res-resxml="READER_APPTITLE"></span>
|
||||
</li>
|
||||
<script>
|
||||
(function($) {
|
||||
@@ -163,7 +405,7 @@
|
||||
var settingpath = external.Storage.Path.combine(external.Storage.Path.root, "settings.exe");
|
||||
//var cmdline = "\"{execfile}\" manager".replace("{execfile}", settingpath);
|
||||
external.Process.runAsync(
|
||||
"manager",
|
||||
"reader",
|
||||
settingpath,
|
||||
1,
|
||||
"",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
.page>aside>nav ul li.selected {
|
||||
background-color: #0059ff;
|
||||
background-color: #004fe2;
|
||||
}
|
||||
|
||||
.page>aside>nav ul li.selected:hover {
|
||||
background-color: #1a52e0;
|
||||
background-color: #295de0;
|
||||
}
|
||||
|
||||
.page>aside>nav ul li.selected:active {
|
||||
background-color: #1a52e0;
|
||||
background-color: #0034b6;
|
||||
}
|
||||
432
shared/html/report.html
Normal file
432
shared/html/report.html
Normal file
@@ -0,0 +1,432 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Package Infomation Report</title>
|
||||
<style id="body-style">
|
||||
body {
|
||||
margin: 0px;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
-ms-user-select: element;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
table {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
margin-bottom: 1rem;
|
||||
background-color: transparent;
|
||||
font-size: 9pt;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 5px;
|
||||
vertical-align: top;
|
||||
border: 1px solid #2d2d2d;
|
||||
}
|
||||
|
||||
tr.head {
|
||||
background-color: rgb(0, 0, 124);
|
||||
color: white;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
tr.spec {
|
||||
background-color: yellow;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p id="msg" style="font-size: 10pt;"></p>
|
||||
<table id="report">
|
||||
<tbody>
|
||||
<tr class="head">
|
||||
<td colspan="2"><strong>Package Infomation Report</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File</td>
|
||||
<td name="file" style="word-break: break-all;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Is Valid</td>
|
||||
<td name="valid"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type</td>
|
||||
<td name="type">Appx</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Role</td>
|
||||
<td name="role">Application Package</td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Identity</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td name="name"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Publisher</td>
|
||||
<td name="publisher"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Package Version</td>
|
||||
<td name="version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Real Version</td>
|
||||
<td name="realver"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Support Processor Architecture</td>
|
||||
<td name="architecture"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Package Family Name</td>
|
||||
<td name="package_family_name"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Package Full Name</td>
|
||||
<td name="package_full_name"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Resource ID</td>
|
||||
<td name="resource_id"></td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Properties</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Display Name</td>
|
||||
<td name="display_name"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Publisher Display Name</td>
|
||||
<td name="publisher_display_name"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td name="description"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Logo</td>
|
||||
<td name="logo" style="background-image: linear-gradient(to right, darkgray, lightgray);"><img src="" id="logo"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Framework</td>
|
||||
<td name="framework"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Resource Package</td>
|
||||
<td name="resource_package"></td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Prerequisites</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OS Min Version</td>
|
||||
<td name="os_min_version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OS Max Version Tested</td>
|
||||
<td name="os_max_version_tested"></td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Applications</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" name="applications">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Capabilities</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Capabilities</td>
|
||||
<td>
|
||||
<ul name="capabilities"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Device Capabilities</td>
|
||||
<td>
|
||||
<ul name="device_capabilities"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Dependencies</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" name="dependencies">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="spec">
|
||||
<td colspan="2">Resources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Languages</td>
|
||||
<td>
|
||||
<ul name="languages"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Scales</td>
|
||||
<td>
|
||||
<ul name="scales"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DirectX Feature Levels</td>
|
||||
<td>
|
||||
<ul name="dx_feature_levels"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
(function(global) {
|
||||
if (typeof Array.prototype.forEach !== "function") {
|
||||
Array.prototype.forEach = function(callback, thisArg) {
|
||||
var T, k;
|
||||
if (this === null) {
|
||||
throw new TypeError(" this is null or not defined");
|
||||
}
|
||||
var O = Object(this);
|
||||
var len = O.length >>> 0;
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(callback + " is not a function");
|
||||
}
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
k = 0;
|
||||
while (k < len) {
|
||||
var kValue;
|
||||
if (k in O) {
|
||||
kValue = O[k];
|
||||
callback.call(T, kValue, k, O);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function formatVersion(v) {
|
||||
return v.major + "." + v.minor + "." + v.build + "." + v.revision;
|
||||
}
|
||||
global.setReport = function(rep) {
|
||||
if (!rep.status) {
|
||||
document.getElementById("msg").textContent = rep.message;
|
||||
document.getElementById("report").style.display = "none";
|
||||
return;
|
||||
}
|
||||
document.getElementById("msg").textContent = "";
|
||||
document.getElementById("report").style.display = "";
|
||||
var pi = rep.json;
|
||||
var t = document.getElementById("report");
|
||||
t.querySelector("[name='file']").textContent = pi.filepath;
|
||||
t.querySelector("[name='valid']").textContent = pi.valid;
|
||||
t.querySelector("[name='type']").textContent = (function(t) {
|
||||
switch (t) {
|
||||
case 1:
|
||||
return "Appx";
|
||||
case 2:
|
||||
return "Bundle";
|
||||
default:
|
||||
case 0:
|
||||
return "Unknown";
|
||||
}
|
||||
})(pi.type);
|
||||
t.querySelector("[name='role']").textContent = (function(r) {
|
||||
switch (r) {
|
||||
case 1:
|
||||
return "Application Package";
|
||||
case 2:
|
||||
return "Framework";
|
||||
case 3:
|
||||
return "Resource Package";
|
||||
default:
|
||||
case 0:
|
||||
return "Unknown";
|
||||
}
|
||||
})(pi.role);
|
||||
t.querySelector("[name='name']").textContent = pi.identity.name;
|
||||
t.querySelector("[name='publisher']").textContent = pi.identity.publisher;
|
||||
t.querySelector("[name='version']").textContent = formatVersion(pi.identity.version);
|
||||
t.querySelector("[name='realver']").textContent = formatVersion(pi.identity.realver);
|
||||
t.querySelector("[name='architecture']").textContent = pi.identity.architecture.map(function(item) {
|
||||
switch (item) {
|
||||
case 0:
|
||||
return "x86";
|
||||
case 5:
|
||||
return "ARM";
|
||||
case 9:
|
||||
return "x64";
|
||||
case 11:
|
||||
return "Neutral";
|
||||
case 12:
|
||||
return "ARM64";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}).join(", ");
|
||||
t.querySelector("[name='package_family_name']").textContent = pi.identity.package_family_name;
|
||||
t.querySelector("[name='package_full_name']").textContent = pi.identity.package_full_name;
|
||||
t.querySelector("[name='resource_id']").textContent = pi.identity.resource_id;
|
||||
t.querySelector("[name='display_name']").textContent = pi.properties.display_name;
|
||||
t.querySelector("[name='publisher_display_name']").textContent = pi.properties.publisher_display_name;
|
||||
t.querySelector("[name='description']").textContent = pi.properties.description;
|
||||
document.getElementById("logo").src = pi.properties.logo_base64;
|
||||
document.getElementById("logo").setAttribute("alt", pi.properties.logo);
|
||||
document.getElementById("logo").setAttribute("title", pi.properties.logo);
|
||||
t.querySelector("[name='framework']").textContent = pi.properties.framework;
|
||||
t.querySelector("[name='resource_package']").textContent = pi.properties.resource_package;
|
||||
t.querySelector("[name='os_min_version']").textContent = formatVersion(pi.prerequisites.os_min_version);
|
||||
t.querySelector("[name='os_min_version']").title = pi.prerequisites.os_min_version_description;
|
||||
t.querySelector("[name='os_max_version_tested']").textContent = formatVersion(pi.prerequisites.os_max_version_tested);
|
||||
t.querySelector("[name='os_max_version_tested']").title = pi.prerequisites.os_max_version_tested_description;
|
||||
var appsRep = t.querySelector("[name='applications']");
|
||||
appsRep.innerHTML = "";
|
||||
(pi.applications || []).forEach(function(t, i) {
|
||||
var sub = document.createElement("table");
|
||||
var tb = document.createElement("tbody");
|
||||
sub.appendChild(tb);
|
||||
var tr = document.createElement("tr");
|
||||
var td = document.createElement("td");
|
||||
tr.classList.add("head");
|
||||
td.colSpan = 2;
|
||||
td.textContent = t.AppUserModelID;
|
||||
tr.appendChild(td);
|
||||
tb.appendChild(tr);
|
||||
var keys = Object.keys(t);
|
||||
keys.forEach(function(key) {
|
||||
if (key == "AppUserModelID") return;
|
||||
if ((key || "").indexOf("_Base64") >= 0) return;
|
||||
var tr = document.createElement("tr");
|
||||
var tdk = document.createElement("td");
|
||||
var tdv = document.createElement("td");
|
||||
tdk.textContent = key;
|
||||
tdv.textContent = t[key];
|
||||
if (typeof t[key + "_Base64"] !== "undefined") {
|
||||
tdv.innerHTML = "";
|
||||
var img = document.createElement("img");
|
||||
img.src = t[key + "_Base64"];
|
||||
img.alt = t[key];
|
||||
img.title = t[key];
|
||||
img.style.maxWidth = "300px";
|
||||
img.style.maxHeight = "300px";
|
||||
img.style.aspectRatio = "auto";
|
||||
if (typeof t["BackgroundColor"] !== "undefined") {
|
||||
tdv.style.backgroundColor = t["BackgroundColor"];
|
||||
}
|
||||
tdv.appendChild(img);
|
||||
}
|
||||
tr.appendChild(tdk);
|
||||
tr.appendChild(tdv);
|
||||
tb.appendChild(tr);
|
||||
});
|
||||
appsRep.appendChild(sub);
|
||||
});
|
||||
var capsRep = t.querySelector("[name='capabilities']");
|
||||
capsRep.innerHTML = "";
|
||||
(pi.capabilities.capabilities_name || []).forEach(function(t) {
|
||||
var li = document.createElement("li");
|
||||
li.textContent = t;
|
||||
capsRep.appendChild(li);
|
||||
});
|
||||
var dcapsRep = t.querySelector("[name='device_capabilities']");
|
||||
dcapsRep.innerHTML = "";
|
||||
(pi.capabilities.device_capabilities || []).forEach(function(t) {
|
||||
var li = document.createElement("li");
|
||||
li.textContent = t;
|
||||
dcapsRep.appendChild(li);
|
||||
});
|
||||
var depsRep = t.querySelector("[name='dependencies']");
|
||||
depsRep.innerHTML = "";
|
||||
(pi.dependencies || []).forEach(function(t) {
|
||||
var sub = document.createElement("table");
|
||||
var tb = document.createElement("tbody");
|
||||
sub.appendChild(tb);
|
||||
var tr = document.createElement("tr");
|
||||
var tdk = document.createElement("td");
|
||||
var tdv = document.createElement("td");
|
||||
tdk.textContent = "Name";
|
||||
tdv.textContent = t.name;
|
||||
tr.appendChild(tdk);
|
||||
tr.appendChild(tdv);
|
||||
tb.appendChild(tr);
|
||||
var tr = document.createElement("tr");
|
||||
var tdk = document.createElement("td");
|
||||
var tdv = document.createElement("td");
|
||||
tdk.textContent = "Publisher";
|
||||
tdv.textContent = t.publisher;
|
||||
tr.appendChild(tdk);
|
||||
tr.appendChild(tdv);
|
||||
tb.appendChild(tr);
|
||||
var tr = document.createElement("tr");
|
||||
var tdk = document.createElement("td");
|
||||
var tdv = document.createElement("td");
|
||||
tdk.textContent = "Min Version";
|
||||
tdv.textContent = formatVersion(t.vermin);
|
||||
tr.appendChild(tdk);
|
||||
tr.appendChild(tdv);
|
||||
tb.appendChild(tr);
|
||||
depsRep.appendChild(sub);
|
||||
});
|
||||
var langsRep = t.querySelector("[name='languages']");
|
||||
langsRep.innerHTML = "";
|
||||
(pi.resources.languages || []).forEach(function(t) {
|
||||
var li = document.createElement("li");
|
||||
li.textContent = t;
|
||||
li.title = external.System.Locale.localeInfoEx(t, 2);
|
||||
langsRep.appendChild(li);
|
||||
});
|
||||
var scalesRep = t.querySelector("[name='scales']");
|
||||
scalesRep.innerHTML = "";
|
||||
(pi.resources.scales || []).forEach(function(t) {
|
||||
var li = document.createElement("li");
|
||||
li.textContent = t;
|
||||
scalesRep.appendChild(li);
|
||||
});
|
||||
var dxflsRep = t.querySelector("[name='dx_feature_levels']");
|
||||
dxflsRep.innerHTML = "";
|
||||
(pi.resources.dx_feature_levels || []).forEach(function(t) {
|
||||
var li = document.createElement("li");
|
||||
li.textContent = (function(d) {
|
||||
switch (d) {
|
||||
case 1:
|
||||
return "9";
|
||||
case 2:
|
||||
return "10";
|
||||
case 4:
|
||||
return "11";
|
||||
case 8:
|
||||
return "12";
|
||||
}
|
||||
})(t);
|
||||
dxflsRep.appendChild(li);
|
||||
});
|
||||
};
|
||||
global.getReport = function() {
|
||||
var bodyStyle = document.getElementById("body-style");
|
||||
var bodyStyleHTML = bodyStyle.innerHTML;
|
||||
bodyStyle.innerHTML = "";
|
||||
var ret = document.documentElement.outerHTML;
|
||||
bodyStyle.innerHTML = bodyStyleHTML;
|
||||
return ret;
|
||||
};
|
||||
})(this);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="js/event.js"></script>
|
||||
<script type="text/javascript" src="js/tileback.js"></script>
|
||||
<script type="text/javascript" src="js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="settings/page.css">
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../js/event.js"></script>
|
||||
<script type="text/javascript" src="../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../js/init.js"></script>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../../js/init.js"></script>
|
||||
|
||||
@@ -22,8 +22,12 @@
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<script type="text/javascript" src="../../js/params.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.elder.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.elder.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/toggle/toggle.css">
|
||||
<script type="text/javascript" src="../../libs/toggle/toggle.js"></script>
|
||||
<script type="text/javascript" src="../../js/init.js"></script>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/toggle/toggle.css">
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../../js/init.js"></script>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/toggle/toggle.css">
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../js/event.js"></script>
|
||||
<script type="text/javascript" src="../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../js/init.js"></script>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/toggle/toggle.css">
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../../js/init.js"></script>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../js/event.js"></script>
|
||||
<script type="text/javascript" src="../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../js/init.js"></script>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/toggle/toggle.css">
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<script type="text/javascript" src="../../js/event.js"></script>
|
||||
<script type="text/javascript" src="../../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../../js/init.js"></script>
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
<script type="text/javascript" src="../js/event.js"></script>
|
||||
<script type="text/javascript" src="../js/tileback.js"></script>
|
||||
<script type="text/javascript" src="../js/load.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/contentdlg.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/contentdlg.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../libs/msgbox/msgbox.css">
|
||||
<script type="text/javascript" src="../libs/msgbox/msgbox.js"></script>
|
||||
<script type="text/javascript" src="../js/init.js"></script>
|
||||
|
||||
@@ -614,4 +614,8 @@
|
||||
<lang name="zh-CN">更新完成</lang>
|
||||
<lang name="en-US">Update Complete.</lang>
|
||||
</resource>
|
||||
<resource id="READER_APPTITLE">
|
||||
<lang name="zh-CN">Package Reader</lang>
|
||||
<lang name="en-US">Package Reader</lang>
|
||||
</resource>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user