diff --git a/docs/en-us/develop/development.md b/docs/en-us/develop/development.md index 4e3087c96d..48f2f1a32e 100644 --- a/docs/en-us/develop/development.md +++ b/docs/en-us/develop/development.md @@ -58,7 +58,7 @@ We've preset several different development environments for you to choose from: ``` 5. Configure development environment - - Download and install `Visual Studio 2022 Community`, selecting `Desktop development with C++` and `.NET Desktop Development` during installation. + - Download and install `Visual Studio 2026 Community`, selecting `Desktop development with C++` and `.NET Desktop Development` during installation. 6. Double-click `MAA.sln` to open the project in Visual Studio. 7. Configure Visual Studio settings diff --git a/docs/ja-jp/develop/development.md b/docs/ja-jp/develop/development.md index 539ee2c48a..27119b6590 100644 --- a/docs/ja-jp/develop/development.md +++ b/docs/ja-jp/develop/development.md @@ -64,7 +64,7 @@ icon: iconoir:developer ``` 5. 開発環境の設定 - - `Visual Studio 2022 Community` をインストール時、`C++ によるデスクトップ開発` と `.NET デスクトップ開発` を選択必須 + - `Visual Studio 2026 Community` をインストール時、`C++ によるデスクトップ開発` と `.NET デスクトップ開発` を選択必須 6. `MAA.sln` をダブルクリックで開き、Visual Studio にプロジェクトを自動ロード 7. VS の設定 diff --git a/docs/ko-kr/develop/development.md b/docs/ko-kr/develop/development.md index f76d97cdcd..978b79c994 100644 --- a/docs/ko-kr/develop/development.md +++ b/docs/ko-kr/develop/development.md @@ -63,7 +63,7 @@ icon: iconoir:developer ``` 5. 개발 환경 구성 - - Visual Studio 2022 Community 설치 시 `C++ 데스크톱 개발` 및 `.NET 데스크톱 개발` 필수 선택 + - Visual Studio 2026 Community 설치 시 `C++ 데스크톱 개발` 및 `.NET 데스크톱 개발` 필수 선택 6. MAA.sln 파일 더블클릭 → Visual Studio에서 프로젝트 자동 로드 7. VS 설정 diff --git a/docs/zh-cn/develop/development.md b/docs/zh-cn/develop/development.md index 8b04a1ce87..aa4ebe7923 100644 --- a/docs/zh-cn/develop/development.md +++ b/docs/zh-cn/develop/development.md @@ -59,13 +59,13 @@ icon: iconoir:developer 5. 配置编程环境 - 下载并安装 `CMake` - - 下载并安装 `Visual Studio 2022 community`, 安装的时候需要选中 `基于 C++ 的桌面开发` 和 `.NET 桌面开发`。 + - 下载并安装 `Visual Studio 2026 Community`, 安装的时候需要选中 `基于 C++ 的桌面开发` 和 `.NET 桌面开发`。 6. 执行 cmake 项目配置 ```cmd mkdir -p build - cmake -G "Visual Studio 17 2022" -B build -DBUILD_WPF_GUI=ON -DBUILD_DEBUG_DEMO=ON + cmake -G "Visual Studio 18 2026" -B build -DBUILD_WPF_GUI=ON -DBUILD_DEBUG_DEMO=ON ``` 7. 双击打开 `build/MAA.sln` 文件,Visual Studio 会自动加载整个项目。 diff --git a/docs/zh-tw/develop/development.md b/docs/zh-tw/develop/development.md index f338eef405..f794a552d5 100644 --- a/docs/zh-tw/develop/development.md +++ b/docs/zh-tw/develop/development.md @@ -58,7 +58,7 @@ icon: iconoir:developer ``` 5. 配置編程環境 - - 下載並安裝 `Visual Studio 2022 community`, 安裝的時候需要選中 `基於 C++ 的桌面開發` 和 `.NET 桌面開發`。 + - 下載並安裝 `Visual Studio 2026 Community`, 安裝的時候需要選中 `基於 C++ 的桌面開發` 和 `.NET 桌面開發`。 6. 雙擊打開 `MAA.sln` 文件,Visual Studio 會自動載入整個項目。 7. 設置 VS diff --git a/src/MaaWpfGui/Helper/GpuOption.cs b/src/MaaWpfGui/Helper/GpuOption.cs index 2353893db3..4c0eb5ca79 100644 --- a/src/MaaWpfGui/Helper/GpuOption.cs +++ b/src/MaaWpfGui/Helper/GpuOption.cs @@ -230,7 +230,7 @@ public abstract class GpuOption var interfacePath = req.adapterDevicePath.ToString(); uint size = 0; - var err = PInvoke.CM_Get_Device_Interface_Property(interfacePath, PInvoke.DEVPKEY_Device_InstanceId, out var type, null, ref size, 0); + var err = PInvoke.CM_Get_Device_Interface_Property(interfacePath, PInvoke.DEVPKEY_Device_InstanceId, out var type, Span.Empty, ref size, 0); if (err != CONFIGRET.CR_BUFFER_SMALL) { @@ -245,16 +245,23 @@ public abstract class GpuOption var buf = ArrayPool.Shared.Rent((int)size); string? result; - fixed (byte* ptr = buf) + try { - err = PInvoke.CM_Get_Device_Interface_Property(interfacePath, PInvoke.DEVPKEY_Device_InstanceId, out _, ptr, ref size, 0); + err = PInvoke.CM_Get_Device_Interface_Property(interfacePath, PInvoke.DEVPKEY_Device_InstanceId, out _, buf.AsSpan(0, (int)size), ref size, 0); if (err != CONFIGRET.CR_SUCCESS) { return null; } var cch = (int)(size / 2) - 1; - result = Marshal.PtrToStringUni((nint)ptr, cch); + fixed (byte* ptr = buf) + { + result = Marshal.PtrToStringUni((nint)ptr, cch); + } + } + finally + { + ArrayPool.Shared.Return(buf); } return result; @@ -311,7 +318,8 @@ public abstract class GpuOption System.Runtime.InteropServices.ComTypes.FILETIME ft; uint size = (uint)sizeof(System.Runtime.InteropServices.ComTypes.FILETIME); - var err = PInvoke.CM_Get_DevNode_Property(devInst, PInvoke.DEVPKEY_Device_DriverDate, out _, (byte*)(&ft), ref size, 0); + var ftSpan = new Span(&ft, (int)size); + var err = PInvoke.CM_Get_DevNode_Property(devInst, PInvoke.DEVPKEY_Device_DriverDate, out _, ftSpan, ref size, 0); if (err != CONFIGRET.CR_SUCCESS) { @@ -321,7 +329,7 @@ public abstract class GpuOption var driverDate = ft.ToDateTime().Date; size = 0; - err = PInvoke.CM_Get_DevNode_Property(devInst, PInvoke.DEVPKEY_Device_DriverVersion, out _, null, ref size, 0); + err = PInvoke.CM_Get_DevNode_Property(devInst, PInvoke.DEVPKEY_Device_DriverVersion, out _, Span.Empty, ref size, 0); if (err != CONFIGRET.CR_BUFFER_SMALL) { @@ -330,10 +338,14 @@ public abstract class GpuOption var buf = new byte[size]; string? driverVersion; + err = PInvoke.CM_Get_DevNode_Property(devInst, PInvoke.DEVPKEY_Device_DriverVersion, out _, buf.AsSpan(), ref size, 0); + if (err != CONFIGRET.CR_SUCCESS) + { + return new(description, null, driverDate); + } + fixed (byte* ptr = buf) { - // err = - PInvoke.CM_Get_DevNode_Property(devInst, PInvoke.DEVPKEY_Device_DriverVersion, out _, ptr, ref size, 0); driverVersion = Marshal.PtrToStringUni((nint)ptr); } diff --git a/src/MaaWpfGui/MaaWpfGui.csproj b/src/MaaWpfGui/MaaWpfGui.csproj index e0f96e2c12..3a1f011739 100644 --- a/src/MaaWpfGui/MaaWpfGui.csproj +++ b/src/MaaWpfGui/MaaWpfGui.csproj @@ -1,13 +1,13 @@ - + - net8.0-windows10.0.17763.0 + net10.0-windows10.0.17763.0 win-x64 win-arm64 WinExe MaaWpfGui.App - 12 + 14 true Debug;Release;RelWithDebInfo ARM64;x64 @@ -38,12 +38,13 @@ false false true + false 0 - 5.0.0.0 + 6.0.0.0 0.0.1 0.0.1 0.0.1 @@ -109,43 +110,42 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive NU1701 - - - - - - + + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - + + + + diff --git a/tools/DependencySetup_依赖库安装.bat b/tools/DependencySetup_依赖库安装.bat index e77db46a62..88c4e5006a 100644 --- a/tools/DependencySetup_依赖库安装.bat +++ b/tools/DependencySetup_依赖库安装.bat @@ -43,11 +43,11 @@ echo %BLUE%===================================================================== echo. echo %BLUE%====================================================================================================%RESET% -echo %BOLD%%CYAN%正在安装 .NET Desktop Runtime 8.0%RESET% -echo %BOLD%%CYAN%Installing .NET Desktop Runtime 8.0%RESET% +echo %BOLD%%CYAN%正在安装 .NET Desktop Runtime 10.0%RESET% +echo %BOLD%%CYAN%Installing .NET Desktop Runtime 10.0%RESET% echo. -winget install "Microsoft.DotNet.DesktopRuntime.8" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force +winget install "Microsoft.DotNet.DesktopRuntime.10" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force if %errorlevel% neq 0 ( set "ErrorOccurred=1" ) @@ -72,8 +72,8 @@ if %ErrorOccurred% equ 0 ( echo %WHITE%Microsoft Visual C++ Redistributable:%RESET% echo %CYAN%https://aka.ms/vs/17/release/vc_redist.x64.exe%RESET% echo. - echo %WHITE%.NET Desktop Runtime 8.0:%RESET% - echo %CYAN%https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe%RESET% + echo %WHITE%.NET Desktop Runtime 10.0:%RESET% + echo %CYAN%https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe%RESET% echo %RED%====================================================================================================%RESET% ) diff --git a/tools/cmake_build_for_wpf.bat b/tools/cmake_build_for_wpf.bat index be1dc1200c..7b01100328 100644 --- a/tools/cmake_build_for_wpf.bat +++ b/tools/cmake_build_for_wpf.bat @@ -1,3 +1,3 @@ cd .. -cmake -G "Visual Studio 17 2022" -B build -DBUILD_WPF_GUI=ON -DBUILD_DEBUG_DEMO=ON +cmake -G "Visual Studio 18 2026" -B build -DBUILD_WPF_GUI=ON -DBUILD_DEBUG_DEMO=ON pause \ No newline at end of file