Very Atomic Commit™

This commit is contained in:
alterNERDtive 2022-07-09 16:33:32 +02:00
parent aa92689f51
commit 678f5d3aab
13 changed files with 165 additions and 45 deletions

View file

@ -34,11 +34,11 @@ jobs:
run: dotnet pack -c release
- name: Push NuGet package
run: dotnet nuget push "FIXXME/bin/Release/alterNERDtive.YAVAPF.*.nupkg" -source 'https://api.nuget.org/v3/index.json' -apikey ${{secrets.NUGET_AUTH_TOKEN}}
run: dotnet nuget push "VoiceAttack-Framework/bin/Release/alterNERDtive.YAVAPF.*.nupkg" -source 'https://api.nuget.org/v3/index.json' -apikey ${{secrets.NUGET_AUTH_TOKEN}}
- name: Draft release
uses: ncipollo/release-action@v1
with:
artifacts: "FIXXME/bin/Release/alterNERDtive.YAVAPF.*.nupkg"
artifacts: "VoiceAttack-Framework/bin/Release/alterNERDtive.YAVAPF.*nupkg"
bodyFile: "CHANGELOG.md"
draft: true

View file

@ -1,11 +1,11 @@
name: Run tests on push push
name: Run tests on push
on:
push
jobs:
build:
name: Test EDNA
name: Run tests
runs-on: windows-latest
permissions:
contents: write

View file

@ -230,7 +230,7 @@ namespace alterNERDtive.Yavapf.Example
[String]
public static void StringChanged(string name, string? from, string? to, Guid? internalID)
{
Plugin.Log.Notice($"This is the example handler for changed string variables. '{name}' changed from '{from ?? "Not Set"}' to '{to}'.");
Plugin.Log.Notice($"This is the example handler for changed string variables. '{name}' changed from '{from ?? "Not Set"}' to '{to ?? "Not Set"}'.");
}
}
}

View file

@ -4,6 +4,8 @@
<TargetFramework>net48</TargetFramework>
<RootNamespace>alterNERDtive.Yavapf.Example</RootNamespace>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>

View file

@ -1,8 +1,26 @@
// This file is used by Code Analysis to maintain SuppressMessage
// <copyright file="GlobalSuppressions.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>
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Its my name, you prick :)", Scope = "namespace", Target = "~N:alterNERDtive.Yavapf.Example")]

View file

@ -0,0 +1 @@
global using Xunit;

View file

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<RootNamespace>VoiceAttack_Framework_Test</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<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">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>

View file

@ -0,0 +1,29 @@
// <copyright file="VoiceAttackLogTest.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>
namespace VoiceAttack_Framework_Test
{
public class VoiceAttackLogTest
{
[Fact]
public void Test1()
{
}
}
}

View file

@ -0,0 +1,25 @@
// <copyright file="VoiceAttackPluginTest.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>
namespace VoiceAttack_Framework_Test
{
internal class VoiceAttackPluginTest
{
}
}

View file

@ -48,6 +48,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3FE46F37-0
docs\variables.md = docs\variables.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoiceAttack-Framework-Test", "VoiceAttack-Framework-Test\VoiceAttack-Framework-Test.csproj", "{D49B2D9A-1014-4554-977A-E57E9972D196}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -62,6 +64,10 @@ Global
{E390356B-4039-4364-B49C-38A37046A7BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E390356B-4039-4364-B49C-38A37046A7BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E390356B-4039-4364-B49C-38A37046A7BD}.Release|Any CPU.Build.0 = Release|Any CPU
{D49B2D9A-1014-4554-977A-E57E9972D196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D49B2D9A-1014-4554-977A-E57E9972D196}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D49B2D9A-1014-4554-977A-E57E9972D196}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D49B2D9A-1014-4554-977A-E57E9972D196}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,8 +1,26 @@
// This file is used by Code Analysis to maintain SuppressMessage
// <copyright file="GlobalSuppressions.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>
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
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")]

View file

@ -24,6 +24,8 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>

View file

