Skip to content

Commit 212187b

Browse files
committed
💾 Feat: 增加异步的环境安装方法
1 parent 26bce5e commit 212187b

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Algorithm.Interop/Environment.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static void InstallEnvironment(InstallMethod im = InstallMethod.WebClient
8080
/// 异步安装环境
8181
/// <paramref name="im">异步安装方式</paramref>
8282
/// </summary>
83-
public static async Task InstallEnvironment(InstallMethodAsync im = InstallMethodAsync.WebClientAsync)
83+
public static async Task InstallEnvironmentAsync(InstallMethodAsync im = InstallMethodAsync.WebClientAsync)
8484
{
8585
if (!Directory.Exists(dll_path))
8686
Directory.CreateDirectory(dll_path);
@@ -113,6 +113,9 @@ public enum InstallMethod
113113
WebClient
114114
}
115115

116+
/// <summary>
117+
/// 安装环境下载方式
118+
/// </summary>
116119
public enum InstallMethodAsync
117120
{
118121
WebClientAsync, Http

Algorithm.UnitTest/HashTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Algorithm.UnitTest
1313
public class 哈希测试
1414
{
1515
[TestMethod]
16-
public void 环境安装测试()
16+
public async void 环境安装测试()
1717
{
1818
Console.WriteLine(Interop.Environment.CheckEnvironment());
1919

@@ -25,8 +25,8 @@ public void 环境安装测试()
2525

2626
Directory.Delete(Path.GetFullPath($"{Interop.Environment.dll_path}"), true);
2727
if (!Interop.Environment.CheckEnvironment())
28-
Interop.Environment.InstallEnvironment(Interop.Environment.InstallMethodAsync.WebClientAsync);
29-
Thread.Sleep(1000);
28+
await Interop.Environment.InstallEnvironmentAsync(Interop.Environment.InstallMethodAsync.WebClientAsync);
29+
Thread.Sleep(3000);
3030
Assert.IsTrue(Interop.Environment.CheckEnvironment());
3131
}
3232

0 commit comments

Comments
 (0)