{ {"_ga", "GA1.1.306549087" } }).Returns(string.Empty);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/HtmlRemoverTests.cs b/PlexRequests.Helpers.Tests/HtmlRemoverTests.cs
deleted file mode 100644
index 6a56a20ae..000000000
--- a/PlexRequests.Helpers.Tests/HtmlRemoverTests.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-#region Copyright
-
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: HtmlRemoverTests.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-
-#endregion
-
-using NUnit.Framework;
-
-namespace PlexRequests.Helpers.Tests
-{
- [TestFixture]
- public class HtmlRemoverTests
- {
- [Test]
- public void RemoveHtmlBasic()
- {
- var html = "this is bold para
OK!";
- var result = html.RemoveHtml();
- Assert.That(result, Is.Not.Null);
- Assert.That(result, Is.EqualTo("this is bold para OK!"));
- }
-
- [Test]
- public void RemoveHtmlMoreTags()
- {
- // Good 'ol Ali G ;)
- var html = "\"Ali G: Rezurection\" includes every episode of Da Ali G Show with new, original introductions by star, creator/writer Sacha Baron Cohen, along with the BAFTA(R) Award-winning English episodes of Da Ali G Show which have never aired on American television and The Best of Ali G.
";
- var result = html.RemoveHtml();
- Assert.That(result, Is.Not.Null);
- Assert.That(result, Is.EqualTo("\"Ali G: Rezurection\" includes every episode of Da Ali G Show with new, original introductions by star, creator/writer Sacha Baron Cohen, along with the BAFTA(R) Award-winning English episodes of Da Ali G Show which have never aired on American television and The Best of Ali G."));
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/PasswordHasherTests.cs b/PlexRequests.Helpers.Tests/PasswordHasherTests.cs
deleted file mode 100644
index 2ac54a547..000000000
--- a/PlexRequests.Helpers.Tests/PasswordHasherTests.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: AssemblyHelperTests.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-
-using NUnit.Framework;
-
-namespace PlexRequests.Helpers.Tests
-{
- [TestFixture]
- public class PasswordHasherTests
- {
- [Test]
- public void TestHash()
- {
- var password = "abcdef";
- var salt = PasswordHasher.GenerateSalt();
- var hash = PasswordHasher.ComputeHash(password, salt);
-
- Assert.That(hash, Is.Not.EqualTo(password));
-
- var match = PasswordHasher.VerifyPassword(password, salt, hash);
-
- Assert.That(match, Is.True);
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/PlexHelperTests.cs b/PlexRequests.Helpers.Tests/PlexHelperTests.cs
deleted file mode 100644
index d690bbbfe..000000000
--- a/PlexRequests.Helpers.Tests/PlexHelperTests.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: UriHelperTests.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-namespace PlexRequests.Helpers.Tests
-{
- [TestFixture]
- public class PlexHelperTests
- {
- [TestCaseSource(nameof(PlexGuids))]
- public string CreateUriWithSubDir(string guid)
- {
- return PlexHelper.GetProviderIdFromPlexGuid(guid);
- }
-
-
- private static IEnumerable PlexGuids
- {
- get
- {
- yield return new TestCaseData("com.plexapp.agents.thetvdb://269586/3/17?lang=en").Returns("269586");
- yield return new TestCaseData("com.plexapp.agents.imdb://tt3300542?lang=en").Returns("tt3300542");
- yield return new TestCaseData("com.plexapp.agents.thetvdb://71326/10/5?lang=en").Returns("71326");
- yield return new TestCaseData("local://3450").Returns("3450");
- yield return new TestCaseData("com.plexapp.agents.imdb://tt1179933?lang=en").Returns("tt1179933");
- yield return new TestCaseData("com.plexapp.agents.imdb://tt0284837?lang=en").Returns("tt0284837");
- yield return new TestCaseData("com.plexapp.agents.imdb://tt0076759?lang=en").Returns("tt0076759");
- }
- }
-
-
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj b/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj
deleted file mode 100644
index 0789e013c..000000000
--- a/PlexRequests.Helpers.Tests/PlexRequests.Helpers.Tests.csproj
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {0E6395D3-B074-49E8-898D-0EB99E507E0E}
- Library
- Properties
- PlexRequests.Helpers.Tests
- PlexRequests.Helpers.Tests
- v4.5
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll
- True
-
-
- ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll
- True
-
-
- ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll
- True
-
-
- ..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll
- True
-
-
- ..\packages\Owin.1.0\lib\net40\Owin.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {1252336d-42a3-482a-804c-836e60173dfa}
- PlexRequests.Helpers
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/Properties/AssemblyInfo.cs b/PlexRequests.Helpers.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1bebc4548..000000000
--- a/PlexRequests.Helpers.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("PlexRequests.Helpers.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("PlexRequests.Helpers.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("0e6395d3-b074-49e8-898d-0eb99e507e0e")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]
diff --git a/PlexRequests.Helpers.Tests/UriHelperTests.cs b/PlexRequests.Helpers.Tests/UriHelperTests.cs
deleted file mode 100644
index cc748f95c..000000000
--- a/PlexRequests.Helpers.Tests/UriHelperTests.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: UriHelperTests.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-namespace PlexRequests.Helpers.Tests
-{
- [TestFixture]
- public class UriHelperTests
- {
- [TestCaseSource(nameof(UriData))]
- public Uri CreateUri1(string uri)
- {
- return uri.ReturnUri();
- }
-
- [Test]
- public void CreateUriWithSsl()
- {
- var uri = "192.168.1.69";
- var result = uri.ReturnUri(8080, true);
-
- Assert.That(result, Is.EqualTo(new Uri("https://192.168.1.69:8080")));
- }
-
- [TestCaseSource(nameof(UriDataWithPort))]
- public Uri CreateUri2(string uri, int port)
- {
- return uri.ReturnUri(port);
- }
-
- [TestCaseSource(nameof(UriDataWithSubDir))]
- public Uri CreateUriWithSubDir(string uri, int port, bool ssl, string subDir)
- {
- return uri.ReturnUriWithSubDir(port, ssl, subDir);
- }
-
- private static IEnumerable UriData
- {
- get
- {
- yield return new TestCaseData("google.com").Returns(new Uri("http://google.com/"));
- yield return new TestCaseData("http://google.com").Returns(new Uri("http://google.com/"));
- yield return new TestCaseData("https://google.com").Returns(new Uri("https://google.com/"));
- yield return new TestCaseData("192.168.1.1").Returns(new Uri("http://192.168.1.1"));
- yield return new TestCaseData("0.0.0.0:5533").Returns(new Uri("http://0.0.0.0:5533"));
- yield return new TestCaseData("www.google.com").Returns(new Uri("http://www.google.com/"));
- yield return new TestCaseData("http://www.google.com/").Returns(new Uri("http://www.google.com/"));
- yield return new TestCaseData("https://www.google.com").Returns(new Uri("https://www.google.com/"));
- yield return new TestCaseData("www.google.com:443").Returns(new Uri("http://www.google.com:443/"));
- yield return new TestCaseData("https://www.google.com:443").Returns(new Uri("https://www.google.com/"));
- yield return new TestCaseData("http://www.google.com:443/id=2").Returns(new Uri("http://www.google.com:443/id=2"));
- yield return new TestCaseData("www.google.com:4438/id=22").Returns(new Uri("http://www.google.com:4438/id=22"));
- }
- }
-
- private static IEnumerable UriDataWithPort
- {
- get
- {
- yield return new TestCaseData("www.google.com", 80).Returns(new Uri("http://www.google.com:80/"));
- yield return new TestCaseData("www.google.com", 443).Returns(new Uri("http://www.google.com:443/"));
- yield return new TestCaseData("http://www.google.com", 443).Returns(new Uri("http://www.google.com:443/"));
- yield return new TestCaseData("https://www.google.com", 443).Returns(new Uri("https://www.google.com:443/"));
- yield return new TestCaseData("http://www.google.com/id=2", 443).Returns(new Uri("http://www.google.com:443/id=2"));
- yield return new TestCaseData("https://www.google.com/id=2", 443).Returns(new Uri("https://www.google.com:443/id=2"));
- }
- }
-
- private static IEnumerable UriDataWithSubDir
- {
- get
- {
- yield return new TestCaseData("www.google.com", 80, false, "test").Returns(new Uri("http://www.google.com:80/test"));
- yield return new TestCaseData("www.google.com", 443, false, "test").Returns(new Uri("http://www.google.com:443/test"));
- yield return new TestCaseData("http://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test"));
- yield return new TestCaseData("https://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test"));
- }
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers.Tests/app.config b/PlexRequests.Helpers.Tests/app.config
deleted file mode 100644
index f2cdc9810..000000000
--- a/PlexRequests.Helpers.Tests/app.config
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PlexRequests.Helpers.Tests/packages.config b/PlexRequests.Helpers.Tests/packages.config
deleted file mode 100644
index def7d9cf6..000000000
--- a/PlexRequests.Helpers.Tests/packages.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PlexRequests.Helpers/Analytics/Action.cs b/PlexRequests.Helpers/Analytics/Action.cs
deleted file mode 100644
index 4a42a45be..000000000
--- a/PlexRequests.Helpers/Analytics/Action.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: Action.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-namespace PlexRequests.Helpers.Analytics
-{
- public enum Action
- {
- Donate,
- ClickButton,
- Delete,
- Create,
- Save,
- Update,
- Start,
- View
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/Analytics/Analytics.cs b/PlexRequests.Helpers/Analytics/Analytics.cs
deleted file mode 100644
index 764295fa3..000000000
--- a/PlexRequests.Helpers/Analytics/Analytics.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: Analytics.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web;
-
-using NLog;
-
-using HttpUtility = Nancy.Helpers.HttpUtility;
-
-namespace PlexRequests.Helpers.Analytics
-{
- public class Analytics : IAnalytics
- {
- private const string AnalyticsUri = "http://www.google-analytics.com/collect";
- private const string RequestMethod = "POST";
- private const string TrackingId = "UA-77083919-2";
-
- private static Logger Log = LogManager.GetCurrentClassLogger();
-
- public void TrackEvent(Category category, Action action, string label, string username, string clientId, int? value = null)
- {
- var cat = category.ToString();
- var act = action.ToString();
- Track(HitType.@event, username, cat, act, label, clientId, value);
- }
-
- public async Task TrackEventAsync(Category category, Action action, string label, string username, string clientId, int? value = null)
- {
- var cat = category.ToString();
- var act = action.ToString();
- await TrackAsync(HitType.@event, username, cat, act, clientId, label, value);
- }
-
- public void TrackPageview(Category category, Action action, string label, string username, string clientId, int? value = null)
- {
- var cat = category.ToString();
- var act = action.ToString();
- Track(HitType.@pageview, username, cat, act, clientId, label, value);
- }
- public async Task TrackPageviewAsync(Category category, Action action, string label, string username, string clientId, int? value = null)
- {
- var cat = category.ToString();
- var act = action.ToString();
- await TrackAsync(HitType.@pageview, username, cat, act, clientId, label, value);
- }
-
- public void TrackException(string message, string username, string clientId, bool fatal)
- {
- var fatalInt = fatal ? 1 : 0;
- Track(HitType.exception, message, fatalInt, username, clientId);
- }
-
- public async Task TrackExceptionAsync(string message, string username, string clientId, bool fatal)
- {
- var fatalInt = fatal ? 1 : 0;
- await TrackAsync(HitType.exception, message, fatalInt, username, clientId);
- }
-
- private void Track(HitType type, string username, string category, string action, string clientId, string label, int? value = null)
- {
- if (string.IsNullOrEmpty(category)) throw new ArgumentNullException(nameof(category));
- if (string.IsNullOrEmpty(action)) throw new ArgumentNullException(nameof(action));
-
- var postData = BuildRequestData(type, username, category, action, clientId, label, value, null, null);
-
- var postDataString = postData
- .Aggregate("", (data, next) => string.Format($"{data}&{next.Key}={HttpUtility.UrlEncode(next.Value)}"))
- .TrimEnd('&');
-
- SendRequest(postDataString);
- }
-
- private async Task TrackAsync(HitType type, string username, string category, string action, string clientId, string label, int? value = null)
- {
- if (string.IsNullOrEmpty(category)) throw new ArgumentNullException(nameof(category));
- if (string.IsNullOrEmpty(action)) throw new ArgumentNullException(nameof(action));
-
- var postData = BuildRequestData(type, username, category, action, clientId, label, value, null, null);
-
- var postDataString = postData
- .Aggregate("", (data, next) => string.Format($"{data}&{next.Key}={HttpUtility.UrlEncode(next.Value)}"))
- .TrimEnd('&');
-
- await SendRequestAsync(postDataString);
- }
- private async Task TrackAsync(HitType type, string message, int fatal, string username, string clientId)
- {
- if (string.IsNullOrEmpty(message)) throw new ArgumentNullException(nameof(message));
-
- var postData = BuildRequestData(type, username, null, null, null, clientId, null, message, fatal);
-
- var postDataString = postData
- .Aggregate("", (data, next) => string.Format($"{data}&{next.Key}={HttpUtility.UrlEncode(next.Value)}"))
- .TrimEnd('&');
-
- await SendRequestAsync(postDataString);
- }
-
- private void Track(HitType type, string message, int fatal, string username, string clientId)
- {
- if (string.IsNullOrEmpty(message)) throw new ArgumentNullException(nameof(message));
- if (string.IsNullOrEmpty(username)) throw new ArgumentNullException(nameof(username));
-
- var postData = BuildRequestData(type, username, null, null, null, clientId, null, message, fatal);
-
- var postDataString = postData
- .Aggregate("", (data, next) => string.Format($"{data}&{next.Key}={HttpUtility.UrlEncode(next.Value)}"))
- .TrimEnd('&');
-
- SendRequest(postDataString);
- }
-
- private void SendRequest(string postDataString)
- {
- var request = (HttpWebRequest)WebRequest.Create(AnalyticsUri);
- request.Method = RequestMethod;
- // set the Content-Length header to the correct value
- request.ContentLength = Encoding.UTF8.GetByteCount(postDataString);
-
- // write the request body to the request
- using (var writer = new StreamWriter(request.GetRequestStream()))
- {
- writer.Write(postDataString);
- }
-
- try
- {
- var webResponse = (HttpWebResponse)request.GetResponse();
- if (webResponse.StatusCode != HttpStatusCode.OK)
- {
- throw new HttpException((int)webResponse.StatusCode, "Google Analytics tracking did not return OK 200");
- }
- }
- catch (Exception ex)
- {
- Log.Error(ex, "Analytics tracking failed");
- }
- }
- private async Task SendRequestAsync(string postDataString)
- {
- var request = (HttpWebRequest)WebRequest.Create(AnalyticsUri);
- request.Method = RequestMethod;
- // set the Content-Length header to the correct value
- request.ContentLength = Encoding.UTF8.GetByteCount(postDataString);
-
- // write the request body to the request
- using (var writer = new StreamWriter(await request.GetRequestStreamAsync()))
- {
- await writer.WriteAsync(postDataString);
- }
-
- try
- {
- var webResponse = (HttpWebResponse)await request.GetResponseAsync();
- if (webResponse.StatusCode != HttpStatusCode.OK)
- {
- throw new HttpException((int)webResponse.StatusCode, "Google Analytics tracking did not return OK 200");
- }
- }
- catch (Exception ex)
- {
- Log.Error(ex, "Analytics tracking failed");
- }
- }
-
- private Dictionary BuildRequestData(HitType type, string username, string category, string action, string clientId, string label, int? value, string exceptionDescription, int? fatal)
- {
- var postData = new Dictionary
- {
- { "v", "1" },
- { "tid", TrackingId },
- { "t", type.ToString() }
- };
-
- if (!string.IsNullOrEmpty(username))
- {
- postData.Add("uid", username);
- }
-
- postData.Add("cid", !string.IsNullOrEmpty(clientId)
- ? clientId
- : Guid.NewGuid().ToString());
-
- if (!string.IsNullOrEmpty(label))
- {
- postData.Add("el", label);
- }
- if (value.HasValue)
- {
- postData.Add("ev", value.ToString());
- }
- if (!string.IsNullOrEmpty(category))
- {
- postData.Add("ec", category);
- }
- if (!string.IsNullOrEmpty(action))
- {
- postData.Add("ea", action);
- }
- if (!string.IsNullOrEmpty(exceptionDescription))
- {
- postData.Add("exd", exceptionDescription);
- }
- if (fatal.HasValue)
- {
- postData.Add("exf", fatal.ToString());
- }
- return postData;
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/Analytics/Category.cs b/PlexRequests.Helpers/Analytics/Category.cs
deleted file mode 100644
index 7bedb16a5..000000000
--- a/PlexRequests.Helpers/Analytics/Category.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: Category.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-namespace PlexRequests.Helpers.Analytics
-{
- public enum Category
- {
- Startup,
- Search,
- Requests,
- Admin,
- LandingPage,
- Api,
- Issues,
- UserLogin,
- Services,
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/Analytics/HitType.cs b/PlexRequests.Helpers/Analytics/HitType.cs
deleted file mode 100644
index c3882f96a..000000000
--- a/PlexRequests.Helpers/Analytics/HitType.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: HitType.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-// ReSharper disable InconsistentNaming
-namespace PlexRequests.Helpers.Analytics
-{
- internal enum HitType
- {
- @event,
- @pageview,
- @exception
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/Analytics/IAnalytics.cs b/PlexRequests.Helpers/Analytics/IAnalytics.cs
deleted file mode 100644
index d21dd18d1..000000000
--- a/PlexRequests.Helpers/Analytics/IAnalytics.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: IAnalytics.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-using System.Threading.Tasks;
-
-namespace PlexRequests.Helpers.Analytics
-{
- public interface IAnalytics
- {
- ///
- /// Tracks the event.
- ///
- /// The category.
- /// The action.
- /// The label.
- /// The username.
- /// The client identifier.
- /// The value.
- void TrackEvent(Category category, Action action, string label, string username, string clientId, int? value = null);
-
- ///
- /// Tracks the event asynchronous.
- ///
- /// The category.
- /// The action.
- /// The label.
- /// The username.
- /// The client identifier.
- /// The value.
- ///
- Task TrackEventAsync(Category category, Action action, string label, string username, string clientId, int? value = null);
-
- ///
- /// Tracks the page view.
- ///
- /// The category.
- /// The action.
- /// The label.
- /// The username.
- /// The client identifier.
- /// The value.
- void TrackPageview(Category category, Action action, string label, string username, string clientId, int? value = null);
-
- ///
- /// Tracks the page view asynchronous.
- ///
- /// The category.
- /// The action.
- /// The label.
- /// The username.
- /// The client identifier.
- /// The value.
- ///
- Task TrackPageviewAsync(Category category, Action action, string label, string username, string clientId, int? value = null);
-
- ///
- /// Tracks the exception.
- ///
- /// The message.
- /// The username.
- /// The client identifier.
- /// if set to true [fatal].
- void TrackException(string message, string username, string clientId, bool fatal);
-
- ///
- /// Tracks the exception asynchronous.
- ///
- /// The message.
- /// The username.
- /// The client identifier.
- /// if set to true [fatal].
- ///
- Task TrackExceptionAsync(string message, string username, string clientId, bool fatal);
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/AssemblyHelper.cs b/PlexRequests.Helpers/AssemblyHelper.cs
deleted file mode 100644
index 6c450bda8..000000000
--- a/PlexRequests.Helpers/AssemblyHelper.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: AssemblyHelper.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-using System.Diagnostics;
-using System.Reflection;
-
-namespace PlexRequests.Helpers
-{
- public class AssemblyHelper
- {
- public static string GetAssemblyVersion()
- {
- var assembly = Assembly.GetExecutingAssembly();
- var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
- return fvi.FileVersion;
- }
-
- public static string GetProductVersion()
- {
- var assembly = Assembly.GetExecutingAssembly();
- var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
- var retVersion = fvi.ProductVersion;
- return retVersion;
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/ByteConverterHelper.cs b/PlexRequests.Helpers/ByteConverterHelper.cs
deleted file mode 100644
index 87d569592..000000000
--- a/PlexRequests.Helpers/ByteConverterHelper.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: ByteConverterHelper.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-using System.Text;
-
-using Newtonsoft.Json;
-
-namespace PlexRequests.Helpers
-{
- public class ByteConverterHelper
- {
- public static byte[] ReturnBytes(object obj)
- {
- var json = JsonConvert.SerializeObject(obj);
- var bytes = Encoding.UTF8.GetBytes(json);
-
- return bytes;
- }
-
- public static T ReturnObject(byte[] bytes)
- {
- var json = Encoding.UTF8.GetString(bytes);
- var model = JsonConvert.DeserializeObject(json);
- return model;
- }
- public static string ReturnFromBytes(byte[] bytes)
- {
- return Encoding.UTF8.GetString(bytes);
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/DateTimeHelper.cs b/PlexRequests.Helpers/DateTimeHelper.cs
deleted file mode 100644
index 1c4277c4a..000000000
--- a/PlexRequests.Helpers/DateTimeHelper.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using System.Globalization;
-using System.Linq;
-
-namespace PlexRequests.Helpers
-{
- public static class DateTimeHelper
- {
- public static DateTimeOffset OffsetUTCDateTime(DateTime utcDateTime, int minuteOffset)
- {
- //TimeSpan ts = TimeSpan.FromMinutes(-minuteOffset);
- //return new DateTimeOffset(utcDateTime).ToOffset(ts);
-
- // this is a workaround below to work with MONO
- var tzi = FindTimeZoneFromOffset(minuteOffset);
- var utcOffset = tzi.GetUtcOffset(utcDateTime);
- var newDate = utcDateTime + utcOffset;
- return new DateTimeOffset(newDate.Ticks, utcOffset);
- }
-
- public static void CustomParse(string date, out DateTime dt)
- {
- // Try and parse it
- if (DateTime.TryParse(date, out dt))
- {
- return;
- }
-
- // Maybe it's only a year?
- if (DateTime.TryParseExact(date, "yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out dt))
- {
- return;
- }
- }
-
- private static TimeZoneInfo FindTimeZoneFromOffset(int minuteOffset)
- {
- var tzc = TimeZoneInfo.GetSystemTimeZones();
- return tzc.FirstOrDefault(x => x.BaseUtcOffset.TotalMinutes == -minuteOffset);
- }
- }
-}
diff --git a/PlexRequests.Helpers/Exceptions/ApiRequestException.cs b/PlexRequests.Helpers/Exceptions/ApiRequestException.cs
deleted file mode 100644
index e44a8fdec..000000000
--- a/PlexRequests.Helpers/Exceptions/ApiRequestException.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: ApplicationSettingsException.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-using System;
-
-namespace PlexRequests.Helpers.Exceptions
-{
- public class ApiRequestException : Exception
- {
- public ApiRequestException(string message) : base(message)
- {
-
- }
- public ApiRequestException(string message, Exception innerException) : base(message, innerException)
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/ICacheProvider.cs b/PlexRequests.Helpers/ICacheProvider.cs
deleted file mode 100644
index 00fde411b..000000000
--- a/PlexRequests.Helpers/ICacheProvider.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-#region Copyright
-// /************************************************************************
-// Copyright (c) 2016 Jamie Rees
-// File: ICacheProvider.cs
-// Created By: Jamie Rees
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ************************************************************************/
-#endregion
-using System;
-using System.Threading.Tasks;
-
-namespace PlexRequests.Helpers
-{
- public interface ICacheProvider
- {
- ///
- /// Gets the item from the cache, if the item is not present
- /// then we will get that item and store it in the cache.
- ///
- /// Type to store in the cache
- /// The key
- /// The item callback. This will be called if the item is not present in the cache.
- /// The amount of time we want to cache the object
- ///
- T GetOrSet(string key, Func itemCallback, int cacheTime = 20) where T : class;
- Task GetOrSetAsync(string key, Func