Skip to content

Commit

Permalink
opencertdir
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Apr 30, 2021
1 parent 034dd57 commit 44e10a2
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma warning disable CA1416 // 验证平台兼容性
#pragma warning disable CA1416 // 验证平台兼容性
using Microsoft.Win32;
using Microsoft.Win32.TaskScheduler;
using System.Application.Models;
Expand Down Expand Up @@ -64,6 +64,19 @@ static string GetFolderPath(Environment.SpecialFolder folder)
}
}

/// <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)
Expand Down
8 changes: 7 additions & 1 deletion src/ST.Client.Desktop/Services/IDesktopPlatformService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Application.Models;
using System.Application.Models;
using System.Application.Models.Settings;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -95,6 +95,12 @@ void OpenFileByTextReader(string filePath)
}
}

/// <summary>
/// 使用资源管理器打开某个路径
/// </summary>
/// <param name="dirPath"></param>
void OpenFolder(string dirPath);

/// <summary>
/// 获取文本阅读器提供商程序文件路径或文件名(如果提供程序已注册环境变量)
/// </summary>
Expand Down
24 changes: 13 additions & 11 deletions src/ST.Client.Desktop/Services/Mvvm/ProxyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,9 @@ public async Task InitializeAccelerate()
var result = await client.All();
if (result.IsSuccess)
{
ProxyDomains = new ReadOnlyObservableCollection<AccelerateProjectGroupDTO>(new ObservableCollection<AccelerateProjectGroupDTO>(result.Content));

foreach (var item in ProxyDomains)
{
item.ImageStream = IHttpService.Instance.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId), ImageChannelType.AccelerateGroup);
}

SelectGroup = ProxyDomains.FirstOrDefault();

if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && ProxyDomains.Any_Nullable())
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && result.Content.Any_Nullable())
{
var items = ProxyDomains.SelectMany(s => s.Items);
var items = result.Content.SelectMany(s => s.Items);
foreach (var item in items)
{
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
Expand All @@ -226,6 +217,17 @@ public async Task InitializeAccelerate()
}
}

ProxyDomains = new ReadOnlyObservableCollection<AccelerateProjectGroupDTO>(new ObservableCollection<AccelerateProjectGroupDTO>(result.Content));

foreach (var item in ProxyDomains)
{
item.ImageStream = IHttpService.Instance.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId), ImageChannelType.AccelerateGroup);
}

SelectGroup = ProxyDomains.FirstOrDefault();



this.WhenAnyValue(v => v.ProxyDomains)
.Subscribe(domain => domain?
.ToObservableChangeSet()
Expand Down
9 changes: 9 additions & 0 deletions src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/ST.Client.Desktop/UI/Resx/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Properties;
using System.Reactive;
using System.Threading.Tasks;

Expand All @@ -23,6 +24,7 @@ public override string Name

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; }
Expand All @@ -43,7 +45,10 @@ public CommunityProxyPageViewModel()
{
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(() =>
//{
Expand All @@ -70,6 +75,7 @@ public CommunityProxyPageViewModel()
{
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" },
Expand Down

0 comments on commit 44e10a2

Please sign in to comment.