Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages # NuGet CLI environment variables
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: true
fetch-depth: 0

- uses: actions/setup-dotnet@v4
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
7.0.x
Expand All @@ -53,12 +53,12 @@ jobs:
python3 tools/ChangelogGenerator/changelog_generator.py --tag "${{ steps.build.outputs.tag }}" --latest "$latest"
- run: ./docs/build.ps1

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: nupkgs
path: nupkgs
retention-days: 7
- uses: actions/upload-pages-artifact@v3
- uses: actions/upload-pages-artifact@v5
with:
path: docs/_site
outputs:
Expand All @@ -71,12 +71,20 @@ jobs:
needs: [ build ]
runs-on: windows-latest
if: needs.build.outputs.is_release != 'True' && github.event.inputs.Publish != 'NuGet'
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: nupkgs
- name: Publish the package to nugettest.org # need secrets.NUGETTEST_TOKEN
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGETTEST_TOKEN }} --source https://apiint.nugettest.org/v3/index.json
- id: login
uses: NuGet/login@v1
with:
user: moomiji
token-service-url: https://int.nugettest.org/api/v2/token
audience: https://int.nugettest.org
- name: Publish the package to int.nugettest.org
run: dotnet nuget push *.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://apiint.nugettest.org/v3/index.json

release:
needs: [ build ]
Expand All @@ -85,18 +93,23 @@ jobs:
permissions:
contents: write
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8

- id: login
uses: NuGet/login@v1
with:
user: moomiji

- name: Publish the package to nuget.org # need secrets.NUGET_TOKEN
- name: Publish the package to nuget.org
run: |
cd nupkgs
dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
dotnet nuget push *.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5

- name: Re-zip docs
run: |
Expand All @@ -105,7 +118,7 @@ jobs:
7z a docs.zip '${{ needs.build.outputs.version }}'

