适配WindowsVista编译 (#499)
This commit is contained in:
parent
bb20d50122
commit
c004a1c72f
|
@ -23,7 +23,7 @@ env:
|
|||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
||||
|
||||
jobs:
|
||||
build-win7-x86:
|
||||
build-win-nt6_0-x86:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
|
@ -34,13 +34,15 @@ jobs:
|
|||
with:
|
||||
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
|
||||
|
||||
- run: powershell -Command "(Get-Content src/N_m3u8DL-RE/N_m3u8DL-RE.csproj) -replace '<TargetFramework>.*</TargetFramework>', '<TargetFramework>net9.0-windows</TargetFramework>' | Set-Content src/N_m3u8DL-RE/N_m3u8DL-RE.csproj"
|
||||
- run: dotnet add src/N_m3u8DL-RE/N_m3u8DL-RE.csproj package YY-Thunks --version 1.1.4
|
||||
- run: dotnet add src/N_m3u8DL-RE/N_m3u8DL-RE.csproj package VC-LTL --version 5.1.1
|
||||
- run: dotnet publish src/N_m3u8DL-RE -r win-x86 -c Release -o artifact-x86
|
||||
- run: dotnet publish src/N_m3u8DL-RE -p:TargetPlatformMinVersion=6.0 -r win-x86 -c Release -o artifact-x86
|
||||
|
||||
- name: Upload Artifact[win-x86]
|
||||
uses: actions/upload-artifact@v3.1.3
|
||||
with:
|
||||
name: N_m3u8DL-RE_Beta_win7-x86
|
||||
name: N_m3u8DL-RE_Beta_win_NT6.0-x86
|
||||
path: artifact-x86\N_m3u8DL-RE.exe
|
||||
|
||||
build-win-x64-arm64:
|
||||
|
@ -135,7 +137,7 @@ jobs:
|
|||
create_draft_release:
|
||||
name: Create Github draft release
|
||||
if: ${{ github.event.inputs.doRelease == 'true' }}
|
||||
needs: [build-win7-x86,build-win-x64-arm64,build-linux-x64,build-linux-arm64,build-mac-x64-arm64]
|
||||
needs: [build-win-nt6_0-x86,build-win-x64-arm64,build-linux-x64,build-linux-arm64,build-mac-x64-arm64]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Audit gh version
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
public class ResString
|
||||
{
|
||||
public static string CurrentLoc = "en-US";
|
||||
|
||||
public static readonly string ReLiveTs = "<RE_LIVE_TS>";
|
||||
public static string singleFileRealtimeDecryptWarn => GetText("singleFileRealtimeDecryptWarn");
|
||||
public static string singleFileSplitWarn => GetText("singleFileSplitWarn");
|
||||
|
@ -132,10 +134,9 @@ public class ResString
|
|||
if (!StaticText.LANG_DIC.ContainsKey(key))
|
||||
return "<...LANG TEXT MISSING...>";
|
||||
|
||||
var current = Thread.CurrentThread.CurrentUICulture.Name;
|
||||
if (current == "zh-CN" || current == "zh-SG" || current == "zh-Hans")
|
||||
if (CurrentLoc == "zh-CN" || CurrentLoc == "zh-SG" || CurrentLoc == "zh-Hans")
|
||||
return StaticText.LANG_DIC[key].ZH_CN;
|
||||
if (current.StartsWith("zh-"))
|
||||
if (CurrentLoc.StartsWith("zh-"))
|
||||
return StaticText.LANG_DIC[key].ZH_TW;
|
||||
return StaticText.LANG_DIC[key].EN_US;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ using N_m3u8DL_RE.Parser;
|
|||
using Spectre.Console;
|
||||
using N_m3u8DL_RE.Common.Resource;
|
||||
using N_m3u8DL_RE.Common.Log;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using N_m3u8DL_RE.Common.Util;
|
||||
using N_m3u8DL_RE.Processor;
|
||||
|
@ -22,11 +21,21 @@ internal class Program
|
|||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
// 处理NT6.0及以下System.CommandLine报错CultureNotFound问题
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
var osVersion = Environment.OSVersion.Version;
|
||||
if (osVersion.Major < 6 || (osVersion.Major == 6 && osVersion.Minor == 0))
|
||||
{
|
||||
Environment.SetEnvironmentVariable("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1");
|
||||
}
|
||||
}
|
||||
|
||||
Console.CancelKeyPress += Console_CancelKeyPress;
|
||||
ServicePointManager.DefaultConnectionLimit = 1024;
|
||||
try { Console.CursorVisible = true; } catch { }
|
||||
|
||||
string loc = "en-US";
|
||||
string loc = ResString.CurrentLoc;
|
||||
string currLoc = Thread.CurrentThread.CurrentUICulture.Name;
|
||||
if (currLoc == "zh-CN" || currLoc == "zh-SG") loc = "zh-CN";
|
||||
else if (currLoc.StartsWith("zh-")) loc = "zh-TW";
|
||||
|
@ -39,10 +48,7 @@ internal class Program
|
|||
loc = list[index + 1];
|
||||
}
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(loc);
|
||||
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(loc);
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(loc);
|
||||
|
||||
ResString.CurrentLoc = loc;
|
||||
|
||||
await CommandInvoker.InvokeArgs(args, DoWorkAsync);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue