opencertdir

This commit is contained in:
rmbgame
2021-05-01 03:00:30 +08:00
parent 034dd57973
commit 44e10a2bee
7 changed files with 55 additions and 14 deletions
@@ -70,6 +70,8 @@
<TextBlock FontSize="12" Text="{ReflectionBinding Path=Res.And,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<Button FontSize="12" Classes="Hyperlink" Margin="5,0" Content="{ReflectionBinding Path=Res.User_Privacy,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{ReflectionBinding OpenHyperlink}" CommandParameter="https://steampp.net/PrivacyBox"/>
</WrapPanel>
</StackPanel>
<!--<StackPanel Grid.Row="1" Margin="0 0 0 10">
<Button
@@ -1,4 +1,4 @@
#pragma warning disable CA1416 // 验证平台兼容性
#pragma warning disable CA1416 // 验证平台兼容性
using Microsoft.Win32;
using Microsoft.Win32.TaskScheduler;
using System.Application.Models;
@@ -64,6 +64,19 @@ namespace System.Application.Services.Implementation
}
}
/// <summary>
/// 使用资源管理器打开某个路径
/// </summary>
/// <param name="dirPath"></param>
public void OpenFolder(string dirPath)
{
if (File.Exists(dirPath))
{
Process.Start("explorer.exe", "/select," + dirPath);
}
Process.Start("explorer.exe", dirPath);
}
public string? GetFileName(TextReaderProvider provider)
{
switch (provider)
@@ -1,4 +1,4 @@
using System.Application.Models;
using System.Application.Models;
using System.Application.Models.Settings;
using System.Collections.Generic;
using System.Diagnostics;
@@ -95,6 +95,12 @@ namespace System.Application.Services
}
}
/// <summary>
/// 使用资源管理器打开某个路径
/// </summary>
/// <param name="dirPath"></param>
void OpenFolder(string dirPath);
/// <summary>
/// 获取文本阅读器提供商程序文件路径或文件名(如果提供程序已注册环境变量)
/// </summary>
@@ -205,6 +205,18 @@ namespace System.Application.Services
var result = await client.All();
if (result.IsSuccess)
{
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && result.Content.Any_Nullable())
{
var items = result.Content.SelectMany(s => s.Items);
foreach (var item in items)
{
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
{
item.Enable = true;
}
}
}
ProxyDomains = new ReadOnlyObservableCollection<AccelerateProjectGroupDTO>(new ObservableCollection<AccelerateProjectGroupDTO>(result.Content));
foreach (var item in ProxyDomains)
@@ -214,17 +226,7 @@ namespace System.Application.Services
SelectGroup = ProxyDomains.FirstOrDefault();
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && ProxyDomains.Any_Nullable())
{
var items = ProxyDomains.SelectMany(s => s.Items);
foreach (var item in items)
{
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
{
item.Enable = true;
}
}
}
this.WhenAnyValue(v => v.ProxyDomains)
.Subscribe(domain => domain?
+9
View File
@@ -539,6 +539,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 打开证书文件夹 的本地化字符串。
/// </summary>
public static string CommunityFix_OpenCertificateDir {
get {
return ResourceManager.GetString("CommunityFix_OpenCertificateDir", resourceCulture);
}
}
/// <summary>
/// 查找类似 加速模式 的本地化字符串。
/// </summary>
@@ -279,6 +279,9 @@
<data name="CommunityFix_OnlySteamBrowser" xml:space="preserve">
<value>仅对Steam内置浏览器生效</value>
</data>
<data name="CommunityFix_OpenCertificateDir" xml:space="preserve">
<value>打开证书文件夹</value>
</data>
<data name="CommunityFix_ProxyMode" xml:space="preserve">
<value>加速模式</value>
</data>
@@ -6,6 +6,7 @@ using System.Application.UI.Resx;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Properties;
using System.Reactive;
using System.Threading.Tasks;
@@ -23,6 +24,7 @@ namespace System.Application.UI.ViewModels
public ReactiveCommand<Unit, Unit> SetupCertificateCommand { get; }
public ReactiveCommand<Unit, Unit> DeleteCertificateCommand { get; }
public ReactiveCommand<Unit, Unit> OpenCertificateDirCommand { get; }
public ReactiveCommand<Unit, Unit> EditHostsFileCommand { get; }
public ReactiveCommand<Unit, Unit> AutoRunProxyCommand { get; }
public ReactiveCommand<Unit, Unit> EnableProxyScriptCommand { get; }
@@ -43,7 +45,10 @@ namespace System.Application.UI.ViewModels
{
AutoRunProxy?.CheckmarkChange(ProxySettings.ProgramStartupRunProxy.Value = !ProxySettings.ProgramStartupRunProxy.Value);
});
OpenCertificateDirCommand = ReactiveCommand.Create(() =>
{
DI.Get<IDesktopPlatformService>().OpenFolder(IOPath.AppDataDirectory + @$"\{ThisAssembly.AssemblyProduct}.Certificate.cer");
});
RefreshCommand = ReactiveCommand.Create(RefreshButton_Click);
//EnableProxyScriptCommand = ReactiveCommand.Create(() =>
//{
@@ -70,6 +75,7 @@ namespace System.Application.UI.ViewModels
{
new MenuItemViewModel(nameof(AppResources.CommunityFix_SetupCertificate)){ Command=SetupCertificateCommand },
new MenuItemViewModel(nameof(AppResources.CommunityFix_DeleteCertificate)){ Command=DeleteCertificateCommand },
new MenuItemViewModel(nameof(AppResources.CommunityFix_OpenCertificateDir)){ Command=OpenCertificateDirCommand },
}
},
new MenuItemViewModel (nameof(AppResources.CommunityFix_EditHostsFile)){ Command=EditHostsFileCommand,IconKey="DocumentEditDrawing" },