- if: needs.build.outputs.is_release == 'True'
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
body_path: CHANGELOG.md
tag_name: ${{ needs.build.outputs.tag }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages # NuGet CLI environment variables
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: true
fetch-depth: 0

- uses: actions/setup-dotnet@v4
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
7.0.x
Expand All @@ -50,13 +50,13 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: dotnet script ./tools/Builder/Build.csx

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: nupkgs
path: ./nupkgs
retention-days: 1

- if: github.ref == 'refs/heads/${{ steps.build.outputs.default_branch }}' && github.repository_owner_id == '161146573'
- if: github.ref == format('refs/heads/{0}', steps.build.outputs.default_branch) && github.repository_owner_id == '161146573'
uses: moomiji/host-nuget-on-github@v1
with:
base-uri: https://maaxyz.github.io/pkg/nuget/
Expand All @@ -70,8 +70,8 @@ jobs:
lint:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0
- run: dotnet tool install -g dotnet-script
Expand Down
24 changes: 14 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
### NuGet Link

[![](https://img.shields.io/badge/NuGet-Maa.Framework-%23004880)](https://www.nuget.org/packages/Maa.Framework/5.6.0-8-g8aa457f) [![](https://img.shields.io/badge/NuGet-Maa.Framework.Native-%23004880)](https://www.nuget.org/packages/Maa.Framework.Native/5.6.0-8-g8aa457f) [![](https://img.shields.io/badge/NuGet-Binding-%23004880)](https://www.nuget.org/packages/Maa.Framework.Binding/5.6.0-8-g8aa457f) [![](https://img.shields.io/badge/NuGet-Native-%23004880)](https://www.nuget.org/packages/Maa.Framework.Binding.Native/5.6.0-8-g8aa457f)
[![](https://img.shields.io/badge/NuGet-Maa.Framework-%23004880)](https://www.nuget.org/packages/Maa.Framework/5.10.0) [![](https://img.shields.io/badge/NuGet-Maa.Framework.Native-%23004880)](https://www.nuget.org/packages/Maa.Framework.Native/5.10.0) [![](https://img.shields.io/badge/NuGet-Binding-%23004880)](https://www.nuget.org/packages/Maa.Framework.Binding/5.10.0) [![](https://img.shields.io/badge/NuGet-Native-%23004880)](https://www.nuget.org/packages/Maa.Framework.Binding.Native/5.10.0)

## What's Changed in 5.8.0
## What's Changed in v5.10.0

**Full Changelog**: https://github.com/MaaXYZ/MaaFramework.Binding.CSharp/compare/v5.6.0...5.8.0
**Full Changelog**: https://github.com/MaaXYZ/MaaFramework.Binding.CSharp/compare/v5.8.0...v5.10.0

## Breaking changes

- [Breaking change] feat: support Win32ScreencapMethods speed test (#29) @moomiji

### New features

- feat: support IMaaController.Info @moomiji
- feat: support MaaWlRootsController @moomiji
- feat: support IMaaController.Inactive() @moomiji
- feat: configure AgentServer logging @moomiji
- feat: update C API bindings to MaaFramework v5.10.5 (#27) @Copilot @MistEO @moomiji

### Fix

- fix: wlroots use_win32_vk_code method signature (#28) @litwak913

### Other

- RELEASE: v5.8.0 @moomiji
- chore: update interop to framework v5.8.1 @moomiji
- chore: update Win32ScreencapMethod document @moomiji
- chore(UnitTests): fix test cases @moomiji
- chore: update interop to framework v5.10.5 @moomiji
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# MaaFramework.Binding.CSharp

_✨ C# Binding for [MaaFramework](https://github.com/MaaXYZ/MaaFramework/blob/v5.8.1) ✨_
_✨ C# Binding for [MaaFramework](https://github.com/MaaXYZ/MaaFramework/blob/v5.10.5) ✨_

_💫 A universal interop API wrapper 💫_

Expand Down Expand Up @@ -42,7 +42,7 @@ Required dependencies for `MaaFramework.Binding.CSharp`:

### Resource Setup

Refer to MaaFramework docs: [English](https://github.com/MaaXYZ/MaaFramework/blob/v5.8.1/docs/en_us/1.1-QuickStarted.md#prepare-resource-files) | [简体中文](https://github.com/MaaXYZ/MaaFramework/blob/v5.8.1/docs/zh_cn/1.1-快速开始.md#准备资源文件)
Refer to MaaFramework docs: [English](https://github.com/MaaXYZ/MaaFramework/blob/v5.10.5/docs/en_us/1.1-QuickStarted.md#prepare-resource-files) | [简体中文](https://github.com/MaaXYZ/MaaFramework/blob/v5.10.5/docs/zh_cn/1.1-快速开始.md#准备资源文件)

See [SampleResource](./src/MaaFramework.Binding.UnitTests/SampleResource) for implementation.

Expand Down
4 changes: 2 additions & 2 deletions README.zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# MaaFramework.Binding.CSharp

_✨ [MaaFramework](https://github.com/MaaXYZ/MaaFramework/blob/v5.8.1) 的 C# 绑定 ✨_
_✨ [MaaFramework](https://github.com/MaaXYZ/MaaFramework/blob/v5.10.5) 的 C# 绑定 ✨_

_💫 一个通用的互操作 API 封装 💫_

Expand Down Expand Up @@ -42,7 +42,7 @@ _💫 一个通用的互操作 API 封装 💫_

### 资源准备

参考 MaaFramework 文档:[English](https://github.com/MaaXYZ/MaaFramework/blob/v5.8.1/docs/en_us/1.1-QuickStarted.md#prepare-resource-files) | [简体中文](https://github.com/MaaXYZ/MaaFramework/blob/v5.8.1/docs/zh_cn/1.1-快速开始.md#准备资源文件)
参考 MaaFramework 文档:[English](https://github.com/MaaXYZ/MaaFramework/blob/v5.10.5/docs/en_us/1.1-QuickStarted.md#prepare-resource-files) | [简体中文](https://github.com/MaaXYZ/MaaFramework/blob/v5.10.5/docs/zh_cn/1.1-快速开始.md#准备资源文件)

实现示例可查看 [SampleResource](./src/MaaFramework.Binding.UnitTests/SampleResource)。

Expand Down
21 changes: 21 additions & 0 deletions docs/articles/changelog-all-version.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 5.10.0

**Full Changelog**: https://github.com/MaaXYZ/MaaFramework.Binding.CSharp/compare/v5.8.0...v5.10.0

## Breaking changes

- [Breaking change] feat: support Win32ScreencapMethods speed test (#29) @moomiji

### New features

- feat: configure AgentServer logging @moomiji
- feat: update C API bindings to MaaFramework v5.10.5 (#27) @Copilot @MistEO @moomiji

### Fix

- fix: wlroots use_win32_vk_code method signature (#28) @litwak913

### Other

- chore: update interop to framework v5.10.5 @moomiji

## 5.8.0

**Full Changelog**: https://github.com/MaaXYZ/MaaFramework.Binding.CSharp/compare/v5.6.0...5.8.0
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/overview-of-wrapper-and-api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Overview of Wrapper (v5.8.0) and Api ([v5.8.1](https://github.com/MaaXYZ/MaaFramework/tree/v5.8.1))
# Overview of Wrapper (v5.10.0) and Api ([v5.10.5](https://github.com/MaaXYZ/MaaFramework/tree/v5.10.5))
Comment thread
moomiji marked this conversation as resolved.
Resolved

## Enums

Expand Down
2 changes: 1 addition & 1 deletion sample/csharp/1.main.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/dotnet run

#:package Maa.Framework@5.8.0
#:package Maa.Framework@5.10.0

#nullable enable

Expand Down
2 changes: 1 addition & 1 deletion sample/csharp/2.AgentChild.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/dotnet run

#:package Maa.Framework.Binding.Native@5.8.0
#:package Maa.Framework.Binding.Native@5.10.0

#nullable enable

Expand Down
2 changes: 1 addition & 1 deletion sample/csharp/2.AgentMain.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/dotnet run

#:package Maa.Framework@5.8.0
#:package Maa.Framework@5.10.0

#nullable enable

Expand Down
2 changes: 1 addition & 1 deletion sample/csharp/3.CSBinding README Example.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/dotnet run

#:package Maa.Framework@5.8.0
#:package Maa.Framework@5.10.0

#nullable enable

Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Maa.AgentBinary" Version="1.2.0" />
<PackageVersion Include="Maa.Framework.Runtimes" Version="5.8.1" />
<PackageVersion Include="Maa.Framework.Runtimes" Version="5.10.5" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" Condition="'$(TargetFramework)' != 'net7.0'" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.10.2" />
<PackageVersion Include="MSTest.TestFramework" Version="3.10.2" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.10.0.116381" />
</ItemGroup>
</Project>
</Project>
32 changes: 25 additions & 7 deletions src/MaaFramework.Binding.Native/MaaAgentServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,8 @@
private string DebuggerDisplay => $"{GetType().Name} {{ {nameof(CurrentId)} = {CurrentId}, CustomActions = [{string.Join(", ", _actions.Names)}] , CustomRecognitions = [{string.Join(" & ", _recognitions.Names)}] }}";

IMaaAgentServer IMaaAgentServer.WithIdentifier(string identifier) => WithIdentifier(identifier);
IMaaAgentServer IMaaAgentServer.Register<T>(string name, T custom) => Register(name, custom);
IMaaAgentServer IMaaAgentServer.Register<T>(string? name) => Register<T>(name);
IMaaAgentServer IMaaAgentServer.Register<T>(T custom) => Register(custom);
IMaaAgentServer IMaaAgentServer.StartUp() => StartUp();
IMaaAgentServer IMaaAgentServer.ShutDown() => ShutDown();
IMaaAgentServer IMaaAgentServer.Join() => Join();
IMaaAgentServer IMaaAgentServer.Detach() => Detach();
IMaaAgentServer IMaaAgentServer.SetLogDirectory(string directory) => SetLogDirectory(directory);
IMaaAgentServer IMaaAgentServer.SetStdoutLevel(LoggingLevel level) => SetStdoutLevel(level);

/// <inheritdoc cref="IMaaAgentServer.WithIdentifier"/>
public MaaAgentServer WithIdentifier(string identifier)
Expand All @@ -127,6 +122,28 @@
return this;
}

/// <inheritdoc cref="IMaaAgentServer.SetLogDirectory"/>
public MaaAgentServer SetLogDirectory(string directory)
{
_ = MaaGlobal.Shared.SetOption(GlobalOption.LogDir, directory).ThrowIfFalse();
return this;
}

/// <inheritdoc cref="IMaaAgentServer.SetStdoutLevel"/>
public MaaAgentServer SetStdoutLevel(LoggingLevel level)
{
_ = MaaGlobal.Shared.SetOption(GlobalOption.StdoutLevel, level).ThrowIfFalse();
return this;
}

IMaaAgentServer IMaaAgentServer.Register<T>(string name, T custom) => Register(name, custom);
IMaaAgentServer IMaaAgentServer.Register<T>(string? name) => Register<T>(name);
IMaaAgentServer IMaaAgentServer.Register<T>(T custom) => Register(custom);
IMaaAgentServer IMaaAgentServer.StartUp() => StartUp();
IMaaAgentServer IMaaAgentServer.ShutDown() => ShutDown();
IMaaAgentServer IMaaAgentServer.Join() => Join();
IMaaAgentServer IMaaAgentServer.Detach() => Detach();

/// <inheritdoc cref="IMaaAgentServer.Register{T}(string, T)"/>
public MaaAgentServer Register<T>(string name, T custom) where T : IMaaCustom
{
Expand Down Expand Up @@ -217,6 +234,7 @@
{
/// <returns></returns>
/// <inheritdoc cref="IMaaToolkitConfig.InitOption"/>
[Obsolete($"Use {nameof(MaaAgentServer.SetLogDirectory)}() or {nameof(MaaAgentServer.SetStdoutLevel)}() instead.", false)]

Check warning on line 237 in src/MaaFramework.Binding.Native/MaaAgentServer.cs

View workflow job for this annotation

GitHub Actions / build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)
public static MaaAgentServer WithToolkitConfig_InitOption(this MaaAgentServer server, string userPath = nameof(Environment.CurrentDirectory), [StringSyntax("Json")] string defaultJson = "{}")
{
_ = MaaToolkit.Shared.Config.InitOption(userPath, defaultJson).ThrowIfFalse();
Expand Down
2 changes: 1 addition & 1 deletion src/MaaFramework.Binding.Native/NativeBindingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class NativeBindingContext
/// <summary>
/// Gets the version of NativeBinding.
/// </summary>
public static string BindingVersion => "v5.8.0";
public static string BindingVersion => "v5.10.0";

/// <summary>
/// Gets the version of MaaFramework.
Expand Down
2 changes: 2 additions & 0 deletions src/MaaFramework.Binding.UnitTests/MaaTypes.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace MaaFramework.Binding.UnitTests;

#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
Expand All @@ -13,4 +13,6 @@

Native = 1 << 0,
Custom = 1 << 30,

Win32 = None,
}
Comment thread
moomiji marked this conversation as resolved.
Resolved
3 changes: 2 additions & 1 deletion src/MaaFramework.Binding.UnitTests/Test_IMaaAgentServer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace MaaFramework.Binding.UnitTests;

internal static class Test_IMaaAgentServer
Expand Down Expand Up @@ -27,7 +27,8 @@

MaaAgentServer.Current.Callback += OnCallback;
_ = MaaAgentServer.Current
.WithToolkitConfig_InitOption(userPath).WithToolkitConfig_InitOption(userPath)
.SetStdoutLevel(LoggingLevel.All)
.SetLogDirectory(Path.Combine(userPath, "debug", "server-" + id))
.Register(Custom.Recognition) // cat not double call from here
.Register(Custom.Action)
.StartUp()
Expand Down
6 changes: 3 additions & 3 deletions src/MaaFramework.Binding.UnitTests/Test_IMaaController.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using MaaFramework.Binding.Abstractions;
using MaaFramework.Binding.Buffers;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -144,9 +144,9 @@
[MaaData(MaaTypes.All, nameof(Data), ControllerOption.ScreenshotTargetLongSide, 1280)]
[MaaData(MaaTypes.All, nameof(Data), ControllerOption.ScreenshotTargetShortSide, 720)]
[MaaData(MaaTypes.All, nameof(Data), ControllerOption.ScreenshotUseRawSize, false)]
[MaaData(MaaTypes.All, nameof(Data), ControllerOption.MouseLockFollow, false)]
[MaaData(MaaTypes.Win32, nameof(Data), ControllerOption.MouseLockFollow, false)]
[MaaData(MaaTypes.All, nameof(Data), ControllerOption.ScreenshotResizeMethod, 0)]
[MaaData(MaaTypes.All, nameof(Data), ControllerOption.BackgroundManagedKeys, new int[] { 0x57, 0x41, 0x53, 0x44 })]
[MaaData(MaaTypes.Win32, nameof(Data), ControllerOption.BackgroundManagedKeys, new int[] { 0x57, 0x41, 0x53, 0x44 })]
public void Interface_SetOption(MaaTypes type, IMaaController maaController, ControllerOption opt, object arg)
{
Assert.IsNotNull(maaController);
Expand Down Expand Up @@ -386,7 +386,7 @@
}
else
{
Interface_IMaaPost_Failed(job);
Interface_IMaaPost_Success(job);
Assert.IsTrue(
maaController.GetShellOutput(out var output));
Assert.IsNotNull(
Expand Down
Loading
Loading