Skip to content

Commit

Permalink
Merge branch 'release/0.4.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Reynolds committed Feb 27, 2022
2 parents 6c857c5 + f89c51c commit c9bd934
Show file tree
Hide file tree
Showing 44 changed files with 812 additions and 687 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET 5 CI build
name: .NET 6 CI build

on:
push:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
dotnet-version: 6.0.101
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/develop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
dotnet-version: 6.0.101

- name: Test
run: dotnet test --configuration Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
dotnet-version: 6.0.101

- name: Test
run: dotnet test --configuration Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
dotnet-version: 6.0.101

- name: Test
run: dotnet test --configuration Release
Expand Down
15 changes: 0 additions & 15 deletions Configuration/Comparator.cs

This file was deleted.

101 changes: 0 additions & 101 deletions Configuration/Config.cs

This file was deleted.

7 changes: 6 additions & 1 deletion Configuration/Configuration.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,4 +17,8 @@
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions Configuration/Configuration/ViLA.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/charliefoxtwo/ViLA/main/Configuration/Schema/ActionConfiguration.json.schema",
"logLevel": "information",
"$schema": "https://raw.githubusercontent.com/charliefoxtwo/ViLA/main/Configuration/Schema/ViLAConfiguration.json.schema",
"logLevel": "INFORMATION",
"checkUpdates": true,
"checkPrerelease": false,
"disabledPlugins": [ ]
}
}
34 changes: 34 additions & 0 deletions Configuration/DeviceConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable ClassNeverInstantiated.Global
#pragma warning disable 8618

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Core;
using Newtonsoft.Json;
using Virpil.Communicator;

namespace Configuration;

public class DeviceConfiguration
{
public BaseTrigger? Trigger { get; set; }
public Dictionary<string, Device>? Devices { get; set; }

public static Dictionary<string, DeviceConfiguration?> GetDeviceConfigurations()
{
return Directory.EnumerateFiles("Configuration", "*.json", SearchOption.AllDirectories)
.Select(f => new KeyValuePair<string, DeviceConfiguration?>(f.Split('/').Last(), JsonConvert.DeserializeObject<DeviceConfiguration>(File.ReadAllText(f))))
.Where(kvp => kvp.Key != "ViLA.json")
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
}
}

public class Device : Dictionary<BoardType, BoardActions>
{
}

public class BoardActions : Dictionary<int, List<LedAction>>
{
}
16 changes: 9 additions & 7 deletions Configuration/LedAction.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable ClassNeverInstantiated.Global

using Core;

#pragma warning disable 8618

namespace Configuration
namespace Configuration;

public class LedAction
{
public class LedAction
{
public string Color { get; set; }
public Trigger Trigger { get; set; }
}
}
public string Color { get; set; }
public BaseTrigger Trigger { get; set; }
}
71 changes: 42 additions & 29 deletions Configuration/Schema/ActionConfiguration.json.schema
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"title": "LED Action",
"description": "An action to take for a USB LED",
"type": "array",

"definitions": {
"action": {
"title": "Action",
Expand All @@ -29,16 +29,30 @@
},
"value": {
"description": "The fixed value to compare the sent value to",
"type": ["number", "string", "boolean"]
"oneOf": [
{"type": "number"},
{"type": "string"},
{"type": "boolean"},
{"$ref": "#/definitions/ledAction/definitions/action/definitions/trigger"},
{"type": "array", "items": {"$ref": "#/definitions/ledAction/definitions/action/definitions/trigger"}}
]
},
"comparator": {
"description": "The method to compare the dcs-bios value with. The equation should read as 'biosValue comparator value'",
"type": "string",
"enum": ["None", "GreaterThan", "LessThan", "EqualTo", "NotEqualTo", "GreaterThanOrEqualTo", "LessThanOrEqualTo", "RegexMatch", "RegexNoMatch"]
"enum": ["None", "GreaterThan", "LessThan", "EqualTo", "NotEqualTo", "GreaterThanOrEqualTo", "LessThanOrEqualTo", "RegexMatch", "RegexNoMatch", "And", "Or", "Xor", "Not"]
}
},
"additionalProperties": false,
"allOf": [
{
"if": {
"required": ["id"]
},
"then": {
"required": ["value", "comparator"]
}
},
{
"if": {
"properties": { "value": { "type": "number" } },
Expand Down Expand Up @@ -69,16 +83,35 @@
"required": ["id", "value", "comparator"]
}
},
{
"if": {
"properties": { "value": { "$ref": "#/definitions/ledAction/definitions/action/definitions/trigger" } },
"required": ["value"]
},
"then": {
"properties": { "comparator": { "enum": ["Not"] } },
"required": ["value", "comparator"]
}
},
{
"if": {
"properties": { "value": { "type": "array", "items": {"$ref": "#/definitions/ledAction/definitions/action/definitions/trigger"}}},
"required": ["value"]
},
"then": {
"properties": { "comparator": { "enum": ["And", "Or", "Xor"] } },
"required": ["value", "comparator"]
}
},
{
"if": {
"required": ["comparator"]
},
"then": {
"required": ["id", "value", "comparator"]
"required": ["value", "comparator"]
}
}
],
"required": ["id"]
]
}
},

Expand All @@ -105,28 +138,8 @@
},

"properties": {
"logLevel": {
"description": "The level to log at",
"type": "string",
"enum": ["NONE", "TRACE", "DEBUG", "INFORMATION", "WARNING", "ERROR", "CRITICAL"]
},
"checkUpdates": {
"description": "Determines whether or not the application should check for plugin updates on start.",
"type": "boolean",
"default": true
},
"checkPrerelease": {
"description": "Determines whether or not the application should consider prerelease plugin releases when checking for updates.",
"type": "boolean",
"default": false
},
"disabledPlugins": {
"description": "Plugins which should not be loaded on the next run.",
"type": "array",
"items": {
"type": "string"
},
"examples": [[ "DcsBiosReader.dll", "SamplePlugin.dll" ]]
"trigger": {
"$ref": "#/definitions/ledAction/definitions/action/definitions/trigger"
},
"devices": {
"description": "All devices and device actions go here. The key is the device's USB PID.",
Expand Down Expand Up @@ -174,4 +187,4 @@
},

"required": ["devices"]
}
}
Loading

0 comments on commit c9bd934

Please sign in to comment.