15 Commits

Author SHA1 Message Date
swcs b8d211e151 update changelog 2014-08-28 14:15:16 +02:00
swcs c31b771cdb fix datetime conversion issue 2014-08-28 14:14:40 +02:00
swcs e0f96a092c assembly version 2014-07-27 15:16:39 +02:00
swcs 0301bbaf10 LOL 2014-07-27 13:03:33 +02:00
swcs 5266f220e9 fixes #28
Fix StackOverflow bug in PocketItem equality overload
2014-07-27 13:01:53 +02:00
swcs c83971b4cc convert all datetimes to UTC+0 2014-07-21 16:37:30 +02:00
swcs 1567709ace Merge remote-tracking branch 'origin/master' into simple 2014-07-21 16:24:30 +02:00
swcs 342f16fb8e convert timestamps to UTC+-0 (critical fix) 2014-07-21 16:23:59 +02:00
swcs 423be2df5f Merge remote-tracking branch 'origin/master' into simple 2014-07-18 11:58:08 +02:00
swcs 1605740107 fixes #27
Implement WebAuthenticationBroker-view toggle
see: http://getpocket.com/developer/docs/getstarted/windows8
2014-07-18 11:54:47 +02:00
swcs b7b92d87ed sliiim 2014-07-02 15:31:38 +02:00
swcs 01c36a047a flag for caching last HTTP response 2014-07-01 17:10:14 +02:00
swcs 140e645e86 bugfix 2014-06-25 14:41:42 +02:00
swcs 97919cdd18 supi dupi force param 2014-06-18 18:58:43 +02:00
swcs 761d670c65 update docs and changelog 2014-06-17 11:11:41 +02:00
15 changed files with 181 additions and 168 deletions
+29
View File
@@ -1,3 +1,32 @@
### 4.1.6 (2014-08-28)
- Fix DateTime conversion issue (from local to UTC)
### 4.1.5 (2014-07-27)
- Fix StackOverflow bug in PocketItem equality overload (fixes #28)
### 4.1.4 (2014-07-18)
- Implement WebAuthenticationBroker-view toggle
### 4.1.3 (2014-06-25)
- Only dispose response if available
### 4.1.2 (2014-06-18)
- Add force param to login+registration
### 4.1.1 (2014-06-17)
- Fix batch adding bug
### 4.1.0 (2014-06-16)
- Include access to the Article View API
### 4.0.0 (2014-04-03) ### 4.0.0 (2014-04-03)
- Support for Universal apps (dropped SL and WP7 support) - Support for Universal apps (dropped SL and WP7 support)
+41 -19
View File
@@ -33,23 +33,23 @@ namespace PocketSharp.Tests
Assert.True(item.Uri == itemDuplicate.Uri); Assert.True(item.Uri == itemDuplicate.Uri);
} }
[Fact] // [Fact]
public async Task IsItemJsonPopulated() // public async Task IsItemJsonPopulated()
{ // {
List<PocketItem> items = (await client.Get()).ToList(); // List<PocketItem> items = (await client.Get()).ToList();
string schemaJson = @"{ // string schemaJson = @"{
'description': 'PocketItem', // 'description': 'PocketItem',
'type': 'object' // 'type': 'object'
}"; // }";
JsonSchema schema = JsonSchema.Parse(schemaJson); // JsonSchema schema = JsonSchema.Parse(schemaJson);
foreach (var pocketItem in items) // foreach (var pocketItem in items)
{ // {
Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json)); // Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
var jObject = JObject.Parse(pocketItem.Json); // var jObject = JObject.Parse(pocketItem.Json);
Assert.True(jObject.IsValid(schema)); // Assert.True(jObject.IsValid(schema));
} // }
} // }
[Fact] [Fact]
public async Task AreFilteredItemsRetrieved() public async Task AreFilteredItemsRetrieved()
@@ -194,7 +194,7 @@ namespace PocketSharp.Tests
[Fact] [Fact]
public async Task IsSinceParameterWorkingOnAddTags() public async Task IsSinceParameterWorkingOnAddTags()
{ {
DateTime since = DateTime.UtcNow; DateTime since = DateTime.Now;
IEnumerable<PocketItem> items = await client.Get(state: State.all); IEnumerable<PocketItem> items = await client.Get(state: State.all);
PocketItem itemToModify = items.First(); PocketItem itemToModify = items.First();
@@ -218,7 +218,7 @@ namespace PocketSharp.Tests
[Fact] [Fact]
public async Task IsSinceParameterWorkingOnFavoriteAndArchiveModification() public async Task IsSinceParameterWorkingOnFavoriteAndArchiveModification()
{ {
DateTime since = DateTime.UtcNow; DateTime since = DateTime.Now;//1409221736
IEnumerable<PocketItem> items = await client.Get(state: State.all); IEnumerable<PocketItem> items = await client.Get(state: State.all);
PocketItem itemToModify = items.First(); PocketItem itemToModify = items.First();
@@ -237,7 +237,7 @@ namespace PocketSharp.Tests
await client.Unfavorite(itemToModify); await client.Unfavorite(itemToModify);
since = DateTime.UtcNow.AddMinutes(-1); since = DateTime.Now;
await client.Archive(itemToModify); await client.Archive(itemToModify);
@@ -249,6 +249,28 @@ namespace PocketSharp.Tests
} }
[Fact]
public async Task IsUTCSinceParameterWorking()
{
DateTime since = DateTime.UtcNow;
IEnumerable<PocketItem> items = await client.Get(state: State.all);
PocketItem itemToModify = items.First();
items = await client.Get(state: State.all, since: since);
Assert.True(items == null || items.Count() == 0);
await client.Favorite(itemToModify);
items = await client.Get(state: State.all, since: since);
Assert.True(items.Count() > 0);
await client.Unfavorite(itemToModify);
}
[Fact] [Fact]
public async Task IsSinceParameterWorkingOnAddAndDelete() public async Task IsSinceParameterWorkingOnAddAndDelete()
{ {
+19 -5
View File
@@ -105,13 +105,27 @@ namespace PocketSharp.Tests
string[] tag; string[] tag;
Random rnd = new Random(); Random rnd = new Random();
foreach (string url in urls.Skip(offset).Take(count)) var items = urls.Skip(offset).Take(count)
.Select((value, idx) => new { Value = value, Index = idx })
.GroupBy(item => item.Index / 100, item => item.Value)
.Cast<IEnumerable<string>>();
foreach (IEnumerable<string> urlGroup in items)
{ {
r = rnd.Next(tags.Length); await Task.WhenAll(urlGroup.Select(url =>
r2 = rnd.Next(tags.Length); {
tag = new string[] { tags[r], tags[r2] }; r = rnd.Next(tags.Length);
await client.Add(new Uri("http://" + url), tag); r2 = rnd.Next(tags.Length);
tag = new string[] { tags[r], tags[r2] };
return client.Add(new Uri("http://" + url), tag);
}));
} }
} }
//[Fact]
//public async Task Fillll()
//{
// await FillAccount(11000, 89999);
//}
} }
} }
+26 -26
View File
@@ -60,7 +60,32 @@ namespace PocketSharp
RequestCode = requestCode; RequestCode = requestCode;
} }
return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0")); return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0", "login", useInsideWebAuthenticationBroker ? "1" : "0"));
}
/// <summary>
/// Generate registration URI from requestCode
/// Follow the steps as with GenerateAuthenticationUri, but for unregistered users
/// </summary>
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
/// <returns>A valid URI to redirect the user to.</returns>
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
public Uri GenerateRegistrationUri(string requestCode = null)
{
// check if request code is available
if (RequestCode == null && requestCode == null)
{
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
}
// override property with given param if available
if (requestCode != null)
{
RequestCode = requestCode;
}
return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0", "signup", useInsideWebAuthenticationBroker ? "1" : "0"));
} }
@@ -99,30 +124,5 @@ namespace PocketSharp
return response; return response;
} }
/// <summary>
/// Generate registration URI from requestCode
/// Follow the steps as with GenerateAuthenticationUri, but for unregistered users
/// </summary>
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
/// <returns>A valid URI to redirect the user to.</returns>
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
public Uri GenerateRegistrationUri(string requestCode = null)
{
// check if request code is available
if (RequestCode == null && requestCode == null)
{
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
}
// override property with given param if available
if (requestCode != null)
{
RequestCode = requestCode;
}
return new Uri(String.Format("{0}&force=signup", String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0")));
}
} }
} }
+3 -3
View File
@@ -53,12 +53,12 @@ namespace PocketSharp
DetailType = DetailType.complete, DetailType = DetailType.complete,
Search = search, Search = search,
Domain = domain, Domain = domain,
Since = since, Since = since.HasValue ? ((DateTime)since).ToUniversalTime() : since,
Count = count, Count = count,
Offset = offset Offset = offset
}; };
return (await Request<Retrieve>("get", cancellationToken, parameters.Convert())).Items; return (await Request<Retrieve>("get", cancellationToken, parameters.Convert())).Items ?? new List<PocketItem>();
} }
@@ -204,7 +204,7 @@ namespace PocketSharp
/// You have to pass the parseUri in the PocketClient ctor for this method to work. /// You have to pass the parseUri in the PocketClient ctor for this method to work.
/// This is a private API and can only be used by authenticated users. /// This is a private API and can only be used by authenticated users.
/// </summary> /// </summary>
/// <param name="tag">The article URI.</param> /// <param name="uri">The article URI.</param>
/// <param name="includeImages">Include images into content or use placeholder.</param> /// <param name="includeImages">Include images into content or use placeholder.</param>
/// <param name="includeVideos">Include videos into content or use placeholder.</param> /// <param name="includeVideos">Include videos into content or use placeholder.</param>
/// <param name="forceRefresh">Force refresh of the content (don't use cache).</param> /// <param name="forceRefresh">Force refresh of the content (don't use cache).</param>
+1 -1
View File
@@ -65,7 +65,7 @@ namespace PocketSharp.Models
// convert DateTime to UNIX timestamp // convert DateTime to UNIX timestamp
if (value is DateTime) if (value is DateTime)
{ {
value = (int)((DateTime)value - new DateTime(1970, 1, 1)).TotalSeconds; value = (int)((DateTime)value - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
} }
parameterDict.Add(name, value.ToString()); parameterDict.Add(name, value.ToString());
+2 -68
View File
@@ -168,15 +168,6 @@ namespace PocketSharp.Models
[JsonProperty("is_article")] [JsonProperty("is_article")]
public bool IsArticle { get; set; } public bool IsArticle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has image.
/// </summary>
/// <value>
/// <c>true</c> if this instance has image; otherwise, <c>false</c>.
/// </value>
[JsonProperty("has_image")]
private PocketBoolean? _HasImage { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance has video. /// Gets or sets a value indicating whether this instance has video.
/// </summary> /// </summary>
@@ -186,21 +177,6 @@ namespace PocketSharp.Models
[JsonProperty("has_video")] [JsonProperty("has_video")]
private PocketBoolean? _HasVideo { get; set; } private PocketBoolean? _HasVideo { get; set; }
/// <summary>
/// Gets a value indicating whether [has image].
/// </summary>
/// <value>
/// <c>true</c> if [has image]; otherwise, <c>false</c>.
/// </value>
[JsonIgnore]
public bool HasImage
{
get
{
return _HasImage == PocketBoolean.Yes || _HasImage == PocketBoolean.IsType;
}
}
/// <summary> /// <summary>
/// Gets a value indicating whether [has video]. /// Gets a value indicating whether [has video].
/// </summary> /// </summary>
@@ -231,21 +207,6 @@ namespace PocketSharp.Models
} }
} }
/// <summary>
/// Gets a value indicating whether [is image].
/// </summary>
/// <value>
/// <c>true</c> if [is image]; otherwise, <c>false</c>.
/// </value>
[JsonIgnore]
public bool IsImage
{
get
{
return _HasImage == PocketBoolean.IsType;
}
}
/// <summary> /// <summary>
/// Gets or sets the word count. /// Gets or sets the word count.
/// </summary> /// </summary>
@@ -283,24 +244,6 @@ namespace PocketSharp.Models
[JsonProperty("time_updated")] [JsonProperty("time_updated")]
public DateTime? UpdateTime { get; set; } public DateTime? UpdateTime { get; set; }
/// <summary>
/// Gets or sets the read time.
/// </summary>
/// <value>
/// The read time.
/// </value>
[JsonProperty("time_read")]
public DateTime? ReadTime { get; set; }
/// <summary>
/// Gets or sets the favorite time.
/// </summary>
/// <value>
/// The favorite time.
/// </value>
[JsonProperty("time_favorited")]
public DateTime? FavoriteTime { get; set; }
/// <summary> /// <summary>
/// Gets or sets the tags as comma-separated strings. /// Gets or sets the tags as comma-separated strings.
/// </summary> /// </summary>
@@ -365,15 +308,6 @@ namespace PocketSharp.Models
get { return Images != null && Images.Count() > 0 ? Images.First() : null; } get { return Images != null && Images.Count() > 0 ? Images.First() : null; }
} }
/// <summary>
/// Gets and sets the JSON the model was deserialized from
/// </summary>
/// <value>
/// Model's original JSON representation
/// </value>
[JsonIgnore]
public string Json { get; set; }
/// <summary> /// <summary>
/// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
/// </summary> /// </summary>
@@ -432,9 +366,9 @@ namespace PocketSharp.Models
/// </returns> /// </returns>
public static bool operator ==(PocketItem a, PocketItem b) public static bool operator ==(PocketItem a, PocketItem b)
{ {
if (a == null || b == null) if (Object.ReferenceEquals(a, b))
{ {
return false; return true;
} }
PocketItem itemA = (PocketItem)a; PocketItem itemA = (PocketItem)a;
+36 -5
View File
@@ -45,13 +45,23 @@ namespace PocketSharp
/// <summary> /// <summary>
/// The authentification URL /// The authentification URL
/// </summary> /// </summary>
protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile={2}"; protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile={2}&force={3}&webauthenticationbroker={4}";
/// <summary> /// <summary>
/// Indicates, whether this client is used for mobile or desktop /// Indicates, whether this client is used for mobile or desktop
/// </summary> /// </summary>
protected bool isMobileClient = true; protected bool isMobileClient = true;
/// <summary>
/// Indicates, whether this client is used inside a broker (on Windows 8)
/// </summary>
protected bool useInsideWebAuthenticationBroker = true;
/// <summary>
/// Indicates, whether the last HTTP response is cached
/// </summary>
protected bool cacheHTTPResponseData;
/// <summary> /// <summary>
/// callback URLi for API calls /// callback URLi for API calls
/// </summary> /// </summary>
@@ -103,7 +113,9 @@ namespace PocketSharp
/// <param name="handler">The HttpMessage handler.</param> /// <param name="handler">The HttpMessage handler.</param>
/// <param name="timeout">Request timeout (in seconds).</param> /// <param name="timeout">Request timeout (in seconds).</param>
/// <param name="isMobileClient">Indicates, whether this client is used for mobile or desktop</param> /// <param name="isMobileClient">Indicates, whether this client is used for mobile or desktop</param>
/// <param name="useInsideWebAuthenticationBroker">Indicates, whether this client is used inside a broker (on Windows 8), see: http://getpocket.com/developer/docs/getstarted/windows8 </param>
/// <param name="parserUri">Enables the wrapper for the private Text Parser API</param> /// <param name="parserUri">Enables the wrapper for the private Text Parser API</param>
/// <param name="cacheHTTPResponseData">Caches the last HTTP response in public properties</param>
public PocketClient( public PocketClient(
string consumerKey, string consumerKey,
string accessCode = null, string accessCode = null,
@@ -111,12 +123,16 @@ namespace PocketSharp
HttpMessageHandler handler = null, HttpMessageHandler handler = null,
int? timeout = null, int? timeout = null,
bool isMobileClient = true, bool isMobileClient = true,
Uri parserUri = null) bool useInsideWebAuthenticationBroker = false,
Uri parserUri = null,
bool cacheHTTPResponseData = true)
{ {
// assign public properties // assign public properties
ConsumerKey = consumerKey; ConsumerKey = consumerKey;
this.isMobileClient = isMobileClient; this.isMobileClient = isMobileClient;
this.useInsideWebAuthenticationBroker = useInsideWebAuthenticationBroker;
this.cacheHTTPResponseData = cacheHTTPResponseData;
// assign access code if submitted // assign access code if submitted
if (accessCode != null) if (accessCode != null)
@@ -244,7 +260,10 @@ namespace PocketSharp
ValidateResponse(response); ValidateResponse(response);
// cache headers // cache headers
lastHeaders = response.Headers; if (cacheHTTPResponseData)
{
lastHeaders = response.Headers;
}
// read response // read response
responseString = await response.Content.ReadAsStringAsync(); responseString = await response.Content.ReadAsStringAsync();
@@ -260,11 +279,18 @@ namespace PocketSharp
finally finally
{ {
request.Dispose(); request.Dispose();
response.Dispose();
if (response != null)
{
response.Dispose();
}
} }
// cache response // cache response
lastResponseData = responseString; if (cacheHTTPResponseData)
{
lastResponseData = responseString;
}
return DeserializeJson<T>(responseString); return DeserializeJson<T>(responseString);
} }
@@ -312,6 +338,11 @@ namespace PocketSharp
/// <returns></returns> /// <returns></returns>
internal async Task<bool> Send(IEnumerable<PocketAction> actionParameters, CancellationToken cancellationToken) internal async Task<bool> Send(IEnumerable<PocketAction> actionParameters, CancellationToken cancellationToken)
{ {
foreach (PocketAction action in actionParameters)
{
action.Time = action.Time.HasValue ? ((DateTime)action.Time).ToUniversalTime() : action.Time;
}
Dictionary<string, string> parameters = new Dictionary<string, string>() {{ Dictionary<string, string> parameters = new Dictionary<string, string>() {{
"actions", JsonConvert.SerializeObject(actionParameters.Select(action => action.Convert())) "actions", JsonConvert.SerializeObject(actionParameters.Select(action => action.Convert()))
}}; }};
+8 -9
View File
@@ -36,7 +36,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>10f8a946</NuGetPackageImportStamp> <NuGetPackageImportStamp>06ad0893</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -57,7 +57,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included --> <!-- A reference to the entire .NET Framework is automatically included -->
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -99,20 +98,20 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\portable-net40+sl5+wp80+win8+monotouch+monoandroid\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="PropertyChanged"> <Reference Include="PropertyChanged">
<HintPath>..\packages\PropertyChanged.Fody.1.48.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath> <HintPath>..\packages\PropertyChanged.Fody.1.48.3\Lib\portable-net4+sl4+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Net.Http"> <Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath> <HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Net.Http.Extensions"> <Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath> <HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Net.Http.Primitives"> <Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath> <HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -137,14 +136,14 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\Fody.1.22.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.22.1\build\Fody.targets'))" /> <Error Condition="!Exists('..\packages\Fody.1.24.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.24.0\build\Fody.targets'))" />
</Target> </Target>
<Import Project="..\packages\Fody.1.22.1\build\Fody.targets" Condition="Exists('..\packages\Fody.1.22.1\build\Fody.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" /> <Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''"> <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" /> <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" /> <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target> </Target>
<Import Project="..\packages\Fody.1.24.0\build\Fody.targets" Condition="Exists('..\packages\Fody.1.24.0\build\Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
+2 -2
View File
@@ -22,5 +22,5 @@
// 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: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.1.1")] [assembly: AssemblyVersion("4.1.6.0")]
[assembly: AssemblyFileVersion("4.1.1")] [assembly: AssemblyFileVersion("4.1.6.0")]
+6 -6
View File
@@ -32,10 +32,11 @@ namespace PocketSharp
{ {
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{ {
DateTime epoc = new DateTime(1970, 1, 1); DateTime date = ((DateTime)value).ToUniversalTime();
var delta = (DateTime)value - epoc; DateTime epoc = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var delta = date.Subtract(epoc);
writer.WriteValue((long)delta.TotalSeconds); writer.WriteValue((int)Math.Truncate(delta.TotalSeconds));
} }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
@@ -50,7 +51,7 @@ namespace PocketSharp
return null; return null;
} }
return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(reader.Value)).ToLocalTime(); return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Convert.ToDouble(reader.Value));
} }
} }
@@ -187,11 +188,10 @@ namespace PocketSharp
public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)
{ {
var jObject = JObject.ReadFrom(reader); var jObject = JObject.ReadFrom(reader);
var pocketItem = new PocketItem(); var pocketItem = new PocketItem();
serializer.Populate(jObject.CreateReader(), pocketItem); serializer.Populate(jObject.CreateReader(), pocketItem);
pocketItem.Json = jObject.ToString(); //pocketItem.Json = jObject.ToString();
return pocketItem; return pocketItem;
} }
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.7.0" newVersion="2.6.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.7.0" newVersion="2.6.7.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+5 -5
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Fody" version="1.22.1" targetFramework="portable-net403+sl50+win+wp80" developmentDependency="true" /> <package id="Fody" version="1.24.0" targetFramework="portable-net45+win+wpa81+wp80" developmentDependency="true" />
<package id="Microsoft.Bcl" version="1.1.7" targetFramework="portable-net403+sl50+win+wpa81+wp80" requireReinstallation="True" /> <package id="Microsoft.Bcl" version="1.1.9" targetFramework="portable-net45+win+wpa81+wp80" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable-net403+sl50+win+wpa81+wp80" /> <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable-net403+sl50+win+wpa81+wp80" />
<package id="Microsoft.Net.Http" version="2.2.19" targetFramework="portable-net403+sl50+win+wpa81+wp80" /> <package id="Microsoft.Net.Http" version="2.2.22" targetFramework="portable-net45+win+wpa81+wp80" />
<package id="Newtonsoft.Json" version="6.0.2" targetFramework="portable-net403+sl50+win+wp80" requireReinstallation="True" /> <package id="Newtonsoft.Json" version="6.0.4" targetFramework="portable-net45+win+wpa81+wp80" />
<package id="PropertyChanged.Fody" version="1.48.0.0" targetFramework="portable-net403+sl50+win+wp80" developmentDependency="true" requireReinstallation="True" /> <package id="PropertyChanged.Fody" version="1.48.3" targetFramework="portable-net45+win+wpa81+wp80" developmentDependency="true" />
</packages> </packages>
+2 -3
View File
@@ -15,9 +15,8 @@ See [wiki](https://github.com/ceee/PocketSharp/wiki)
## Where's the Article View API? ## Where's the Article View API?
PocketSharp doesn't include PocketSharp.Reader (an article view implementation) anymore. You can either use the open source [ReadSharp](https://github.com/ceee/ReadSharp) parser or if you want to use the official API by Pocket, you have to request access to it.<br>
Afterwards you can use the access information to query the endpoint with PocketSharp. Instructions [here](https://github.com/ceee/PocketSharp/wiki/Article-parser).
**PocketSharp.Reader is now [ReadSharp](https://github.com/ceee/ReadSharp) and hosted without PocketSharp.**
--- ---