@ -265,50 +265,32 @@ namespace alterNERDtive.Yavapf
this.vaProxy.IntegerVariableChanged += this.IntegerVariableChanged;
this.vaProxy.TextVariableChanged += this.TextVariableChanged;
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<InitAttribute>().Any()).ToList())
{
this.InitActions += (Action<VoiceAttackInitProxyClass>)m.CreateDelegate(typeof(Action<VoiceAttackInitProxyClass>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<InitAttribute>().Any()).ToList().ForEach(
m => this.InitActions += (Action<VoiceAttackInitProxyClass>)m.CreateDelegate(typeof(Action<VoiceAttackInitProxyClass>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<ExitAttribute>().Any()).ToList())
{
this.ExitActions += (Action<VoiceAttackProxyClass>)m.CreateDelegate(typeof(Action<VoiceAttackProxyClass>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<ExitAttribute>().Any()).ToList().ForEach(
m => this.ExitActions += (Action<VoiceAttackProxyClass>)m.CreateDelegate(typeof(Action<VoiceAttackProxyClass>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<StopAttribute>().Any()).ToList())
{
this.StopActions += (Action)m.CreateDelegate(typeof(Action));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<StopAttribute>().Any()).ToList().ForEach(
m => this.StopActions += (Action)m.CreateDelegate(typeof(Action)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<ContextAttribute>().Any()).ToList())
{
this.Contexts += (Action<VoiceAttackInvokeProxyClass>)m.CreateDelegate(typeof(Action<VoiceAttackInvokeProxyClass>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<ContextAttribute>().Any()).ToList().ForEach(
m => this.Contexts += (Action<VoiceAttackInvokeProxyClass>)m.CreateDelegate(typeof(Action<VoiceAttackInvokeProxyClass>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<BoolAttribute>().Any()).ToList())
{
this.BoolChangedHandlers += (Action<string, bool?, bool?, Guid?>)m.CreateDelegate(typeof(Action<string, bool?, bool?, Guid?>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<BoolAttribute>().Any()).ToList().ForEach(
m => this.BoolChangedHandlers += (Action<string, bool?, bool?, Guid?>)m.CreateDelegate(typeof(Action<string, bool?, bool?, Guid?>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<DateTimeAttribute>().Any()).ToList())
{
this.DateTimeChangedHandlers += (Action<string, DateTime?, DateTime?, Guid?>)m.CreateDelegate(typeof(Action<string, DateTime?, DateTime?, Guid?>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<DateTimeAttribute>().Any()).ToList().ForEach(
m => this.DateTimeChangedHandlers += (Action<string, DateTime?, DateTime?, Guid?>)m.CreateDelegate(typeof(Action<string, DateTime?, DateTime?, Guid?>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<DecimalAttribute>().Any()).ToList())
{
this.DecimalChangedHandlers += (Action<string, decimal?, decimal?, Guid?>)m.CreateDelegate(typeof(Action<string, decimal?, decimal?, Guid?>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<DecimalAttribute>().Any()).ToList().ForEach(
m => this.DecimalChangedHandlers += (Action<string, decimal?, decimal?, Guid?>)m.CreateDelegate(typeof(Action<string, decimal?, decimal?, Guid?>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<IntAttribute>().Any()).ToList())
{
this.IntChangedHandlers += (Action<string, int?, int?, Guid?>)m.CreateDelegate(typeof(Action<string, int?, int?, Guid?>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<IntAttribute>().Any()).ToList().ForEach(
m => this.IntChangedHandlers += (Action<string, int?, int?, Guid?>)m.CreateDelegate(typeof(Action<string, int?, int?, Guid?>)));
foreach (MethodInfo m in this.GetType().GetMethods().Where(m => m.GetCustomAttributes<StringAttribute>().Any()).ToList())
{
this.StringChangedHandlers += (Action<string, string?, string?, Guid?>)m.CreateDelegate(typeof(Action<string, string?, string?, Guid?>));
}
this.GetType().GetMethods().Where(m => m.GetCustomAttributes<StringAttribute>().Any()).ToList().ForEach(
m => this.StringChangedHandlers += (Action<string, string?, string?, Guid?>)m.CreateDelegate(typeof(Action<string, string?, string?, Guid?>)));
this.Log.Debug("Running Init handlers …");
this.InitActions?.Invoke(vaProxy);
@ -516,12 +498,24 @@ namespace alterNERDtive.Yavapf
/// <typeparam name="T">The type of the list.</typeparam>
protected class HandlerList<T> : List<T>
{
/// <summary>
/// Adds a handler to the list.
/// </summary>
/// <param name="handlers">The list to add to.</param>
/// <param name="item">The handler to add.</param>
/// <returns>The sum of both.</returns>
public static HandlerList<T> operator +(HandlerList<T> handlers, T item)
{
handlers.Add(item);
return handlers;
}
/// <summary>
/// Removes a handler from the list.
/// </summary>
/// <param name="handlers">The list to remove from.</param>
/// <param name="item">The handler to remove.</param>
/// <returns>The list without the handler.</returns>
public static HandlerList<T> operator -(HandlerList<T> handlers, T item)
{
handlers.Remove(item);