Your computer should meet the minimum system requirements before you run and use MaaFramework.Binding.CSharp
, which might run on other platforms or versions not listed here.
OS Version | Minimum Requirements / Reason |
---|---|
Windows 10+ | Restricted from .NET 7.0 |
macOS 12+ | Restricted from MaaFramework |
Linux Ubuntu 23.10+ |
libc6 2.38+ and more |
Android | Unknown |
- Architectures: X64, Arm64
MaaFramework.Binding.CSharp
needs the following dependencies installed to run properly.
Platform | Package Id | Dependent Download |
---|---|---|
Windows | Maa.Framework Maa.Framework.Runtimes Maa.Framework.Runtime.win-arm64 Maa.Framework.Runtime.win-x64 |
Visual C++ Redistributable |
See MaaFramework document ( English | 简体中文 ) .
Like this SampleResource in MaaFramework.Binding.CSharp
.
dotnet add package Maa.Framework --prerelease
Download nupkgs.zip
from CI Action and extract files to .\nupkgs\
.
- shell
dotnet add package Maa.Framework --prerelease -s .\nupkgs\
- or .csproj
<PropertyGroup>
<RestoreSources>$(RestoreSources);$(FullPath of .\nupkgs\)</RestoreSources>
</PropertyGroup>
The supported Runtime IDs for MaaFramework
can be found here.
To use specific RIDs, such as the supported win
platform packages, manually reference the following packages:
Maa.Framework.Native
Maa.Framework.Runtime.win-arm64
Maa.Framework.Runtime.win-x64
Pre-work:
adb connect HOST[:PORT]
using MaaFramework.Binding;
var devices = new MaaToolkit(true).Device.Find();
if (devices.Length < 1)
throw new InvalidOperationException();
using var maa = new MaaInstance
{
Controller = devices[0].ToAdbController(),
Resource = new MaaResource("./SampleResource"),
DisposeOptions = DisposeOptions.All,
};
if (!maa.Initialized)
throw new InvalidOperationException();
maa.AppendTask("EmptyTask")
.Wait()
.ThrowIfNot(MaaJobStatus.Success);
Console.WriteLine("EmptyTask Completed");
using MaaFramework.Binding.Buffers;
using MaaFramework.Binding.Custom;
var taskName = "MyCustomTask";
var param = $$"""
{
"{{taskName}}": {
"recognition": "Custom",
"custom_recognition": "MyRec",
"custom_recognition_param": {
"my_rec_key": "my_rec_value"
},
"action": "Custom",
"custom_action": "MyAct",
"custom_action_param": {
"my_act_key": "my_act_value"
}
}
}
""";
maa.Register(new MyRec());
maa.Register(new MyAct());
maa.AppendTask(taskName, param)
.Wait()
.ThrowIfNot(MaaJobStatus.Success);
internal sealed class MyRec : IMaaCustomRecognition
{
public string Name { get; set; } = nameof(MyRec);
public bool Analyze(in IMaaSyncContext syncContext, IMaaImageBuffer image, string taskName, string customRecognitionParam, in IMaaRectBuffer outBox, in IMaaStringBuffer outDetail)
{
outBox.SetValues(0, 0, 100, 100);
outDetail.SetValue("Hello World!");
return true;
}
}
internal sealed class MyAct : IMaaCustomAction
{
public string Name { get; set; } = nameof(MyAct);
public void Abort() { }
public bool Run(in IMaaSyncContext syncContext, string taskName, string customActionParam, IMaaRectBuffer curBox, string curRecDetail)
{
return true;
}
}
-
MBA BA Assistant A BA Assistant based on MAA's new architecture. Image technology + simulation control, no more clicking! Powered by MaaFramework.
-
MFAWPF MFA Task Manager A Universal GUI based on MAA's new architecture. Powered by MaaFramework.
-
You can also find more examples in the Unit Tests.
We have written detailed documentation comments in source code files.
You can also visit API Reference and Unit Tests for more information.
If you still intend to use a API Reference specific to your preferred version of MaaFramework.Binding.CSharp, you may refer to the releases page of the project and download the attached docs.zip
file.
We welcome contributions to the MaaFramework.Binding.CSharp. If you find a bug or have a feature request, please open an issue on the GitHub repository. If you want to contribute code, feel free to fork the repository and submit a pull request.
MaaFramework
is open-sourced under the LGPL-3.0
license.
- QQ Group: 595990173