Compare commits

..

8 Commits

Author SHA1 Message Date
Trevor Payne
1374afa2bb feature: add deveasy command to make DevJson easier in the development process 2023-07-12 07:11:47 -05:00
Andrew Welker
e1ce35863f Merge pull request #1109 from PepperDash/release/1.14.0
Release/1.14.0
2023-06-07 10:11:49 -06:00
Andrew Welker
08514915b2 Merge branch 'main' into release/1.14.0 2023-05-09 10:22:08 -06:00
Andrew Welker
ea464038b9 Merge pull request #1106 from PepperDash/hotfix/remove-old-workflow
Hotfix/remove old workflow
2023-04-27 13:13:37 -06:00
Andrew Welker
c4c44d02f5 Merge branch 'development' into hotfix/remove-old-workflow 2023-04-27 12:54:18 -06:00
Andrew Welker
3fe5d89904 Merge pull request #1105 from PepperDash/hotfix/remove-old-workflow
Delete add-issues-to-project.yml
2023-04-27 12:54:08 -06:00
Jason T Alborough
c0d78e8978 Delete add-issues-to-project.yml 2023-04-27 13:59:36 -04:00
Andrew Welker
432934ad00 Merge pull request #1103 from PepperDash/hotfix/dm-build-issues
Enable DM TX/RX builds for blade chassis
2023-04-27 09:55:08 -06:00
3 changed files with 53 additions and 37 deletions

View File

@@ -1,37 +0,0 @@
name: Add bugs to bugs project
on:
issues:
types:
- opened
- labeled
jobs:
check-secret:
runs-on: ubuntu-latest
outputs:
my-key: ${{ steps.my-key.outputs.defined }}
steps:
- id: my-key
if: "${{ env.MY_KEY != '' }}"
run: echo "::set-output name=defined::true"
env:
MY_KEY: ${{ secrets.PROJECT_URL }}
throw-error:
name: Check
runs-on: ubuntu-latest
needs: [check-secret]
if: needs.check-secret.outputs.my-key != 'true'
steps:
- run: echo "The Project URL Repo Secret is empty"
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
needs: [check-secret]
if: needs.check-secret.outputs.my-key == 'true'
steps:
- uses: actions/add-to-project@main
with:
project-url: ${{ secrets.PROJECT_URL }}
github-token: ${{ secrets.GH_PROJECTS_PASSWORD }}

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json;
@@ -38,6 +39,53 @@ namespace PepperDash.Essentials.Core
}
}
private const string ParamsPattern = @"(?<=\[).*?(?=])";
private const string DevKeySpacePattern = @"(?<=\().*?(?=\))";
private const string MethodStringPattern = @"(?<=\)\s).*?(?=\s)";
private static readonly Regex ParamsRegex = new Regex(ParamsPattern);
private static readonly Regex DevKeySpaceRegex = new Regex(DevKeySpacePattern);
private static readonly Regex MethodStringRegex = new Regex(MethodStringPattern);
public static void BuildJsonForDeviceAction(string cmd)
{
if (String.IsNullOrEmpty(cmd))
{
CrestronConsole.ConsoleCommandResponse(
"Please provide some data matching the format '<deviceKey> <methodName> [parameters]' The parameters support strings, numbers, and booleans, and are optional. If your device key has spaces in it, wrap it in parenthesis");
}
try
{
var paramsMatch = ParamsRegex.Match(cmd);
var devKeySpaceMatch = DevKeySpaceRegex.Match(cmd);
var methodStringMatch = MethodStringRegex.Match(cmd);
var deviceString = devKeySpaceMatch.Value ?? string.Empty;
var methodString = methodStringMatch.Value ?? string.Empty;
var cmdParts = cmd.Split(' ');
if (cmdParts.Length <= 1)
{
CrestronConsole.ConsoleCommandResponse("Malformed 'deveasy' command - not enough arguments");
return;
}
deviceString = String.IsNullOrEmpty(deviceString) ? cmdParts[0] : deviceString;
methodString = String.IsNullOrEmpty(methodString) ? cmdParts[1] : methodString;
var action = new DeviceActionWrapper()
{
DeviceKey = deviceString,
MethodName = methodString,
Params = (paramsMatch != null) ? new object[] { paramsMatch.Value } : new object[] { }
};
DoDeviceAction(action);
}
catch (Exception ex)
{
CrestronConsole.ConsoleCommandResponse("Malformed 'deveasy' command - consult command help.");
}
}
/// <summary>

View File

@@ -39,8 +39,13 @@ namespace PepperDash.Essentials.Core
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.BuildJsonForDeviceAction, "deveasy",
"Easier way to build devjson commands",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.DoDeviceActionWithJson, "devjson", "",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s)), "devprops", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s)), "devmethods", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);