Skip to content

Commit

Permalink
Updated to new Harmony library and .NET version, and changed command …
Browse files Browse the repository at this point in the history
…send to use the key press instead of raw sendcommand
  • Loading branch information
i8beef committed Feb 16, 2018
1 parent ae7fdac commit af56107
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
32 changes: 16 additions & 16 deletions src/HomeAutio.Mqtt.Harmony/App.config
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<appSettings>
<add key="brokerIp" value="192.168.1.152" />
<add key="brokerPort" value="1883" />
<add key="brokerUsername" value="" />
<add key="brokerPassword" value="" />
<add key="brokerIp" value="192.168.1.152"/>
<add key="brokerPort" value="1883"/>
<add key="brokerUsername" value=""/>
<add key="brokerPassword" value=""/>

<add key="harmonyIp" value="192.168.1.113" />
<add key="harmonyName" value="default" />
<add key="harmonyUsername" value="" />
<add key="harmonyPassword" value="" />
<add key="harmonyIp" value="192.168.1.113"/>
<add key="harmonyName" value="default"/>
<add key="harmonyUsername" value=""/>
<add key="harmonyPassword" value=""/>
<add key="bypassLogitechLogin" value="true"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<variable name="logDirectory" value="${basedir}/logs" />
<variable name="logDirectory" value="${basedir}/logs"/>
<targets>
<target name="file" xsi:type="File" fileName="${logDirectory}/${shortdate}.txt" />
<target name="console" xsi:type="Console" />
<target name="file" xsi:type="File" fileName="${logDirectory}/${shortdate}.txt"/>
<target name="console" xsi:type="Console"/>
</targets>
<rules>
<logger name="*" minLevel="Debug" appendTo="file,console" />
<logger name="*" minLevel="Debug" appendTo="file,console"/>
</rules>
</nlog>
</configuration>
</configuration>
2 changes: 1 addition & 1 deletion src/HomeAutio.Mqtt.Harmony/HarmonyMqttService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected override void Mqtt_MqttMsgPublishReceived(object sender, MqttMsgPublis
{
var command = _topicActionMap[e.Topic];
if (command != null)
_client.SendCommandAsync(command);
_client.SendKeyPressAsync(command).GetAwaiter().GetResult();
}
}

Expand Down
31 changes: 17 additions & 14 deletions src/HomeAutio.Mqtt.Harmony/HomeAutio.Mqtt.Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HomeAutio.Mqtt.Harmony</RootNamespace>
<AssemblyName>HomeAutio.Mqtt.Harmony</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -34,13 +37,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Label="I8Beef.CodeAnalysis.RuleSet">
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>$(SolutionDir)packages/I8Beef.CodeAnalysis.RuleSet.1.0.10/tools/I8Beef.CodeAnalysis.RuleSet.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="HarmonyHub, Version=2.0.0.39, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HarmonyHub.2.0.0.39\lib\net452\HarmonyHub.dll</HintPath>
<Reference Include="HarmonyHub, Version=3.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HarmonyHub.3.0.0.1\lib\netstandard2.0\HarmonyHub.dll</HintPath>
</Reference>
<Reference Include="HomeAutio.Mqtt.Core, Version=1.0.0.22, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HomeAutio.Mqtt.Core.1.0.0.22\lib\net452\HomeAutio.Mqtt.Core.dll</HintPath>
Expand All @@ -53,7 +52,7 @@
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.4.11\lib\net45\NLog.dll</HintPath>
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
Expand All @@ -79,19 +78,23 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)packages/I8Beef.CodeAnalysis.RuleSet.1.0.10/tools/stylecop.json" Label="I8Beef.CodeAnalysis.RuleSet">
<Link>stylecop.json</Link>
</AdditionalFiles>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\I8Beef.CodeAnalysis.RuleSet.1.0.11\build\I8Beef.CodeAnalysis.RuleSet.targets" Condition="Exists('..\packages\I8Beef.CodeAnalysis.RuleSet.1.0.11\build\I8Beef.CodeAnalysis.RuleSet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\I8Beef.CodeAnalysis.RuleSet.1.0.11\build\I8Beef.CodeAnalysis.RuleSet.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\I8Beef.CodeAnalysis.RuleSet.1.0.11\build\I8Beef.CodeAnalysis.RuleSet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
6 changes: 3 additions & 3 deletions src/HomeAutio.Mqtt.Harmony/packages.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HarmonyHub" version="2.0.0.39" targetFramework="net452" />
<package id="HarmonyHub" version="3.0.0.1" targetFramework="net462" />
<package id="HomeAutio.Mqtt.Core" version="1.0.0.22" targetFramework="net452" />
<package id="I8Beef.CodeAnalysis.RuleSet" version="1.0.10" targetFramework="net452" developmentDependency="true" />
<package id="I8Beef.CodeAnalysis.RuleSet" version="1.0.11" targetFramework="net452" developmentDependency="true" />
<package id="M2Mqtt" version="4.3.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
<package id="NLog" version="4.4.11" targetFramework="net452" />
<package id="NLog" version="4.4.12" targetFramework="net452" />
<package id="StyleCop.Analyzers" version="1.0.2" targetFramework="net452" developmentDependency="true" />
<package id="Topshelf" version="4.0.3" targetFramework="net452" />
<package id="Topshelf.NLog" version="4.0.3" targetFramework="net452" />
Expand Down

0 comments on commit af56107

Please sign in to comment.