Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.5.0 #165

Merged
merged 13 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace _StreamDeckPlugin_
{
[ActionUuid(Uuid="$(UUID)")]
[ActionUuid(Uuid="$(UUID).DefaultPluginAction")]
public class $(PluginName)Action : BaseStreamDeckActionWithSettingsModel<Models.CounterSettingsModel>
{
public override async Task OnKeyUp(StreamDeckEventPayload args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<!-- When building/running on Windows -->
<RuntimeIdentifier Condition=" '$(OS)' == 'Windows_NT' and '$(Configuration)'=='Debug' ">win-x64</RuntimeIdentifier>
Expand Down Expand Up @@ -38,7 +38,7 @@
<!--Deployment files that must go with the build executable -->
<ItemGroup>
<Content Include="manifest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand All @@ -65,6 +65,12 @@
<Content Include="images/pluginIcon@2x.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images/category/categoryIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images/category/categoryIcon@2x.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images/Fritz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"Category": "Your Plugin Category",
"CategoryIcon": "images/category/categoryIcon.png",
"CategoryIcon": "images/category/categoryIcon",
"Disabled": false,
"Author": "Your Name",
"CodePathWin": "_StreamDeckPlugin_.exe",
Expand Down
4 changes: 2 additions & 2 deletions Templates/StreamDeck.PluginTemplate.Csharp/global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.201"
"version": "5.0.100"
}
}
}
8 changes: 8 additions & 0 deletions src/SampleDIPlugin/SampleDIPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<None Remove="images\actionDefaultImage@2x.png" />
<None Remove="images\actionIcon.png" />
<None Remove="images\actionIcon@2x.png" />
<None Remove="images\category\categoryIcon%402x.png" />
<None Remove="images\category\categoryIcon.png" />
<None Remove="images\Fritz.png" />
<None Remove="images\pluginIcon.png" />
<None Remove="images\pluginIcon@2x.png" />
Expand Down Expand Up @@ -41,6 +43,12 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Include="images\category\categoryIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\category\categoryIcon@2x.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\Fritz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
Expand Down
2 changes: 1 addition & 1 deletion src/SampleDIPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
],
"Category": "Fritz & Friends",
"CategoryIcon": "images/category/categoryIcon.png",
"CategoryIcon": "images/category/categoryIcon",
"Disabled": false,
"Author": "Jeffrey T. Fritz",
"CodePathWin": "SamplePlugin.cmd",
Expand Down
10 changes: 9 additions & 1 deletion src/SamplePlugin/SamplePlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<RuntimeIdentifier Condition=" '$(OS)' == 'Windows_NT' and '$(Configuration)'=='Debug' ">win-x64</RuntimeIdentifier> <!-- When building/running on Windows -->
<RuntimeIdentifier Condition=" '$(OS)' != 'Windows_NT' and '$(Configuration)'=='Debug' ">osx-x64</RuntimeIdentifier> <!-- When on non-Windows environment, assume macOS for now -->
Expand All @@ -11,6 +11,8 @@
</PropertyGroup>
<ItemGroup>
<None Remove="Fritz.png" />
<None Remove="images\category\categoryIcon%402x.png" />
<None Remove="images\category\categoryIcon.png" />
<None Remove="property_inspector\css\property-inspector.css" />
<None Remove="property_inspector\css\sdpi.css" />
<None Remove="property_inspector\js\property-inspector.js" />
Expand Down Expand Up @@ -52,6 +54,12 @@
<Content Include="images/Fritz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\category\categoryIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\category\categoryIcon@2x.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="manifest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
2 changes: 1 addition & 1 deletion src/SamplePlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
],
"Category": "Fritz & Friends",
"CategoryIcon": "images/category/categoryIcon.png",
"CategoryIcon": "images/category/categoryIcon",
"Disabled": false,
"Author": "Jeffrey T. Fritz",
"CodePathWin": "SamplePlugin.cmd",
Expand Down
8 changes: 8 additions & 0 deletions src/SampleWebPlugin/SampleWebPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<None Remove="images\actionDefaultImage@2x.png" />
<None Remove="images\actionIcon.png" />
<None Remove="images\actionIcon@2x.png" />
<None Remove="images\category\categoryIcon%402x.png" />
<None Remove="images\category\categoryIcon.png" />
<None Remove="images\Fritz.png" />
<None Remove="images\pluginIcon.png" />
<None Remove="images\pluginIcon@2x.png" />
Expand All @@ -35,6 +37,12 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Include="images\category\categoryIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\category\categoryIcon@2x.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\Fritz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
Expand Down
2 changes: 1 addition & 1 deletion src/SampleWebPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
],
"Category": "Fritz & Friends",
"CategoryIcon": "images/category/categoryIcon.png",
"CategoryIcon": "images/category/categoryIcon",
"Disabled": false,
"Author": "Jeffrey T. Fritz",
"CodePathWin": "SamplePlugin.cmd",
Expand Down
2 changes: 1 addition & 1 deletion src/StreamDeckLib.Config/StreamDeckLib.Config.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/StreamDeckLib.Test/StreamDeckLib.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand Down
10 changes: 7 additions & 3 deletions src/StreamDeckLib/ActionManager.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using System;
Expand All @@ -24,6 +25,8 @@ public partial class ActionManager : IDisposable
// The logger we will receive when being instantiated. Defaults to a NullLogger is none is specified.
private readonly ILogger<ActionManager> _Logger;

