Skip to content

Commit 44e10a2

Browse files
committed
opencertdir
1 parent 034dd57 commit 44e10a2

File tree

7 files changed

+55
-14
lines changed

7 files changed

+55
-14
lines changed

src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/LoginOrRegisterWindow.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
<TextBlock FontSize="12" Text="{ReflectionBinding Path=Res.And,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
7171
<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"/>
7272
</WrapPanel>
73+
74+
7375
</StackPanel>
7476
<!--<StackPanel Grid.Row="1" Margin="0 0 0 10">
7577
<Button

src/ST.Client.Desktop.Windows/Services/Implementation/WindowsDesktopPlatformServiceImpl.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#pragma warning disable CA1416 // 验证平台兼容性
1+
#pragma warning disable CA1416 // 验证平台兼容性
22
using Microsoft.Win32;
33
using Microsoft.Win32.TaskScheduler;
44
using System.Application.Models;
@@ -64,6 +64,19 @@ static string GetFolderPath(Environment.SpecialFolder folder)
6464
}
6565
}
6666

67+
/// <summary>
68+
/// 使用资源管理器打开某个路径
69+
/// </summary>
70+
/// <param name="dirPath"></param>
71+
public void OpenFolder(string dirPath)
72+
{
73+
if (File.Exists(dirPath))
74+
{
75+
Process.Start("explorer.exe", "/select," + dirPath);
76+
}
77+
Process.Start("explorer.exe", dirPath);
78+
}
79+
6780
public string? GetFileName(TextReaderProvider provider)
6881
{
6982
switch (provider)

src/ST.Client.Desktop/Services/IDesktopPlatformService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Application.Models;
1+
using System.Application.Models;
22
using System.Application.Models.Settings;
33
using System.Collections.Generic;
44
using System.Diagnostics;
@@ -95,6 +95,12 @@ void OpenFileByTextReader(string filePath)
9595
}
9696
}
9797

98+
/// <summary>
99+
/// 使用资源管理器打开某个路径
100+
/// </summary>
101+
/// <param name="dirPath"></param>
102+
void OpenFolder(string dirPath);
103+
98104
/// <summary>
99105
/// 获取文本阅读器提供商程序文件路径或文件名(如果提供程序已注册环境变量)
100106
/// </summary>

src/ST.Client.Desktop/Services/Mvvm/ProxyService.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,9 @@ public async Task InitializeAccelerate()
205205
var result = await client.All();
206206
if (result.IsSuccess)
207207
{
208-
ProxyDomains = new ReadOnlyObservableCollection<AccelerateProjectGroupDTO>(new ObservableCollection<AccelerateProjectGroupDTO>(result.Content));
209-
210-
foreach (var item in ProxyDomains)
211-
{
212-
item.ImageStream = IHttpService.Instance.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId), ImageChannelType.AccelerateGroup);
213-
}
214-
215-
SelectGroup = ProxyDomains.FirstOrDefault();
216-
217-
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && ProxyDomains.Any_Nullable())
208+
if (ProxySettings.SupportProxyServicesStatus.Value.Any_Nullable() && result.Content.Any_Nullable())
218209
{
219-
var items = ProxyDomains.SelectMany(s => s.Items);
210+
var items = result.Content.SelectMany(s => s.Items);
220211
foreach (var item in items)
221212
{
222213
if (ProxySettings.SupportProxyServicesStatus.Value.Contains(item.Id.ToString()))
@@ -226,6 +217,17 @@ public async Task InitializeAccelerate()
226217
}
227218
}
228219

220+
ProxyDomains = new ReadOnlyObservableCollection<AccelerateProjectGroupDTO>(new ObservableCollection<AccelerateProjectGroupDTO>(result.Content));
221+
222+
foreach (var item in ProxyDomains)
223+
{
224+
item.ImageStream = IHttpService.Instance.GetImageAsync(ImageUrlHelper.GetImageApiUrlById(item.ImageId), ImageChannelType.AccelerateGroup);
225+
}
226+
227+
SelectGroup = ProxyDomains.FirstOrDefault();
228+
229+
230+
229231
this.WhenAnyValue(v => v.ProxyDomains)
230232
.Subscribe(domain => domain?
231233
.ToObservableChangeSet()

src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ST.Client.Desktop/UI/Resx/AppResources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@
279279
<data name="CommunityFix_OnlySteamBrowser" xml:space="preserve">
280280
<value>仅对Steam内置浏览器生效</value>
281281
</data>
282+
<data name="CommunityFix_OpenCertificateDir" xml:space="preserve">
283+
<value>打开证书文件夹</value>
284+
</data>
282285
<data name="CommunityFix_ProxyMode" xml:space="preserve">
283286
<value>加速模式</value>
284287
</data>

src/ST.Client.Desktop/UI/ViewModels/Pages/CommunityProxyPageViewModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using System.Collections.ObjectModel;
88
using System.Linq;
9+
using System.Properties;
910
using System.Reactive;
1011
using System.Threading.Tasks;
1112

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

2425
public ReactiveCommand<Unit, Unit> SetupCertificateCommand { get; }
2526
public ReactiveCommand<Unit, Unit> DeleteCertificateCommand { get; }
27+
public ReactiveCommand<Unit, Unit> OpenCertificateDirCommand { get; }
2628
public ReactiveCommand<Unit, Unit> EditHostsFileCommand { get; }
2729
public ReactiveCommand<Unit, Unit> AutoRunProxyCommand { get; }
2830
public ReactiveCommand<Unit, Unit> EnableProxyScriptCommand { get; }
@@ -43,7 +45,10 @@ public CommunityProxyPageViewModel()
4345
{
4446
AutoRunProxy?.CheckmarkChange(ProxySettings.ProgramStartupRunProxy.Value = !ProxySettings.ProgramStartupRunProxy.Value);
4547
});
46-
48+
OpenCertificateDirCommand = ReactiveCommand.Create(() =>
49+
{
50+
DI.Get<IDesktopPlatformService>().OpenFolder(IOPath.AppDataDirectory + @$"\{ThisAssembly.AssemblyProduct}.Certificate.cer");
51+
});
4752
RefreshCommand = ReactiveCommand.Create(RefreshButton_Click);
4853
//EnableProxyScriptCommand = ReactiveCommand.Create(() =>
4954
//{
@@ -70,6 +75,7 @@ public CommunityProxyPageViewModel()
7075
{
7176
new MenuItemViewModel(nameof(AppResources.CommunityFix_SetupCertificate)){ Command=SetupCertificateCommand },
7277
new MenuItemViewModel(nameof(AppResources.CommunityFix_DeleteCertificate)){ Command=DeleteCertificateCommand },
78+
new MenuItemViewModel(nameof(AppResources.CommunityFix_OpenCertificateDir)){ Command=OpenCertificateDirCommand },
7379
}
7480
},
7581
new MenuItemViewModel (nameof(AppResources.CommunityFix_EditHostsFile)){ Command=EditHostsFileCommand,IconKey="DocumentEditDrawing" },

0 commit comments

Comments
 (0)