From ff4fae1d35adf8874164121bfee5734159dcdffb Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Fri, 15 Nov 2013 13:43:27 +0100 Subject: [PATCH] add second NuGet package for PocketReader; allow user agent in PocketReader constructor --- PocketSharp.Reader/PocketReader.cs | 12 ++++++-- PocketSharp.Reader/PocketSharp.Reader.nuspec | 28 +++++++++++++++++++ PocketSharp.Reader/Properties/AssemblyInfo.cs | 22 ++++++--------- PocketSharp/PocketSharp.nuspec | 2 +- PocketSharp/Properties/AssemblyInfo.cs | 2 +- 5 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 PocketSharp.Reader/PocketSharp.Reader.nuspec diff --git a/PocketSharp.Reader/PocketReader.cs b/PocketSharp.Reader/PocketReader.cs index c7155c4..29aa4d0 100644 --- a/PocketSharp.Reader/PocketReader.cs +++ b/PocketSharp.Reader/PocketReader.cs @@ -15,7 +15,7 @@ namespace PocketSharp /// /// Used UserAgent for HTTP request /// - public string userAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2"; + protected string _userAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2"; /// /// REST client used for HTML retrieval @@ -26,8 +26,14 @@ namespace PocketSharp /// /// Initializes a new instance of the class. /// - public PocketReader() + public PocketReader(string userAgent = null) { + // override user agent + if (!string.IsNullOrEmpty(userAgent)) + { + _userAgent = userAgent; + } + // initialize HTTP client _httpClient = new HttpClient(new HttpClientHandler() { @@ -42,7 +48,7 @@ namespace PocketSharp _httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip,deflate"); // add user agent - _httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", userAgent + " PocketSharp / 3.0"); + _httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", _userAgent + " PocketSharp / 3.0"); } diff --git a/PocketSharp.Reader/PocketSharp.Reader.nuspec b/PocketSharp.Reader/PocketSharp.Reader.nuspec new file mode 100644 index 0000000..02ddb61 --- /dev/null +++ b/PocketSharp.Reader/PocketSharp.Reader.nuspec @@ -0,0 +1,28 @@ + + + + $id$ + $version$ + $title$ + $author$ + $author$ + https://raw.github.com/ceee/PocketSharp/master/LICENSE-MIT + https://github.com/ceee/PocketSharp + https://raw.github.com/ceee/PocketSharp/master/Assets/pocketsharp.png + false + + + + en-US + + + + Copyright by cee, 2013 + PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability SgmlReader Reader Article SDK Pockem + + diff --git a/PocketSharp.Reader/Properties/AssemblyInfo.cs b/PocketSharp.Reader/Properties/AssemblyInfo.cs index f0144f6..d938094 100644 --- a/PocketSharp.Reader/Properties/AssemblyInfo.cs +++ b/PocketSharp.Reader/Properties/AssemblyInfo.cs @@ -1,30 +1,26 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; +using System.Reflection; -// General Information about an assembly is controlled through the following +// 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("PocketSharp.Reader")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Custom Article View API for PocketSharp")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("cee")] [assembly: AssemblyProduct("PocketSharp.Reader")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright © cee 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// 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: AssemblyVersion("3.0.0")] +[assembly: AssemblyFileVersion("3.0.0 RC2")] \ No newline at end of file diff --git a/PocketSharp/PocketSharp.nuspec b/PocketSharp/PocketSharp.nuspec index 4829016..e7af9a8 100644 --- a/PocketSharp/PocketSharp.nuspec +++ b/PocketSharp/PocketSharp.nuspec @@ -18,6 +18,6 @@ ]]> Copyright by cee, 2013 - PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability Reader Article SDK Pockem + PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability SgmlReader Reader Article SDK Pockem diff --git a/PocketSharp/Properties/AssemblyInfo.cs b/PocketSharp/Properties/AssemblyInfo.cs index b2a357c..8c32bac 100644 --- a/PocketSharp/Properties/AssemblyInfo.cs +++ b/PocketSharp/Properties/AssemblyInfo.cs @@ -23,4 +23,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.0.0")] -[assembly: AssemblyFileVersion("3.0.0 RC1")] \ No newline at end of file +[assembly: AssemblyFileVersion("3.0.0 RC2")] \ No newline at end of file