private readonly IServiceProvider _serviceProvider;

#endregion


Expand All @@ -39,9 +42,10 @@ private ActionManager()
/// Initializes a new instance of the <see cref="T:StreamDeckLib.ActionManager"/> class.
/// </summary>
/// <param name="logger">An instance of a logger (<see cref="ILogger"/> class.</param>
public ActionManager(ILogger<ActionManager> logger = null) : this()
public ActionManager(ILogger<ActionManager> logger = null, IServiceProvider serviceProvider = null) : this()
{
this._Logger = logger ?? NullLoggerFactory.Instance.CreateLogger<ActionManager>();
this._serviceProvider = serviceProvider;
}

#endregion
Expand Down Expand Up @@ -140,7 +144,7 @@ public TActionType GetActionInstance<TActionType>(ConnectionManager connectionMa

if (this._Actions.ContainsKey(actionUUID))
{
var instance = Activator.CreateInstance(this._Actions[actionUUID]) as TActionType;
var instance = ActivatorUtilities.CreateInstance(this._serviceProvider, this._Actions[actionUUID]) as TActionType;
instance.Logger = _Logger;
instance.Manager = connectionManager;
return instance;
Expand Down Expand Up @@ -187,7 +191,7 @@ private BaseStreamDeckAction CreateActionInstanceByUUID(ConnectionManager connec
this._Logger?.LogTrace($"{nameof(ActionManager)}.{nameof(CreateActionInstanceByUUID)}(string, bool)");
if (this._Actions.ContainsKey(actionUuid))
{
var instance = Activator.CreateInstance(this._Actions[actionUuid]) as BaseStreamDeckAction;
var instance = ActivatorUtilities.CreateInstance(this._serviceProvider, this._Actions[actionUuid]) as BaseStreamDeckAction;
instance.Logger = _Logger;
instance.Manager = connectionManager;
return instance;
Expand Down
22 changes: 14 additions & 8 deletions src/StreamDeckLib/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ public ConnectionManager(IOptions<StreamDeckToolkitOptions> options, ActionManag
_ActionManager = actionManager;
_logger = logger;

var myInfo = JsonConvert.DeserializeObject<Info>(options.Value.Info);
Info = myInfo;
_port = options.Value.Port;
_uuid = options.Value.PluginUUID;
_registerEvent = options.Value.RegisterEvent;
_proxy = streamDeckProxy;
if (options.Value != null)
{
if (!string.IsNullOrEmpty(options.Value.Info))
{
var myInfo = JsonConvert.DeserializeObject<Info>(options.Value.Info);
Info = myInfo;
}
_port = options.Value.Port;
_uuid = options.Value.PluginUUID;
_registerEvent = options.Value.RegisterEvent;
}
_proxy = streamDeckProxy ?? new StreamDeckProxy();
}

private ConnectionManager(StreamDeckToolkitOptions options, ILoggerFactory loggerFactory = null, IStreamDeckProxy streamDeckProxy = null) : this()
Expand All @@ -55,7 +61,7 @@ private ConnectionManager(StreamDeckToolkitOptions options, ILoggerFactory logge
_port = options.Port;
_uuid = options.PluginUUID;
_registerEvent = options.RegisterEvent;
_proxy = streamDeckProxy;
_proxy = streamDeckProxy ?? new StreamDeckProxy();

_LoggerFactory = loggerFactory ?? NullLoggerFactory.Instance;
_logger = loggerFactory?.CreateLogger<ConnectionManager>();
Expand Down Expand Up @@ -164,7 +170,7 @@ private async Task Run(CancellationToken token)

var jsonString = await _proxy.GetMessageAsString(token);

if (!string.IsNullOrEmpty(jsonString) && !jsonString.StartsWith("\0"))
if (!string.IsNullOrEmpty(jsonString) && !jsonString.StartsWith("\u0000", StringComparison.OrdinalIgnoreCase))
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/StreamDeckLib/StreamDeckLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>0.3.0-preview</Version>
<Version>0.5.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down