Compare commits

...

43 commits

Author SHA1 Message Date
044d43652a
Merge remote-tracking branch 'github/dependabot/nuget/develop/xunit.runner.visualstudio-2.8.2' into develop
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
2024-07-10 02:40:05 +02:00
dependabot[bot]
7fb6bca1c5
Bump xunit.runner.visualstudio from 2.8.1 to 2.8.2
Bumps xunit.runner.visualstudio from 2.8.1 to 2.8.2.

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 08:36:11 +00:00
dependabot[bot]
b4f45f15b9
Bump xunit from 2.8.1 to 2.9.0
Bumps xunit from 2.8.1 to 2.9.0.

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 08:35:54 +00:00
1ca0a23a4d
Merge remote-tracking branch 'github/dependabot/nuget/develop/xunit.runner.visualstudio-2.8.1' into develop
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
2024-05-27 20:18:32 +02:00
dependabot[bot]
ca2a027c07
Bump xunit from 2.8.0 to 2.8.1
Bumps [xunit](https://github.com/xunit/xunit) from 2.8.0 to 2.8.1.
- [Commits](https://github.com/xunit/xunit/compare/2.8.0...2.8.1)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-27 08:21:28 +00:00
dependabot[bot]
ffdfa8f541
Bump xunit.runner.visualstudio from 2.8.0 to 2.8.1
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.8.0...2.8.1)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-27 08:21:02 +00:00
dependabot[bot]
0b54e7aab2
Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.10.0
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.5.0 to 17.10.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](https://github.com/microsoft/vstest/compare/v17.5.0...v17.10.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 08:11:23 +00:00
531ed2ccfb
Merge remote-tracking branch 'github/dependabot/nuget/develop/xunit.runner.visualstudio-2.8.0' into develop
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
2024-05-03 13:54:17 +02:00
dependabot[bot]
0129fcb5c8
Bump xunit.runner.visualstudio from 2.5.8 to 2.8.0
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.8 to 2.8.0.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.8...2.8.0)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-03 08:18:46 +00:00
dependabot[bot]
68f9440bb4
Bump xunit from 2.7.0 to 2.8.0
Bumps [xunit](https://github.com/xunit/xunit) from 2.7.0 to 2.8.0.
- [Commits](https://github.com/xunit/xunit/compare/2.7.0...2.8.0)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-03 08:18:21 +00:00
ded9db9092
Merge remote-tracking branch 'github/dependabot/nuget/develop/xunit.runner.visualstudio-2.5.8' into develop
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
2024-04-14 11:02:44 +02:00
dependabot[bot]
4f91ab5be0
Bump xunit.runner.visualstudio from 2.5.7 to 2.5.8
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.7 to 2.5.8.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.7...2.5.8)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-12 08:47:37 +00:00
dependabot[bot]
9bfcf9a213
Bump xunit from 2.7.0 to 2.7.1
Bumps [xunit](https://github.com/xunit/xunit) from 2.7.0 to 2.7.1.
- [Commits](https://github.com/xunit/xunit/compare/2.7.0...2.7.1)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-12 08:47:09 +00:00
dependabot[bot]
a66a712421
Bump coverlet.collector from 6.0.1 to 6.0.2
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 08:38:20 +00:00
dependabot[bot]
cacaba167d
Bump coverlet.collector from 3.2.0 to 6.0.1
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 3.2.0 to 6.0.1.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/compare/v3.2.0...v6.0.1)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 08:21:36 +00:00
aecad7e04c
chore: forgejo workflows
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
2024-02-18 23:51:12 +01:00
369d29bdec
Merge remote-tracking branch 'github/dependabot/nuget/develop/xunit.runner.visualstudio-2.5.7' into develop
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
2024-02-16 13:40:20 +01:00
dependabot[bot]
e842412924
Bump xunit from 2.4.2 to 2.7.0
Bumps [xunit](https://github.com/xunit/xunit) from 2.4.2 to 2.7.0.
- [Commits](https://github.com/xunit/xunit/compare/2.4.2...2.7.0)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-16 08:05:52 +00:00
dependabot[bot]
75f6eda1b2
Bump xunit.runner.visualstudio from 2.4.5 to 2.5.7
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.5 to 2.5.7.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/compare/v2.4.5...2.5.7)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-16 08:05:25 +00:00
dependabot[bot]
9609be2db4 Bump coverlet.collector from 3.1.2 to 3.2.0
Some checks failed
Run tests on push / Run tests (push) Has been cancelled
Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 3.1.2 to 3.2.0.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/commits/v3.2.0)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-13 19:11:46 +01:00
dependabot[bot]
7726c92523 Bump vsoch/pull-request-action from 1.0.19 to 1.0.24
Some checks are pending
Run tests on push / Run tests (push) Waiting to run
Bumps [vsoch/pull-request-action](https://github.com/vsoch/pull-request-action) from 1.0.19 to 1.0.24.
- [Release notes](https://github.com/vsoch/pull-request-action/releases)
- [Changelog](https://github.com/vsoch/pull-request-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vsoch/pull-request-action/compare/1.0.19...1.0.24)

---
updated-dependencies:
- dependency-name: vsoch/pull-request-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-13 19:11:20 +01:00
dependabot[bot]
847110e2e9
Bump Microsoft.NET.Test.Sdk from 17.3.0 to 17.5.0
Some checks are pending
Run tests on push / Run tests (push) Waiting to run
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.3.0 to 17.5.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](https://github.com/microsoft/vstest/compare/v17.3.0...v17.5.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-22 08:21:54 +00:00
dependabot[bot]
3328a0480c
Bump Microsoft.NET.Test.Sdk from 17.2.0 to 17.3.0
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.2.0 to 17.3.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Commits](https://github.com/microsoft/vstest/compare/v17.2.0...v17.3.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-11 08:58:01 +00:00
dependabot[bot]
2c66f84544
Bump xunit from 2.4.1 to 2.4.2
Bumps [xunit](https://github.com/xunit/xunit) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/xunit/xunit/releases)
- [Commits](https://github.com/xunit/xunit/compare/2.4.1...2.4.2)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-02 09:00:25 +00:00
d38e2718bb
added command support 2022-07-31 11:39:11 +02:00
6277efd759
docs/logging: fixed method/property typo
fixes #1
2022-07-23 18:44:03 +02:00
alterNERDtive
91665c92d1
Merge pull request #7 from alterNERDtive/feature/auto-pull-request 2022-07-13 21:47:08 +02:00
fb5533dab9
workflows: open pr on branch push 2022-07-13 21:42:06 +02:00
dbfe38dd4d
added System.Net.Http reference for implicit global usings 2022-07-12 23:17:03 +02:00
cf17e985ff
CHANGELOG: updated for missing change 2022-07-12 23:00:43 +02:00
c1abfe5453
docs: updated for variable access warning suppression 2022-07-12 23:00:32 +02:00
cf3d34389d
create-release workflow: author release as myself 2022-07-12 23:00:04 +02:00
7d7cfcb11c
create-release workflow: attack raw files to release 2022-07-12 22:12:09 +02:00
26f4dfa864
added StyleCop.ruleset – silence ALL the warnings! 2022-07-12 21:07:50 +02:00
196e2c43b5
don’t generate nuget pkg on build 2022-07-12 20:41:20 +02:00
6b0bfdd5ee
implicit global usings 2022-07-12 20:40:05 +02:00
9fff380502
slightly broadened the scope 2022-07-11 23:06:03 +02:00
128b976869 added option to suppress race condition warning 2022-07-11 13:02:16 +02:00
45430d50a1 fixed README → docs 2022-07-11 11:29:45 +02:00
alterNERDtive
2212d661be
Merge pull request #3 from alterNERDtive/dependabot/nuget/develop/Microsoft.NET.Test.Sdk-17.2.0 2022-07-11 11:28:25 +02:00
alterNERDtive
e2e308b353
Merge pull request #4 from alterNERDtive/dependabot/nuget/develop/xunit.runner.visualstudio-2.4.5 2022-07-11 11:28:15 +02:00
dependabot[bot]
af9dafddc8
Bump xunit.runner.visualstudio from 2.4.3 to 2.4.5
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.3 to 2.4.5.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/commits)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 09:16:37 +00:00
dependabot[bot]
b18e74e672
Bump Microsoft.NET.Test.Sdk from 17.1.0 to 17.2.0
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.1.0 to 17.2.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Commits](https://github.com/microsoft/vstest/compare/v17.1.0...v17.2.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 09:16:29 +00:00
21 changed files with 453 additions and 37 deletions

View file

@ -0,0 +1,64 @@
name: Create release on tag push
on:
push:
tags:
- 'release/*'
jobs:
build:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install VoiceAttack
uses: alterNERDtive/setup-voiceattack-action@develop
with:
version: "1.10"
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup .Net
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c release
- name: Run tests
run: dotnet test
- name: Create NuGet package
run: dotnet pack -c release "VoiceAttack-Framework/VoiceAttack-Framework.csproj"
- name: Push NuGet package
run: dotnet nuget push "VoiceAttack-Framework/bin/Release/alterNERDtive.YAVAPF.*.nupkg" --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_AUTH_TOKEN}}
- name: Get release body
run: |
echo "release_body=$(cat CHANGELOG.md)" >> "$GITHUB_ENV"
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Draft release
uses: https://gitea.com/actions/release-action@main
with:
body: ${{ env.release_body }}
files: |-
VoiceAttack-Framework/bin/Release/alterNERDtive.YAVAPF.*nupkg
VoiceAttack-Framework/bin/Release/net48/VoiceAttack-Framework.*
draft: true
api_key: '${{ secrets.RELEASE_TOKEN }}'

View file

@ -19,12 +19,12 @@ jobs:
version: "1.10"
- name: Checkout source code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup .Net
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
- name: Restore dependencies
run: dotnet restore
@ -44,6 +44,7 @@ jobs:
- name: Draft release
uses: ncipollo/release-action@v1
with:
artifacts: "VoiceAttack-Framework/bin/Release/alterNERDtive.YAVAPF.*nupkg"
artifacts: "VoiceAttack-Framework/bin/Release/alterNERDtive.YAVAPF.*nupkg,VoiceAttack-Framework/bin/Release/net48/VoiceAttack-Framework.*"
bodyFile: "CHANGELOG.md"
draft: true
token: ${{ secrets.RELEASE_TOKEN }}

View file

@ -1,3 +1,14 @@
# 0.1.0 (2022-07-11)
# devel
## Added
* [Commands interface](https://alternerdtive.github.io/YAVAPF/commands/).
* Optionally suppress the race condition warning on [setting command scoped
variables from the cached proxy
object](https://alternerdtive.github.io/YAVAPF/variables/#using-proxy-methods-vs-using-plugin-methods).
-----
# 0.1.0 (2022-07-11)
initial release

View file

@ -17,8 +17,6 @@
// along with YAVAPF. If not, see &lt;https://www.gnu.org/licenses/&gt;.
// </copyright>
using System;
using alterNERDtive.Yavapf;
using VoiceAttack;
@ -143,6 +141,7 @@ namespace alterNERDtive.Example
/// </summary>
/// <param name="vaProxy">The current VoiceAttack proxy object.</param>
[Init]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Required by plugin API")]
public static void Init(VoiceAttackInitProxyClass vaProxy)
{
Plugin.Log.Notice("This is the example Init handler method.");
@ -155,6 +154,7 @@ namespace alterNERDtive.Example
/// </summary>
/// <param name="vaProxy">The current VoiceAttack proxy object.</param>
[Exit]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Required by plugin API")]
public static void Exit(VoiceAttackProxyClass vaProxy)
{
Plugin.Log.Notice("This is the example Exit handler method.");
@ -206,6 +206,28 @@ namespace alterNERDtive.Example
$"This is the example handler for the plugin contexts “^foo.*” and “^.*bar.*”. It has been invoked with '{vaProxy.Context}'.");
}
/// <summary>
/// An example handler for a context that runs additional VoiceAttack
/// commands.
/// </summary>
/// <param name="vaProxy">The <see cref="VoiceAttackInvokeProxyClass"/>
/// proxy object.</param>
[Context("runcommandtest")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Required by plugin API")]
public static void RunCommandTestContext(VoiceAttackInvokeProxyClass vaProxy)
{
// “Just” runs a command with no further options
Plugin.Commands.Run("test command");
// Runs a command as a subcommand to the current command, and blocks
// until command execution finishes
Plugin.Commands.Run("test command", wait: true, subcommand: true);
Plugin.Commands.Run(
"command with parameters",
parameters: new dynamic[] { new string[] { "foo", "bar" }, new DateTime[] { DateTime.Now } });
}
/// <summary>
/// An example handler for changed <see cref="bool"/> variables. It only
/// applies to the “isDay#” variable.
@ -214,6 +236,7 @@ namespace alterNERDtive.Example
/// <param name="from">The old value of the variable.</param>
/// <param name="to">The new value of the variable.</param>
[Bool("isDay#")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Required by plugin API")]
public static void DayChanged(string name, bool? from, bool? to)
{
Plugin.Log.Notice($"This is the example handler for changed bool variables. It is now {(to ?? false ? "day" : "night")}.");

View file

@ -7,6 +7,8 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
<IsPublishable>False</IsPublishable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
@ -18,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<Reference Include="System.Net.Http" />
<Reference Include="VoiceAttack">
<HintPath>C:\Program Files\VoiceAttack\VoiceAttack.exe</HintPath>
<Private>False</Private>

View file

@ -17,8 +17,6 @@
// along with YAVAPF. If not, see &lt;https://www.gnu.org/licenses/&gt;.
// </copyright>
using System;
using alterNERDtive.Yavapf;
namespace alterNERDtive.Example

View file

@ -17,9 +17,6 @@ the inner workings of VoiceAttack as possible.
You can find [comprehensive documentation on Github
Pages](https://alterNERDtive.github.io/YAVAPF).
Or at least you will once this is in a presentable state and I have actually
written the documentation :)
There is also an [example plugin on
Github](https://github.com/alterNERDtive/YAVAPF/tree/release/ExamplePlugin).

2
StyleCop.ruleset Normal file
View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="StyleCop.Analyzers rules with default action" Description="StyleCop.Analyzers with default action. Rules with IsEnabledByDefault = false are disabled." ToolsVersion="17.0" />

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
@ -6,17 +6,19 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

View file

@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
requirements.txt = requirements.txt
stylecop.json = stylecop.json
StyleCop.ruleset = StyleCop.ruleset
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1BE45F7D-E6DE-49D2-A906-5CC9CD49B639}"
@ -44,8 +45,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3FE46F37-0
docs\contexts.md = docs\contexts.md
docs\events.md = docs\events.md
docs\extra.css = docs\extra.css
docs\gettingstarted.md = docs\gettingstarted.md
docs\faq.md = docs\faq.md
docs\gettingstarted.md = docs\gettingstarted.md
docs\index.md = docs\index.md
docs\logging.md = docs\logging.md
docs\variables.md = docs\variables.md

View file

@ -24,3 +24,4 @@
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "because thats my name", Scope = "namespace", Target = "~N:alterNERDtive.Yavapf")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1011:Closing square brackets should be spaced correctly", Justification = "have to do that to make arrays nullable, fam", Scope = "type", Target = "~T:alterNERDtive.Yavapf.VoiceAttackCommands")]

View file

@ -4,7 +4,7 @@
<TargetFrameworks>net48</TargetFrameworks>
<RootNamespace>alterNERDtive.Yavapf</RootNamespace>
<PackageId>alterNERDtive.YAVAPF</PackageId>
<Version>0.1.0</Version>
<Version>0.2.0</Version>
<Company>alterNERDtive</Company>
<Authors>alterNERDtive</Authors>
<Description>YAVAPF is yet another VoiceAttack plugin framework.</Description>
@ -18,7 +18,7 @@
<PackageTags>VoiceAttack;plugin;framework</PackageTags>
<NeutralLanguage>en</NeutralLanguage>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Title>Yet Another VoiceAttack Plugin Framework</Title>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
@ -26,6 +26,8 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
@ -41,6 +43,7 @@
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
<Reference Include="VoiceAttack">
<HintPath>C:\Program Files\VoiceAttack\VoiceAttack.exe</HintPath>
<Private>False</Private>

View file

@ -0,0 +1,187 @@
// <copyright file="VoiceAttackCommands.cs" company="alterNERDtive">
// Copyright 2022 alterNERDtive.
//
// This file is part of YAVAPF.
//
// YAVAPF is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// YAVAPF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with YAVAPF. If not, see &lt;https://www.gnu.org/licenses/&gt;.
// </copyright>
using VoiceAttack;
namespace alterNERDtive.Yavapf
{
/// <summary>
/// Provides an interface to run VoiceAttack commands from a plugin.
/// </summary>
public class VoiceAttackCommands
{
private readonly VoiceAttackInitProxyClass vaProxy;
private readonly VoiceAttackLog log;
/// <summary>
/// Initializes a new instance of the <see cref="VoiceAttackCommands"/>
/// class.
/// </summary>
/// <param name="vaProxy">The <see cref="VoiceAttackInitProxyClass"/>
/// proxy object.</param>
/// <param name="log">The <see cref="VoiceAttackLog"/> object.</param>
internal VoiceAttackCommands(VoiceAttackInitProxyClass vaProxy, VoiceAttackLog log) => (this.vaProxy, this.log) = (vaProxy, log);
/// <summary>
/// Runs a VoiceAttack command.
/// </summary>
/// <param name="command">The name of the command.</param>
/// <param name="logMissing">Whether or not to log a message if the
/// command in question does not exist in the current profile.</param>
/// <param name="wait">Whether to wait for the command to finish
/// executing before returning.</param>
/// <param name="subcommand">Whether the called command should be run as
/// a subcommand to the current command context.</param>
/// <param name="parameters">The parameters for the command. Has to be
/// an array of arrays, with the inner arrays being of a valid
/// Voiceattack variable type.</param>
/// <exception cref="ArgumentNullException">Thrown if the name of the
/// command is missing.</exception>
public void Run(string command, bool logMissing = true, bool wait = false, bool subcommand = false, dynamic[]? parameters = null)
{
_ = command ?? throw new ArgumentNullException("command");
if (this.vaProxy.Command.Exists(command))
{
this.log.Debug($"Parsing arguments for command '{command}' …");
string[]? strings = null;
int[]? integers = null;
decimal[]? decimals = null;
bool[]? booleans = null;
DateTime[]? dates = null; // this might not work!
foreach (var values in parameters ?? Enumerable.Empty<object>())
{
switch (values)
{
case bool[] b:
booleans = b;
break;
case DateTime[] d:
dates = d;
break;
case decimal[] d:
decimals = d;
break;
case int[] i:
integers = i;
break;
case string[] s:
strings = s;
break;
default:
break;
}
}
this.log.Debug($"Running command '{command}' …");
this.vaProxy.Command.Execute(
CommandPhrase: command,
WaitForReturn: wait,
AsSubcommand: subcommand,
CompletedAction: null,
PassedText: strings == null ? null : $"\"{string.Join<string>("\";\"", strings)}\"",
PassedIntegers: integers == null ? null : string.Join<int>(";", integers),
PassedDecimals: decimals == null ? null : string.Join<decimal>(";", decimals),
PassedBooleans: booleans == null ? null : string.Join<bool>(";", booleans),
PassedDates: dates == null ? null : string.Join<DateTime>(";", dates));
}
else
{
if (logMissing)
{
this.log.Warn($"Tried running missing command '{command}'.");
}
}
}
/// <summary>
/// Runs a VoiceAttack command with a given list of prefixes. Will run
/// `prefix.command` for each prefix.
/// </summary>
/// <param name="prefixes">The list of prefixes.</param>
/// <param name="command">The name of the command.</param>
/// <param name="logMissing">Whether or not to log a message if the
/// command in question does not exist in the current profile.</param>
/// <param name="wait">Whether to wait for the command to finish
/// executing before returning.</param>
/// <param name="subcommand">Whether the called command should be run as
/// a subcommand to the current command context.</param>
/// <param name="parameters">The parameters for the command.</param>
/// <exception cref="ArgumentNullException">Thrown if the name of the
/// command is missing.</exception>
public void RunAll(IEnumerable<string> prefixes, string command, bool logMissing = true, bool wait = false, bool subcommand = false, dynamic[][]? parameters = null)
{
foreach (string prefix in prefixes)
{
this.Run($"{prefix}.{command}", logMissing, wait, subcommand, parameters);
}
}
/// <summary>
/// Runs a VoiceAttack event command. Event commands are enclosed in
/// double paratheses by convention, they will be added automatically.
/// </summary>
/// <param name="name">The name of the event.</param>
/// <param name="logMissing">Whether or not to log a message if the
/// command in question does not exist in the current profile.</param>
/// <param name="wait">Whether to wait for the command to finish
/// executing before returning.</param>
/// <param name="subcommand">Whether the called command should be run as
/// a subcommand to the current command context.</param>
/// <param name="parameters">The parameters for the command. Has to be
/// an array of arrays, with the inner arrays being of a valid
/// Voiceattack variable type.</param>
/// <exception cref="ArgumentNullException">Thrown if the name of the
/// command is missing.</exception>
public void TriggerEvent(string name, bool logMissing = true, bool wait = false, bool subcommand = false, dynamic[]? parameters = null)
{
this.Run($"(({name}))", logMissing, wait, subcommand, parameters);
}
/// <summary>
/// Runs a VoiceAttack event command with a given list of prefixes.
/// Event commands are enclosed in double paratheses by convention, they
/// will be added automatically. Will run `((prefix.name))` for each
/// prefix.
/// </summary>
/// <param name="prefixes">The list of prefixes.</param>
/// <param name="name">The name of the event.</param>
/// <param name="logMissing">Whether or not to log a message if the
/// command in question does not exist in the current profile.</param>
/// <param name="wait">Whether to wait for the command to finish
/// executing before returning.</param>
/// <param name="subcommand">Whether the called command should be run as
/// a subcommand to the current command context.</param>
/// <param name="parameters">The parameters for the command. Has to be
/// an array of arrays, with the inner arrays being of a valid
/// Voiceattack variable type.</param>
/// <exception cref="ArgumentNullException">Thrown if the name of the
/// command is missing.</exception>
public void TriggerEventAll(IEnumerable<string> prefixes, string name, bool logMissing = true, bool wait = false, bool subcommand = false, dynamic[][]? parameters = null)
{
foreach (string prefix in prefixes)
{
this.Run($"(({prefix}.{name}))", logMissing, wait, subcommand, parameters);
}
}
}
}

View file

@ -17,9 +17,6 @@
// along with YAVAPF. If not, see &lt;https://www.gnu.org/licenses/&gt;.
// </copyright>
using System;
using System.IO;
using VoiceAttack;
namespace alterNERDtive.Yavapf

View file

@ -17,8 +17,6 @@
// along with YAVAPF. If not, see &lt;https://www.gnu.org/licenses/&gt;.
// </copyright>
using System;
using VoiceAttack;
namespace alterNERDtive.Yavapf

View file

@ -17,10 +17,6 @@
// along with YAVAPF. If not, see &lt;https://www.gnu.org/licenses/&gt;.
// </copyright>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
@ -33,6 +29,7 @@ namespace alterNERDtive.Yavapf
/// </summary>
public class VoiceAttackPlugin
{
private VoiceAttackCommands? commands;
private VoiceAttackLog? log;
private VoiceAttackInitProxyClass? vaProxy;
@ -120,6 +117,17 @@ namespace alterNERDtive.Yavapf
/// </summary>
protected string? Guid { get; set; }
/// <summary>
/// Gets the <see cref="VoiceAttackCommands"/> instance the plugin uses
/// to run commands.
///
/// You can use this to run your own commands.
/// </summary>
protected VoiceAttackCommands Commands
{
get => this.commands ??= new VoiceAttackCommands(this.Proxy, this.Log);
}
/// <summary>
/// Gets the <see cref="VoiceAttackLog"/> instance the plugin uses to
/// log to the VoiceAttack event log.
@ -139,11 +147,13 @@ namespace alterNERDtive.Yavapf
/// </summary>
/// <typeparam name="T">The type of the variable.</typeparam>
/// <param name="name">The name of the variable.</param>
/// <param name="suppressWarning">Whether to suppress the race condition
/// warning on accessing command scoped variables.</param>
/// <returns>The value of the variable. Can be null.</returns>
/// <exception cref="InvalidDataException">Thrown when the variable is of an invalid type.</exception>
protected T? Get<T>(string name)
protected T? Get<T>(string name, bool suppressWarning = false)
{
if (name.StartsWith("~"))
if (name.StartsWith("~") && !suppressWarning)
{
this.Log.Warn(
$"Accessing command scoped variable '{name}' outside of its context proxy object. This might lead to race conditions.");
@ -161,10 +171,12 @@ namespace alterNERDtive.Yavapf
/// <typeparam name="T">The type of the variable.</typeparam>
/// <param name="name">The name of the variable.</param>
/// <param name="value">The value of the variable. Can not be null.</param>
/// <param name="suppressWarning">Whether to suppress the race condition
/// warning on accessing command scoped variables.</param>
/// <exception cref="InvalidDataException">Thrown when the variable is of an invalid type.</exception>
protected void Set<T>(string name, T? value)
protected void Set<T>(string name, T? value, bool suppressWarning = false)
{
if (name.StartsWith("~"))
if (name.StartsWith("~") && !suppressWarning)
{
this.Log.Warn(
$"Accessing command scoped variable '{name}' outside of its context proxy object. This might lead to race conditions.");
@ -181,10 +193,12 @@ namespace alterNERDtive.Yavapf
/// </summary>
/// <typeparam name="T">The type of the variable.</typeparam>
/// <param name="name">The name of the variable.</param>
/// <param name="suppressWarning">Whether to suppress the race condition
/// warning on accessing command scoped variables.</param>
/// <exception cref="InvalidDataException">Thrown when the variable is of an invalid type.</exception>
protected void Unset<T>(string name)
protected void Unset<T>(string name, bool suppressWarning = false)
{
if (name.StartsWith("~"))
if (name.StartsWith("~") && !suppressWarning)
{
this.Log.Warn(
$"Accessing command scoped variable '{name}' outside of its context proxy object. This might lead to race conditions.");

View file

@ -1,3 +1,93 @@
# Executing VoiceAttack Commands
Not implemented yet.
VoicAttacks plugin API allows you to run commands from your plugin:
```csharp
vaProxy.Command.Execute(
string CommandPhrase,
bool WaitForReturn,
bool AsSubcommand,
Action<Guid?> CompletedAction,
string PassedText,
srting PassedIntegers,
string PassedDecimals,
string PassedBooleans,
string PassedDates);
```
None of those parameters are optional, and the arguments have to be passed as
semicolon delimited strings. With extra hassle around quoting `string`
arguments.
YAVAPF aims to make this API a little more comfortable to work with.
## Running a Command
```csharp
Plugin.Commands.Run(
string command,
bool logMissing = true,
bool wait = false,
bool subcommand = false,
dynamic[]? parameters = null);
```
The main difference here is that all parameters apart from the command name are
now _optional_. You can also now pass arguments to the command as typed arrays:
```csharp
Plugin.Commands.Run(
"example command",
parameters: new dynamic[]
{
new string[] { "text value", "other text value" },
new bool[] { true }
});
```
The ability to pass a callback `Action<Guid?>` is not exposed. The only
information this `Action` can ever receive is the `Guid` of the command that has
been run; setting such a `Guid` in a profile though is a fairly involved
process, and exporting / importing the profile might not even preserve it.
Tl;dr: it is kind of useless right now.
## Running a Command with Prefixes
The `RunAll` method lets you run a command with multiple prefixes. This is
especially useful if your plugin accompanies a set of multiple VoiceAttack
profiles, [like my Elite Dangerous profiles and their correspondingp
plugins](https://alterNERDtive.github.io/VoiceAttack-profiles).
```csharp
Plugin.Commands.RunAll(new string[] { "EliteAttack", "RatAttack" }, "startup", …);
```
Prefixes are prepended to the command name with a dot. The line above would run
the `EliteAttack.startup` and `RatAttack.startup` commands.
## Running an Event
VoiceAttack does not actually have a concept of running commands on events. The
workaround is to have a naming convention for VoiceAttack “event” commands.
YAVAPF borrows the [`((command))` convention from
EDDI](https://github.com/EDCD/EDDI/wiki/VoiceAttack-Integration#running-commands-on-eddi-events).
```csharp
Plugin.Commands.TriggerEvent("some event", …);
```
This would run the `((some event))` command in VoiceAttack. Optional parameters
are the same as for [the `Run` method](commands.md#running-a-command).
## Running an Event with Prefixes
Similar to [`RunAll`](commands.md#running-a-command-with-prefixes),
`TriggerEventAll` exists.
```csharp
Plugin.Commands.TriggerEventAll(new string[] { "profile", "otherprofile" }, "event", …);
```
This would run the `((profile.event))` and `((otherprofile.event))` comands in
VoiceAttack.

View file

@ -23,10 +23,21 @@ Github](https://github.com/alterNERDtive/YAVAPF/tree/release/ExamplePlugin).
* [x] Handlers for variable changed events
* [x] Logging to the VoiceAttack event log
* [ ] Logging to a log file
* [ ] Wrapper for executing commands
* [ ] separate full debug log
* [x] Wrapper for executing commands
* [ ] Plugin options, separate from handling “normal” variables
* [ ] default values
* [ ] descriptions
* [ ] auto save / load between VoiceAttack runs¹
* [ ] profile specific
* [ ] global
* [ ] bootstrapping voice commands for changing options
* [ ] GUI support
* [ ] Miscellaneous VoiceAttack proxy functionality
* [ ] Full unit test coverage 😬
¹ Will probably require changes in VoiceAttack that I have already requested.
## Need Help / Want to Contribute?
Have a look at [the FAQ](faq.md). If your problem persists, please [file an

View file

@ -58,7 +58,7 @@ Its parameter is not case sensitive.
```csharp
Plugin.Log.LogLevel = LogLevel.WARN;
Plugin.Log.SetLogLevel = "info";
Plugin.Log.SetLogLevel("info");
```
You can also set the log level from a VoiceAttack command directly by simply

View file

@ -93,6 +93,19 @@ private static void TestContext(VoiceAttackInvokeProxyClass vaProxy)
}
```
This will log a warning to the VoiceAttack event log.
You can, if you are sure that you will _not_ run into a race condition, suppress
said warning:
```csharp
[Context("test")]
private static void TestContext(VoiceAttackInvokeProxyClass vaProxy)
{
string test = Plugin.Get<string>("~test", suppressWarning: true);
}
```
## Getting Variable Values
To get the value of a variable, invoke the `Get<T>(string name)` method of your