Compare commits

...

18 commits

Author SHA1 Message Date
001ddbb992
workflows: mark issues done on PR 2022-07-23 18:46:04 +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
17 changed files with 99 additions and 28 deletions

View file

@ -0,0 +1,20 @@
name: Pull Request on Branch Push
on:
push:
branches-ignore:
- develop
- release
jobs:
auto-pull-request:
name: Open pull request
runs-on: ubuntu-latest
steps:
- name: pull-request-action
uses: vsoch/pull-request-action@1.0.19
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_BRANCH: "develop"
PULL_REQUEST_DRAFT: true
PASS_IF_EXISTS: true

View file

@ -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 }}

16
.github/workflows/mark-issues-done.yaml vendored Normal file
View file

@ -0,0 +1,16 @@
name: Update issues on PR close
on:
pull_request:
types:
- closed
jobs:
run:
name: "Mark issues done"
runs-on: ubuntu-latest
steps:
- name: Update Labels
uses: RebeccaStevens/issue-closed-labeler-action@latest
with:
rules: '[{"add": "Done"}]'

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;

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

@ -10,9 +10,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<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}"

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

@ -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;
@ -139,11 +135,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 +159,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 +181,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

@ -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
* [ ] separate full debug log
* [ ] 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

@ -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