mirror of
https://github.com/TheWhiteDog9487/lag2cn.git
synced 2026-08-11 23:01:29 +08:00
彻底移除P/Invoke,以解决运行时DLL找不到的问题
虽然不需要调用libc了,但是仍然需要静态链接,不然还是会出问题
This commit is contained in:
+2
-4
@@ -6,15 +6,13 @@
|
|||||||
#:property OptimizationPreference=Speed
|
#:property OptimizationPreference=Speed
|
||||||
// #:property OptimizationPreference=Size
|
// #:property OptimizationPreference=Size
|
||||||
#:property InvariantGlobalization=true
|
#:property InvariantGlobalization=true
|
||||||
|
// ↑ 这个东西需要libicu
|
||||||
// #:property StackTraceSupport=false
|
// #:property StackTraceSupport=false
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
[DllImport("libc", EntryPoint = "geteuid")]
|
|
||||||
static extern uint GetEffectiveUserId();
|
|
||||||
|
|
||||||
void CheckUser(string DisplayMessage = "即将开始更新语言配置"){
|
void CheckUser(string DisplayMessage = "即将开始更新语言配置"){
|
||||||
Console.WriteLine(DisplayMessage);
|
Console.WriteLine(DisplayMessage);
|
||||||
Console.WriteLine("按回车继续,按Esc取消");
|
Console.WriteLine("按回车继续,按Esc取消");
|
||||||
@@ -81,7 +79,7 @@ if (Enum.TryParse<SupportedLinuxDistributions>(OsDescription.Split(' ')[0], out
|
|||||||
如果是误报,请在GitHub仓库打开一个新的issue。
|
如果是误报,请在GitHub仓库打开一个新的issue。
|
||||||
".Trim();
|
".Trim();
|
||||||
throw new NotSupportedException(Message); } }
|
throw new NotSupportedException(Message); } }
|
||||||
if (GetEffectiveUserId() != 0){
|
if (Environment.IsPrivilegedProcess == false){
|
||||||
throw new UnauthorizedAccessException("更改语言文件需要root权限,请使用sudo重新运行本程序"); }
|
throw new UnauthorizedAccessException("更改语言文件需要root权限,请使用sudo重新运行本程序"); }
|
||||||
|
|
||||||
Console.WriteLine($"探测到当前系统为 {OsDescription}");
|
Console.WriteLine($"探测到当前系统为 {OsDescription}");
|
||||||
|
|||||||
Reference in New Issue
Block a user