Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renew WeaselSetup with C# and .NET Framework #1472

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

WhiredPlanck
Copy link

@WhiredPlanck WhiredPlanck commented Jan 10, 2025

理由:

  1. 提高开发效率:C# 提供了更高级别的抽象和更多的内置功能,这可以减少编写样板代码的需求,并加快开发速度。
  2. 简化代码维护:相比于 C++,C#的语法更加简洁,且 .NET 提供了丰富的库支持,这有助于降低代码复杂度,使得代码更容易理解和维护。
  3. 增强的安全性:.NET框架提供了一系列的安全机制,如内存管理和垃圾回收,可以有效避免 C++ 中常见的内存泄漏等问题。
  4. 社区和支持:C# 和 .NET 同样拥有庞大的开发者社区和丰富的资源,这意味着遇到问题时更容易找到解决方案或获得帮助。
  5. 现代化 UI 的支持:WinForms 虽然不是最新颖的UI框架,但它提供了稳定且易于使用的界面设计工具,更适合快速开发和原型设计。

几点差异:

  1. 名称由 WeaselSetup 改为 Weasel.Setup,一是遵守一般 C# 项目的命名规范,二是为了和前者区分开。
  2. 移除了安装旧版 IME 支持的选项,文本服务框架(TSF)自 Windows XP 上市,已诞生 20 年有余。目前小狼毫已最低支持 Windows 8.1,或许也没必要再考虑旧版 IME 的支持。
  3. 目前无法强制开启 HiDPI 支持。需要在同目录的 Weasel.Setup.config 里进行配置。但正式发行时这个文件一般不携带。
  4. 产物中会附带 TSF.TypeLib.dll,这是 C# 下的 TSF 绑定库。
  5. 由于 xmake 目前不支持 C#,如果构建方式选择 xmake,需要单独进行编译。

Reason:

  1. Increased Development Efficiency: C# offers higher-level abstractions and more built-in functionalities, reducing the need for boilerplate code and accelerating development speed.
  2. Simplified Code Maintenance: Compared to C++, C#'s syntax is simpler, and .NET provides extensive library support, which helps reduce code complexity, making it easier to understand and maintain.
  3. Enhanced Security: The .NET framework includes a range of security mechanisms, such as memory management and garbage collection, effectively preventing common issues in C++ like memory leaks.
  4. Community and Support: C# and .NET also have a large developer community and abundant resources, meaning it's easier to find solutions or get help when encountering problems.
  5. Support for Modern UI: While WinForms might not be the most cutting-edge UI framework, it offers stable and user-friendly interface design tools, making it more suitable for rapid development and prototyping.

Diffirences:

  1. Rename WeaselSetup to Weasel.Setup, one reason is to comply with the naming specification of common C# project, another reason is to distinguish from the former.
  2. Option to add legacy IME support has been removed. Text Service Framework (TSF) has been around for more than 20 years since Windows XP hit the market. We may no need to consider the legacy IME support anymore, since Weasel minimal support OS is Windows 8.1.
  3. Currently it cannot force enable HiDPI support. It requires to set in Weasel.Setup.config in the same directory, while the latter will not be included in common release.
  4. A C# TSF binding library TSF.TypeLib.dll will appear in the output.
  5. People need to build it separately in xmake way since xmake doesn't support C# yet.

@fxliang
Copy link
Contributor

fxliang commented Jan 10, 2025

不懂,ARM相关的找下之前pr的大神看方便不方便帮测试下

@WhiredPlanck
Copy link
Author

不懂,ARM相关的找下之前pr的大神看方便不方便帮测试下

@driver1998

@driver1998
Copy link
Contributor

driver1998 commented Jan 10, 2025

.NET Framework AnyCPU 程序只要在项目设置里允许ARM64就可以在Windows 11上原生运行,现在VS有个一键开关:
https://devblogs.microsoft.com/visualstudio/how-to-run-net-apps-natively-on-arm64-devices/

我记得之前WeaselSetup依赖了RIME的库,如果没打算编译ARM64的RIME的话保持WeaselSetup x86(32位或64位)是最好的。

Win10只支持32位x86的.NET。

@WhiredPlanck
Copy link
Author

WhiredPlanck commented Jan 10, 2025

.NET Framework AnyCPU 程序只要在项目设置里允许ARM64就可以在Windows 11上原生运行,现在VS有个一键开关: https://devblogs.microsoft.com/visualstudio/how-to-run-net-apps-natively-on-arm64-devices/

我记得之前WeaselSetup依赖了RIME的库,如果没打算编译ARM64的RIME的话保持WeaselSetup x86(32位或64位)是最好的。

Win10只支持32位x86的.NET。

这个一键开关我已经打开了,那应该没问题。新版的 setup 程序没有向外依赖了,只额外通过 NuGet 安装了一个 TSF 绑定库用于注册或注销输入法服务(其也是 AnyCPU 的)。我本机是 Windows 10 22H2(x86_64),已测试没问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants