diff --git a/GetStoreApp/Extensions/DataType/Constant/ConfigKey.cs b/GetStoreApp/Extensions/DataType/Constant/ConfigKey.cs
index 0b8760f9f..75ea29243 100644
--- a/GetStoreApp/Extensions/DataType/Constant/ConfigKey.cs
+++ b/GetStoreApp/Extensions/DataType/Constant/ConfigKey.cs
@@ -37,6 +37,8 @@ public static class ConfigKey
public const string WebKernelKey = "WebKernel";
+ public const string QueryLinksModeKey = "QueryLinksMode";
+
public const string WindowWidthKey = "WindowWidth";
public const string WindowHeightKey = "WindowHeight";
diff --git a/GetStoreApp/GetStoreAppResource.res b/GetStoreApp/GetStoreAppResource.res
index 35306bd11..4e5f81c28 100644
Binary files a/GetStoreApp/GetStoreAppResource.res and b/GetStoreApp/GetStoreAppResource.res differ
diff --git a/GetStoreApp/Helpers/Controls/Store/HttpParseHelper.cs b/GetStoreApp/Helpers/Controls/Store/HttpParseHelper.cs
index 44e512b32..8693b44ee 100644
--- a/GetStoreApp/Helpers/Controls/Store/HttpParseHelper.cs
+++ b/GetStoreApp/Helpers/Controls/Store/HttpParseHelper.cs
@@ -19,14 +19,14 @@ public static partial class HtmlParseHelper
private static Regex ResultDataListRegex = ResultDataListRegularExpression();
- private static string ParseContent = string.Empty;
+ private static string parseContent = string.Empty;
///
/// 初始化HtmlParseService类时添加HtmlReqeustHelper生成的字符串数据
///
- public static void InitializeParseData(RequestModel HttpRequestData)
+ public static void InitializeParseData(RequestModel httpRequestData)
{
- ParseContent = HttpRequestData.RequestContent;
+ parseContent = httpRequestData.RequestContent;
}
///
@@ -34,16 +34,16 @@ public static void InitializeParseData(RequestModel HttpRequestData)
///
public static string HtmlParseCID()
{
- if (!string.IsNullOrEmpty(ParseContent))
+ if (!string.IsNullOrEmpty(parseContent))
{
- MatchCollection CIDCollection = CIDRegex.Matches(ParseContent);
- if (CIDCollection.Count > 0)
+ MatchCollection cidCollection = CIDRegex.Matches(parseContent);
+ if (cidCollection.Count > 0)
{
- GroupCollection CIDGroups = CIDCollection[0].Groups;
+ GroupCollection cidGroups = cidCollection[0].Groups;
- if (CIDGroups.Count > 0)
+ if (cidGroups.Count > 0)
{
- return CIDGroups[1].Value;
+ return cidGroups[1].Value;
}
}
}
@@ -55,13 +55,13 @@ public static string HtmlParseCID()
///
public static List HtmlParseLinks()
{
- List ResultDataList = new List();
+ List resultDataList = new List();
- if (!string.IsNullOrEmpty(ParseContent))
+ if (!string.IsNullOrEmpty(parseContent))
{
- MatchCollection ResultDataListCollection = ResultDataListRegex.Matches(ParseContent);
+ MatchCollection resultDataListCollection = ResultDataListRegex.Matches(parseContent);
- foreach (Match matchItem in ResultDataListCollection)
+ foreach (Match matchItem in resultDataListCollection)
{
GroupCollection ResultDataListGroups = matchItem.Groups;
@@ -74,11 +74,11 @@ public static List HtmlParseLinks()
queryLinksData.FileSHA1 = ResultDataListGroups[4].Value;
queryLinksData.FileSize = ResultDataListGroups[5].Value;
- ResultDataList.Add(queryLinksData);
+ resultDataList.Add(queryLinksData);
}
}
}
- return ResultDataList;
+ return resultDataList;
}
}
}
diff --git a/GetStoreApp/Helpers/Controls/Store/HttpRequestHelper.cs b/GetStoreApp/Helpers/Controls/Store/HttpRequestHelper.cs
index 8d41a8ca8..7f978b3c2 100644
--- a/GetStoreApp/Helpers/Controls/Store/HttpRequestHelper.cs
+++ b/GetStoreApp/Helpers/Controls/Store/HttpRequestHelper.cs
@@ -1,5 +1,6 @@
using GetStoreApp.Models.Controls.Store;
using GetStoreApp.Services.Root;
+using Microsoft.UI.Xaml.Controls;
using System;
using System.Runtime.InteropServices;
using System.Text;
@@ -46,7 +47,7 @@ public static string GenerateRequestContent(string type, string url, string ring
///
public static async Task HttpRequestAsync(string content)
{
- RequestModel HttpRequestResult = null;
+ RequestModel httpRequestResult = null;
// 添加超时设置(半分钟后停止获取)
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
@@ -124,7 +125,7 @@ public static async Task HttpRequestAsync(string content)
}
finally
{
- HttpRequestResult = new RequestModel
+ httpRequestResult = new RequestModel
{
RequestId = RequestId,
RequestStatusCode = RequestStatusCode,
@@ -134,32 +135,25 @@ public static async Task HttpRequestAsync(string content)
cancellationTokenSource.Dispose();
}
- return HttpRequestResult;
+ return httpRequestResult;
}
///
/// 检查请求后的状态信息
///
- public static int CheckRequestState(RequestModel HttpRequestData)
+ public static InfoBarSeverity CheckRequestState(RequestModel HttpRequestData)
{
// 服务器请求异常,返回状态值3
if (HttpRequestData.RequestId is not 0)
{
- return 3;
+ return InfoBarSeverity.Error;
}
// 服务器请求成功
else
{
// 成功下返回值为成功,否则返回警告
- if (HttpRequestData.RequestContent.Contains("The links were successfully received from the Microsoft Store server.", StringComparison.Ordinal))
- {
- return 1;
- }
- else
- {
- return 2;
- }
+ return HttpRequestData.RequestContent.Contains("The links were successfully received from the Microsoft Store server.", StringComparison.OrdinalIgnoreCase) ? InfoBarSeverity.Success : InfoBarSeverity.Warning;
}
}
}
diff --git a/GetStoreApp/Helpers/Converters/ValueConverterHelper.cs b/GetStoreApp/Helpers/Converters/ValueConverterHelper.cs
index e57361d40..d6eba5888 100644
--- a/GetStoreApp/Helpers/Converters/ValueConverterHelper.cs
+++ b/GetStoreApp/Helpers/Converters/ValueConverterHelper.cs
@@ -41,21 +41,5 @@ public static Visibility BooleanToVisibilityReverseConvert(bool value)
{
return value is false ? Visibility.Visible : Visibility.Collapsed;
}
-
- ///
- /// 空字符串值与显示值转换
- ///
- public static Visibility StringVisibilityConvert(string value)
- {
- return !string.IsNullOrEmpty(value) ? Visibility.Visible : Visibility.Collapsed;
- }
-
- ///
- /// 空字符串值与显示值转换(判断结果相反)
- ///
- public static Visibility StringReverseVisibilityConvert(string value)
- {
- return string.IsNullOrEmpty(value) ? Visibility.Visible : Visibility.Collapsed;
- }
}
}
diff --git a/GetStoreApp/Models/Controls/Store/HistoryModel.cs b/GetStoreApp/Models/Controls/Store/HistoryModel.cs
index 6e05a3995..903bb69d7 100644
--- a/GetStoreApp/Models/Controls/Store/HistoryModel.cs
+++ b/GetStoreApp/Models/Controls/Store/HistoryModel.cs
@@ -18,7 +18,7 @@ public class HistoryModel
public string HistoryKey { get; set; }
///
- /// 查询链接控件:历史记录的应用名称
+ /// 查询链接控件:历史记录的应用名称或类别ID
///
public string HistoryAppName { get; set; }
diff --git a/GetStoreApp/Program.cs b/GetStoreApp/Program.cs
index a026d4eba..8e0ab8683 100644
--- a/GetStoreApp/Program.cs
+++ b/GetStoreApp/Program.cs
@@ -126,6 +126,7 @@ private static async Task InitializeResourcesAsync(bool isDesktopProgram)
{
ResourceService.LocalizeReosurce();
LinkFilterService.InitializeLinkFilterValue();
+ QueryLinksModeService.InitializeQueryLinksMode();
await DownloadOptionsService.InitializeAsync();
}
diff --git a/GetStoreApp/Properties/AssemblyInfo.cs b/GetStoreApp/Properties/AssemblyInfo.cs
index 48a3ec701..6b9a0d04f 100644
--- a/GetStoreApp/Properties/AssemblyInfo.cs
+++ b/GetStoreApp/Properties/AssemblyInfo.cs
@@ -7,11 +7,11 @@
[assembly: AssemblyCompany("高怡飞")]
[assembly: AssemblyCopyright("Copyright ©2022-2024 高怡飞, All Rights Reserved.")]
[assembly: AssemblyDescription("获取商店应用")]
-[assembly: AssemblyFileVersion("3.9.424.0")]
-[assembly: AssemblyInformationalVersion("3.9.424.0")]
+[assembly: AssemblyFileVersion("3.9.426.0")]
+[assembly: AssemblyInformationalVersion("3.9.426.0")]
[assembly: AssemblyProduct("获取商店应用")]
[assembly: AssemblyTitle("获取商店应用")]
-[assembly: AssemblyVersion("3.9.424.0")]
+[assembly: AssemblyVersion("3.9.426.0")]
// 设置程序集对 COM 组件的访问权限
[assembly: ComVisible(false)]
diff --git a/GetStoreApp/Services/Controls/Download/DownloadXmlService.cs b/GetStoreApp/Services/Controls/Download/DownloadXmlService.cs
index 89305aa47..e8d56b77a 100644
--- a/GetStoreApp/Services/Controls/Download/DownloadXmlService.cs
+++ b/GetStoreApp/Services/Controls/Download/DownloadXmlService.cs
@@ -86,7 +86,7 @@ await Task.Run(async () =>
}
catch (Exception e)
{
- LogService.WriteLog(LoggingLevel.Warning, "InitializeWebKernel download record state failed.", e);
+ LogService.WriteLog(LoggingLevel.Warning, "Initialize download record state failed.", e);
return;
}
}
diff --git a/GetStoreApp/Services/Controls/Settings/QueryLinksModeService.cs b/GetStoreApp/Services/Controls/Settings/QueryLinksModeService.cs
new file mode 100644
index 000000000..59cbc42a5
--- /dev/null
+++ b/GetStoreApp/Services/Controls/Settings/QueryLinksModeService.cs
@@ -0,0 +1,78 @@
+using GetStoreApp.Extensions.DataType.Constant;
+using GetStoreApp.Services.Root;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace GetStoreApp.Services.Controls.Settings
+{
+ ///
+ /// 查询链接方式选择设置服务
+ ///
+ public static class QueryLinksModeService
+ {
+ private static string queryLinksModeSettingsKey = ConfigKey.QueryLinksModeKey;
+
+ private static DictionaryEntry defaultQueryLinksMode;
+
+ private static DictionaryEntry _queryLinksMode;
+
+ public static DictionaryEntry QueryLinksMode
+ {
+ get { return _queryLinksMode; }
+
+ private set
+ {
+ if (!Equals(_queryLinksMode, value))
+ {
+ _queryLinksMode = value;
+ PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(nameof(QueryLinksMode)));
+ }
+ }
+ }
+
+ public static List QueryLinksModeList { get; private set; }
+
+ public static event PropertyChangedEventHandler PropertyChanged;
+
+ ///
+ /// 应用在初始化前获取设置存储的查询链接方式选择值
+ ///
+ public static void InitializeQueryLinksMode()
+ {
+ QueryLinksModeList = ResourceService.QueryLinksModeList;
+
+ defaultQueryLinksMode = QueryLinksModeList.Find(item => item.Value.ToString() is "Official");
+
+ QueryLinksMode = GetQueryLinksMode();
+ }
+
+ ///
+ /// 获取设置存储的查询链接方式选择值,如果设置没有存储,使用默认值
+ ///
+ private static DictionaryEntry GetQueryLinksMode()
+ {
+ object queryLinksModeValue = LocalSettingsService.ReadSetting