Skip to content

Commit

Permalink
Add patreon service to clipboad lurker
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Mar 17, 2020
1 parent dbb4845 commit ec6e291
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions Lurker.Test/Lurker.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions Lurker.Test/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
9 changes: 9 additions & 0 deletions src/Lurker/ClipboardLurker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Lurker
using Lurker.Events;
using Lurker.Models;
using Lurker.Parser;
using Lurker.Patreon;
using Lurker.Services;
using System;
using System.Threading;
Expand All @@ -30,6 +31,7 @@ public class ClipboardLurker: IDisposable
private SharpClipboard _clipboardMonitor;
private string _lastClipboardText = string.Empty;
private IKeyboardMouseEvents _keyboardEvent;
private PatreonService _patreonService;

#endregion

Expand All @@ -41,6 +43,7 @@ public class ClipboardLurker: IDisposable
public ClipboardLurker(SettingsService settingsService)
{
Clipboard.Clear();
this._patreonService = new PatreonService();
this._simulator = new InputSimulator();
this._clipboardMonitor = new SharpClipboard();
this._settingsService = settingsService;
Expand Down Expand Up @@ -84,6 +87,7 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
this._patreonService.Dispose();
this._keyboardEvent.Dispose();
this._clipboardMonitor.ClipboardChanged -= ClipboardMonitor_ClipboardChanged;
}
Expand Down Expand Up @@ -176,6 +180,11 @@ private async void ParseItem()
return;
}

if (!await this._patreonService.IsPledging())
{
return;
}

PoeItem item = default;

var retryCount = 3;
Expand Down
24 changes: 24 additions & 0 deletions src/Lurker/Lurker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,27 @@
<Reference Include="Gma.System.MouseKeyHook, Version=5.6.130.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MouseKeyHook.5.6.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
</Reference>
<Reference Include="Lurker.Patreon, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.0.0\lib\net48\Lurker.Patreon.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Hosting, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.12.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.6.8\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="Sentry, Version=2.0.3.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sentry.2.0.3\lib\net461\Sentry.dll</HintPath>
Expand All @@ -64,10 +79,19 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Owin, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.7\lib\net45\System.Web.Http.Owin.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
8 changes: 4 additions & 4 deletions src/Lurker/app.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
9 changes: 9 additions & 0 deletions src/Lurker/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
<packages>
<package id="ConfOxide" version="1.4.2.0" targetFramework="net472" />
<package id="InputSimulator" version="1.0.4.0" targetFramework="net472" />
<package id="Lurker.Patreon" version="1.0.0" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.Owin" version="2.0.2" targetFramework="net48" />
<package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net48" />
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net48" />
<package id="MouseKeyHook" version="5.6.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="NLog" version="4.6.8" targetFramework="net472" />
<package id="NLog.Config" version="4.6.8" targetFramework="net472" />
<package id="NLog.Schema" version="4.6.8" targetFramework="net472" />
<package id="Owin" version="1.0" targetFramework="net48" />
<package id="Sentry" version="2.0.3" targetFramework="net472" />
<package id="Sentry.PlatformAbstractions" version="1.1.0" targetFramework="net472" />
<package id="Sentry.Protocol" version="2.0.0" targetFramework="net472" />
Expand Down

0 comments on commit ec6e291

Please sign in to comment.