Skip to content

Commit 52efcbb

Browse files
committed
fix: builed chinese bug, transfrom to utf-8
1 parent 2dd09a5 commit 52efcbb

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

src/MDriveSync.Client.WinFormAPI/MDriveSync.Client.WinFormAPI.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
<EmbeddedResource Include="Resources\logo.png" />
4343
</ItemGroup>
4444

45+
<ItemGroup>
46+
<None Update="zh\**\*">
47+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
48+
</None>
49+
</ItemGroup>
50+
4551
<ItemGroup>
4652
<ProjectReference Include="..\MDriveSync.Client.App\MDriveSync.Client.App.csproj" />
4753
</ItemGroup>

src/MDriveSync.Client.WinFormAPI/MainForm.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.Extensions.Configuration;
1+
using Microsoft.Extensions.Configuration;
22
using Microsoft.Web.WebView2.WinForms;
33
using System.Reflection;
44

@@ -16,15 +16,15 @@ public MainForm()
1616
{
1717
InitializeComponent();
1818

19-
// 从配置文件中读取 URL,如果没有则使用默认值
19+
// 从配置文件中读取 URL,如果没有则使用默认值
2020
var configuration = Program.Configuration;
2121
apiUrl = configuration.GetValue<string>("urls")?.Replace("*", "localhost") ?? "http://localhost:8080";
2222

2323
// Initialize WebView2
2424
webView = new WebView2
2525
{
2626
Dock = DockStyle.Fill,
27-
Source = new Uri($"{apiUrl}") // 指向 Web API 的 URL
27+
Source = new Uri($"{apiUrl}") // 指向 Web API 的 URL
2828
};
2929
this.Controls.Add(webView);
3030

@@ -36,14 +36,14 @@ public MainForm()
3636
Visible = true
3737
};
3838

39-
// 使用资源中的 PNG 图像
39+
// 使用资源中的 PNG 图像
4040
this.Icon = LoadIconFromResource("MDriveSync.Client.WinFormAPI.Resources.logo.png", 64, 64);
4141

4242
notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
4343

4444
// Initialize ContextMenuStrip
4545
contextMenuStrip = new ContextMenuStrip();
46-
exitMenuItem = new ToolStripMenuItem("退出", null, ExitMenuItem_Click);
46+
exitMenuItem = new ToolStripMenuItem("退出", null, ExitMenuItem_Click);
4747
contextMenuStrip.Items.Add(exitMenuItem);
4848
notifyIcon.ContextMenuStrip = contextMenuStrip;
4949

@@ -70,17 +70,17 @@ protected override void OnFormClosing(FormClosingEventArgs e)
7070
{
7171
if (e.CloseReason == CloseReason.UserClosing)
7272
{
73-
e.Cancel = true; // 取消关闭操作
74-
this.WindowState = FormWindowState.Minimized; // 最小化窗口
75-
this.Hide(); // 隐藏窗口
76-
notifyIcon.Visible = true; // 显示 NotifyIcon
73+
e.Cancel = true; // 取消关闭操作
74+
this.WindowState = FormWindowState.Minimized; // 最小化窗口
75+
this.Hide(); // 隐藏窗口
76+
notifyIcon.Visible = true; // 显示 NotifyIcon
7777
}
7878
}
7979

8080
private void ExitMenuItem_Click(object sender, EventArgs e)
8181
{
8282
notifyIcon.Visible = false;
83-
notifyIcon.Dispose(); // 确保图标被释放
83+
notifyIcon.Dispose(); // 确保图标被释放
8484
Application.Exit();
8585
}
8686

@@ -121,4 +121,4 @@ private Icon LoadIconFromResource(string resourceName)
121121
}
122122
}
123123
}
124-
}
124+
}

src/MDriveSync.Client.WinFormAPI/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.AspNetCore.Hosting;
1+
using Microsoft.AspNetCore.Hosting;
22
using Microsoft.Extensions.Configuration;
33
using Microsoft.Extensions.DependencyInjection;
44
using Microsoft.Extensions.Hosting;
@@ -30,11 +30,11 @@ public static IHostBuilder CreateHostBuilder() =>
3030
{
3131
var env = context.HostingEnvironment;
3232

33-
// 添加 appsettings.json 配置文件
33+
// 添加 appsettings.json 配置文件
3434
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
3535
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
3636

37-
// 添加环境变量
37+
// 添加环境变量
3838
config.AddEnvironmentVariables();
3939
})
4040
.ConfigureWebHostDefaults(webBuilder =>
@@ -54,4 +54,4 @@ public static IHostBuilder CreateHostBuilder() =>
5454
}
5555
});
5656
}
57-
}
57+
}

0 commit comments

Comments
 (0)