32 Commits

Author SHA1 Message Date
swcs ec25258de9 assembly version 2014-04-03 12:00:31 +02:00
swcs 6999185c96 remove unnecessary action in tests 2014-04-03 11:50:12 +02:00
swcs 7669d8880e first running version of new package 2014-04-03 11:45:00 +02:00
swcs 38b6a62686 add new test 2014-04-02 16:57:28 +02:00
swcs 0f7f626d15 update readme 2014-03-13 21:28:22 +01:00
swcs 81f099d419 update version 2014-03-13 21:25:04 +01:00
Stephen Erstad ec006b298d Added test for Json property for PocketItem
Tested that the Json property is set on the retrieved PocketItems and
that they represent a JSON object
2014-03-04 22:35:50 -06:00
Stephen Erstad 4fa0ee29fe Raw JSON on PocketItem Model
Implementation of setting the raw JSON representation of a PocketItem to
the PocketSharp model
2014-03-04 22:12:08 -06:00
swcs c21abd5f21 try to normalize URIs retrieved in video array; update tests; 2014-02-23 21:03:55 +01:00
swcs facba2894d update packages solution-wide 2014-02-21 23:50:24 +01:00
swcs 585c203f9a fix PocketAction conversion exception when no ID is given; fixes #20 2014-02-17 23:30:15 +01:00
swcs 07357b9327 add wp7 project 2014-02-11 21:55:22 +01:00
swcs 75e6a23905 update dependencies 2014-02-10 22:48:35 +01:00
swcs 44c4bc11db update nuspec file 2014-02-07 14:31:09 +01:00
swcs d3d8937c60 update changelog 2014-02-07 14:24:25 +01:00
swcs b2113eb065 allow toggle for disabling mobile param 2014-02-07 14:22:52 +01:00
swcs 13664c4201 fixes #18 - new registration via redirect 2014-02-07 14:12:09 +01:00
swcs 13c98e2d59 fixes #17 2014-02-07 14:10:12 +01:00
swcs 7b14044c53 password has to be at least 6 chars long 2014-02-06 13:28:28 +01:00
swcs 0be1efb2df start new exceptions 2014-01-18 21:36:01 +01:00
swcs 13e029a98a use FullTitle if no title given 2013-12-28 14:03:58 +01:00
swcs c6cf19ba4d bump version 2013-12-27 21:45:09 +01:00
swcs 50c15ad6ce remove exception debug code 2013-12-27 21:34:53 +01:00
swcs 670fecb1e0 respect given_url if no resolved_url is given 2013-12-27 21:34:22 +01:00
swcs 85c4ca2c65 update readme 2013-12-19 11:27:11 +01:00
swcs 0183a727ce update readme 2013-12-19 11:25:51 +01:00
swcs 25bb5028a5 Remove PocketSharp.Reader => moved to ReadSharp
See https://github.com/ceee/ReadSharp if you want to use ReadSharp
2013-12-19 11:24:22 +01:00
swcs 3201160d66 move image extractor into NReadability 2013-12-16 22:08:23 +01:00
swcs 996755ef50 extract images from article in Reader 2013-12-16 21:42:11 +01:00
swcs 6e6cef138a update tests; remove PocketArticle from PocketSharp 2013-12-16 21:11:04 +01:00
swcs bcb833ad0d remove PocketSharp dependency from Reader; move PocketArticle into Reader project; 2013-12-16 21:07:34 +01:00
swcs e33ec074fe PreRequest in IPocketClient 2013-12-15 12:49:45 +01:00
86 changed files with 419 additions and 12939 deletions
+23
View File
@@ -1,3 +1,26 @@
### 3.2.0 (2014-03-13)
- add raw JSON to each PocketItem (PR #22)
### 3.1.1 (2014-02-23)
- fix SendActions when sending _add_ requests (fixes #20)
- try to normalize URIs retrieved in video array
### 3.1.0 (2014-02-07)
- Use FullTitle if no other title props are available
- Default mobile authentication screen with toggle for desktop (fixes #17)
- Use new registration endpoint
### 3.0.2 (2013-12-27)
- assign given_url to `Uri` when item couldn't be resolved by Pocket
### 3.0.1 (2013-12-15)
- added `PreRequest` to interface
### 3.0.0 (2013-12-15)
- `cancellationToken` support for all methods
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2013 cee, Tobias Klika
Copyright (c) 2014 cee, Tobias Klika
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -1,8 +0,0 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="PocketSharp.Silverlight.App"
>
<Application.Resources>
</Application.Resources>
</Application>
@@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace PocketSharp.Silverlight
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}
@@ -1,16 +0,0 @@
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="PocketSharp.Silverlight.MainPage"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Button Content="Load Items" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="380" Height="34" Click="Button_Click"/>
<sdk:DataGrid x:Name="Content" HorizontalAlignment="Left" Height="241" Margin="10,49,0,0" VerticalAlignment="Top" Width="380" FrozenColumnCount="2"/>
</Grid>
</UserControl>
@@ -1,60 +0,0 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace PocketSharp.Silverlight
{
public partial class MainPage : UserControl
{
ObservableCollection<Site> _Sites = new ObservableCollection<Site>();
public ObservableCollection<Site> Sites { get { return _Sites; } }
public class Site
{
public string Url { get; set; }
public string Content { get; set; }
}
public MainPage()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
// !! please don't misuse this account !!
PocketClient client = new PocketClient(
consumerKey: "15396-f6f92101d72c8e270a6c9bb3",
callbackUri: "http://frontendplay.com",
accessCode: "80acf6c5-c198-03c0-b94c-e74402"
);
List<PocketSharp.Models.PocketItem> items = null;
try
{
items = await client.Get();
items.ForEach(item =>
{
Sites.Add(new Site()
{
Content = item.Title,
Url = item.Uri.ToString()
});
});
Content.ItemsSource = Sites;
}
catch (PocketException ex)
{
Debug.WriteLine(ex.Message);
}
}
}
}
@@ -1,169 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.Silverlight</RootNamespace>
<AssemblyName>PocketSharp.Silverlight</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>PocketSharp.Silverlight.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>PocketSharp.Silverlight.App</SilverlightAppEntry>
<TestPageFileName>PocketSharp.SilverlightTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
<ExpressionBlendVersion>12.0.40612.10</ExpressionBlendVersion>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\sl4\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\sl4\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Silverlight">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\sl4\Microsoft.Threading.Tasks.Extensions.Silverlight.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.IO, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.1.1.3\lib\sl5\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.1.1.3\lib\sl5\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.1.1.3\lib\sl5\System.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Windows.Controls.Data" />
<Reference Include="System.Windows.Controls.Data.Input" />
<Reference Include="System.Windows.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PocketSharp\PocketSharp.csproj">
<Project>{817200c3-a327-4e35-9b5f-63a51c088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.10\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.10\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>
</Project>
@@ -1,6 +0,0 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
@@ -1,35 +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("PocketSharp.Silverlight")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PocketSharp.Silverlight")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("656345d2-af4c-4f88-9c9f-ebf54d7691db")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="sl50" />
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="sl50" />
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="sl50" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="sl50" />
</packages>
@@ -1,13 +1,12 @@
using System;
using System.Diagnostics;
using System.Resources;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using PocketSharp.WP8.Resources;
using PocketSharp.WP8.ViewModels;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Navigation;
namespace PocketSharp.WP8
{
@@ -130,6 +130,7 @@
</DesignData>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\AppManifest.xml" />
<None Include="Properties\WMAppManifest.xml">
@@ -4,11 +4,11 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
<bindingRedirect oldVersion="0.0.0.0-2.6.7.0" newVersion="2.6.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
<bindingRedirect oldVersion="0.0.0.0-2.6.7.0" newVersion="2.6.7.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -39,23 +39,25 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\net45\Microsoft.Threading.Tasks.dll</HintPath>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.16\lib\net45\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Net.Http.Extensions, Version=2.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Extensions.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Net.Http.Primitives, Version=4.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Primitives.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Xml" />
@@ -129,10 +131,10 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.10\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.10\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.13\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.13\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>
<!-- 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.
@@ -5,7 +5,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.15.0" newVersion="4.2.15.0" />
<bindingRedirect oldVersion="0.0.0.0-4.2.18.0" newVersion="4.2.18.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.15" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net45" />
</packages>
-35
View File
@@ -1,35 +0,0 @@
using PocketSharp.Models;
using System;
using System.Threading.Tasks;
namespace PocketSharp
{
public interface IPocketReader
{
/// <summary>
/// Reads article content from the given URI.
/// This method does not use the official Article View API, which is private.
/// The PocketReader is based on a custom PCL port of NReadability and SgmlReader.
/// </summary>
/// <param name="uri">An URI.</param>
/// <param name="bodyOnly">if set to <c>true</c> [only body is returned].</param>
/// <param name="noHeadline">if set to <c>true</c> [no headline (h1) is included].</param>
/// <returns>A Pocket article with extracted content and title.</returns>
/// <exception cref="PocketRequestException"></exception>
Task<PocketArticle> Read(Uri uri, bool bodyOnly = true, bool noHeadline = false);
/// <summary>
/// Reads article content from the given PocketItem.
/// This method does not use the official Article View API, which is private.
/// The PocketReader is based on a custom PCL port of NReadability and SgmlReader.
/// </summary>
/// <param name="item">The pocket item.</param>
/// <param name="bodyOnly">if set to <c>true</c> [only body is returned].</param>
/// <param name="noHeadline">if set to <c>true</c> [no headline (h1) is included].</param>
/// <returns>
/// A Pocket article with extracted content and title.
/// </returns>
/// <exception cref="PocketRequestException"></exception>
Task<PocketArticle> Read(PocketItem item, bool bodyOnly = true, bool noHeadline = false);
}
}
-175
View File
@@ -1,175 +0,0 @@
using PocketSharp.Models;
using PocketSharp.Ports.NReadability;
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace PocketSharp
{
/// <summary>
/// PocketReader
/// </summary>
public class PocketReader : IPocketReader
{
/// <summary>
/// Used UserAgent for HTTP request
/// </summary>
protected string _userAgent = "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0; ARM; Mobile; Touch{0}) like Gecko";
/// <summary>
/// REST client used for HTML retrieval
/// </summary>
protected readonly HttpClient _httpClient;
/// <summary>
/// Initializes a new instance of the <see cref="PocketReader" /> class.
/// </summary>
/// <param name="userAgent">Custom UserAgent string.</param>
/// <param name="handler">The HttpMessage handler.</param>
/// <param name="timeout">Request timeout (in seconds).</param>
public PocketReader(string userAgent = null, HttpMessageHandler handler = null, int? timeout = null)
{
// override user agent
if (!string.IsNullOrEmpty(userAgent))
{
_userAgent = userAgent;
}
// initialize HTTP client
_httpClient = new HttpClient(handler ?? new HttpClientHandler()
{
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
AllowAutoRedirect = true
});
if (timeout.HasValue)
{
_httpClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
}
// add accept types
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
// add accepted encodings
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip,deflate");
// add user agent
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", string.Format(_userAgent, "; PocketSharp/3.0"));
}
/// <summary>
/// Reads article content from the given URI.
/// This method does not use the official Article View API, which is private.
/// The PocketReader is based on a custom PCL port of NReadability and SgmlReader.
/// </summary>
/// <param name="uri">An URI.</param>
/// <param name="bodyOnly">if set to <c>true</c> [only body is returned].</param>
/// <param name="noHeadline">if set to <c>true</c> [no headline (h1) is included].</param>
/// <returns>
/// A Pocket article with extracted content and title.
/// </returns>
public async Task<PocketArticle> Read(Uri uri, bool bodyOnly = true, bool noHeadline = false)
{
return await Read(new PocketItem()
{
ID = null,
Uri = uri
}, bodyOnly, noHeadline);
}
/// <summary>
/// Reads article content from the given PocketItem.
/// This method does not use the official Article View API, which is private.
/// The PocketReader is based on a custom PCL port of NReadability and SgmlReader.
/// </summary>
/// <param name="item">The pocket item.</param>
/// <param name="bodyOnly">if set to <c>true</c> [only body is returned].</param>
/// <param name="noHeadline">if set to <c>true</c> [no headline (h1) is included].</param>
/// <returns>
/// A Pocket article with extracted content and title.
/// </returns>
/// <exception cref="PocketRequestException"></exception>
public async Task<PocketArticle> Read(PocketItem item, bool bodyOnly = true, bool noHeadline = false)
{
// initialize transcoder
NReadabilityTranscoder transcoder = new NReadabilityTranscoder(
dontStripUnlikelys: false,
dontNormalizeSpacesInTextContent: true,
dontWeightClasses: false,
readingStyle: ReadingStyle.Ebook,
readingMargin: ReadingMargin.Narrow,
readingSize: ReadingSize.Medium
);
// get HTML string from URI
string htmlResponse = await Request(item.Uri);
// set properties for processing
TranscodingInput transcodingInput = new TranscodingInput(htmlResponse)
{
Url = item.Uri.ToString(),
DomSerializationParams = new DomSerializationParams()
{
BodyOnly = bodyOnly,
NoHeadline = noHeadline,
PrettyPrint = true,
DontIncludeContentTypeMetaElement = true,
DontIncludeMobileSpecificMetaElements = true,
DontIncludeDocTypeMetaElement = false,
DontIncludeGeneratorMetaElement = true
}
};
// process/transcode HTML
TranscodingResult transcodingResult = transcoder.Transcode(transcodingInput);
return new PocketArticle()
{
Content = transcodingResult.ExtractedContent,
Title = transcodingResult.ExtractedTitle,
NextPage = transcodingResult.NextPageUrl != null ? new Uri(transcodingResult.NextPageUrl, UriKind.Absolute) : null,
PocketItemID = item.ID
};
}
/// <summary>
/// Fetches a resource
/// </summary>
/// <param name="uri">The URI.</param>
/// <returns></returns>
protected async Task<string> Request(Uri uri)
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, uri);
HttpResponseMessage response = null;
// make async request
try
{
response = await _httpClient.SendAsync(request);
}
catch (HttpRequestException exc)
{
throw new PocketException(exc.Message, exc);
}
// validate HTTP response
if (response.StatusCode != HttpStatusCode.OK)
{
string exceptionString = String.Format("Request error: {0} ({1})", response.ReasonPhrase, (int)response.StatusCode);
throw new PocketException(exceptionString);
}
// read response
return await response.Content.ReadAsStringAsync();
}
}
}
@@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp</RootNamespace>
<AssemblyName>PocketSharp.Reader</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="IPocketReader.cs" />
<Compile Include="PocketReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.IO">
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl4+win8+wp71\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl4+win8+wp71\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PocketSharp\PocketSharp.csproj">
<Project>{817200c3-a327-4e35-9b5f-63a51c088577}</Project>
<Name>PocketSharp</Name>
</ProjectReference>
<ProjectReference Include="..\PortablePorts\NReadability\NReadability.csproj">
<Project>{14c3ee6a-54a4-4a37-8b56-d52a3802f1c2}</Project>
<Name>NReadability</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.13\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.13\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>
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,28 +0,0 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://raw.github.com/ceee/PocketSharp/master/LICENSE-MIT</licenseUrl>
<projectUrl>https://github.com/ceee/PocketSharp</projectUrl>
<iconUrl>https://raw.github.com/ceee/PocketSharp/master/Assets/pocketsharp.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
<![CDATA[
PocketSharp is a C#.NET portable class library that integrates the Pocket API v3.
PocketSharp.Reader contains the reader which extracts readable content from websites.
]]>
</description>
<language>en-US</language>
<releaseNotes>
<![CDATA[
For full release notes see https://github.com/ceee/PocketSharp/blob/master/CHANGELOG.md
]]>
</releaseNotes>
<copyright>Copyright by cee, 2013</copyright>
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability SgmlReader Reader Article SDK Pockem</tags>
</metadata>
</package>
@@ -1,26 +0,0 @@
using System.Reflection;
// 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("Custom Article View API for PocketSharp")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("cee")]
[assembly: AssemblyProduct("PocketSharp.Reader")]
[assembly: AssemblyCopyright("Copyright © cee 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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("3.0.0")]
[assembly: AssemblyFileVersion("3.0.0")]
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="portable-win+net403+sl40+wp71" />
</packages>
+5 -46
View File
@@ -1,8 +1,6 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
namespace PocketSharp.Tests
{
@@ -12,53 +10,14 @@ namespace PocketSharp.Tests
[Fact]
public async Task IsUserRegistered()
public async Task IsRegistrationURLSuccessfullyCreated()
{
string randomId = ((int)((DateTime)DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds).ToString();
string requestCode = await client.GetRequestCode();
bool success = await client.RegisterAccount("pocket-" + randomId, String.Format("pocketsharp-{0}@outlook.com", randomId), "mypassword");
Uri uri = client.GenerateRegistrationUri(requestCode);
Assert.True(success);
}
[Fact]
public async Task AreInvalidRegistrationsBlocked()
{
await ThrowsAsync<FormatException>(async () =>
{
await client.RegisterAccount("abcdefghijklmnopqrstuvwxyz", "pocketsharp@outlook.com", "mypassword");
});
await ThrowsAsync<FormatException>(async () =>
{
await client.RegisterAccount("oiu_my:o;", "pocketsharp@outlook.com", "mypassword");
});
await ThrowsAsync<FormatException>(async () =>
{
await client.RegisterAccount("myusername", "pocketsharpoutlook.com", "mypassword");
});
await ThrowsAsync<FormatException>(async () =>
{
await client.RegisterAccount("myusername", "pocketsharp@outlook", "mypassword");
});
await ThrowsAsync<FormatException>(async () =>
{
await client.RegisterAccount("myusername", "pocketsharp@outlook,com", "mypassword");
});
await ThrowsAsync<FormatException>(async () =>
{
await client.RegisterAccount("myusername", "pocketsharp@outlook.com", "my");
});
await ThrowsAsync<ArgumentNullException>(async () =>
{
await client.RegisterAccount("myusername", null, "mypassword");
});
Assert.True(uri.OriginalString.Contains(requestCode));
Assert.True(uri.OriginalString.Contains("force=signup"));
}
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ namespace PocketSharp.Tests
PocketItem item = await client.Add(uri);
Assert.Equal<Uri>(uri, item.Uri);
Assert.NotNull(item);
itemsToDelete.Add(item.ID);
}
+35 -2
View File
@@ -1,4 +1,6 @@
using PocketSharp.Models;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -30,6 +32,23 @@ namespace PocketSharp.Tests
Assert.True(item.Uri == itemDuplicate.Uri);
}
[Fact]
public async Task IsItemJsonPopulated()
{
List<PocketItem> items = await client.Get();
string schemaJson = @"{
'description': 'PocketItem',
'type': 'object'
}";
JsonSchema schema = JsonSchema.Parse(schemaJson);
foreach (var pocketItem in items)
{
Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
var jObject = JObject.Parse(pocketItem.Json);
Assert.True(jObject.IsValid(schema));
}
}
[Fact]
public async Task AreFilteredItemsRetrieved()
@@ -217,7 +236,7 @@ namespace PocketSharp.Tests
await client.Unfavorite(itemToModify);
since = DateTime.UtcNow;
since = DateTime.UtcNow.AddMinutes(-1);
await client.Archive(itemToModify);
@@ -246,5 +265,19 @@ namespace PocketSharp.Tests
Assert.True(items.Count == 1 && items[0].IsDeleted);
}
[Fact]
public async Task AreUncachedItemsProperlyResolved()
{
PocketItem item = await client.Add(new Uri("http://de.ign.com/m/feature/21608/die-20-besten-kurzfilme-des-jahres-2013?bust=1"));
List<PocketItem> items = await client.Get(state: State.all);
Assert.NotNull(item.Uri);
Assert.NotNull(items[0].Uri);
Assert.Equal(item.Uri, items[0].Uri);
itemsToDelete.Add(item.ID);
}
}
}
+37 -3
View File
@@ -72,8 +72,7 @@ namespace PocketSharp.Tests
{
new PocketAction() { Action = "favorite", ID = item.ID },
new PocketAction() { Action = "tags_add", ID = item.ID, Tags = new string[] { "new_tag", "another_tag" } },
new PocketAction() { Action = "archive", ID = item.ID },
new PocketAction() { Action = "tag_rename", ID = item.ID, OldTag = "social", NewTag = "not_social" }
new PocketAction() { Action = "archive", ID = item.ID }
});
Assert.True(success);
@@ -84,7 +83,42 @@ namespace PocketSharp.Tests
Assert.True(item.IsArchive);
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "new_tag"));
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "another_tag"));
Assert.NotNull(item.Tags.Single<PocketTag>(tag => tag.Name == "not_social"));
}
[Fact]
public async Task AreMultipleAddActionsSent()
{
PocketItem item = await Setup();
bool success = await client.SendActions(new List<PocketAction>()
{
new PocketAction() { Action = "add", Uri = new Uri("http://msdn.microsoft.com/en-us/library/windows/apps/jj841126.aspx") },
new PocketAction() { Action = "add", Uri = new Uri("http://pokiapp.com/changelog") }
});
Assert.True(success);
}
[Fact]
public async Task AreMultipleActionsOnOneItemPerformed()
{
PocketItem item = await Setup();
bool success = await client.SendActions(new List<PocketAction>()
{
new PocketAction() { Action = "unarchive", ID = item.ID },
new PocketAction() { Action = "archive", ID = item.ID },
new PocketAction() { Action = "unfavorite", ID = item.ID }
});
Assert.True(success);
item = await client.Get(item.ID);
Assert.False(item.IsFavorite);
Assert.True(item.IsArchive);
}
+16 -14
View File
@@ -39,22 +39,29 @@
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.dll</HintPath>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.166\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.166\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.166\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Net.Http.Extensions, Version=2.2.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Extensions.dll</HintPath>
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Net.Http.Primitives, Version=4.2.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\net45\System.Net.Http.Primitives.dll</HintPath>
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="xunit">
@@ -77,15 +84,10 @@
<Compile Include="ModifyTests.cs" />
<Compile Include="GetTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReadTests.cs" />
<Compile Include="StressTests.cs" />
<Compile Include="TestsBase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PocketSharp.Reader\PocketSharp.Reader.csproj">
<Project>{9d1bbd72-c263-43d3-9f2a-98f9f99235a4}</Project>
<Name>PocketSharp.Reader</Name>
</ProjectReference>
<ProjectReference Include="..\PocketSharp\PocketSharp.csproj">
<Project>{817200c3-a327-4e35-9b5f-63a51c088577}</Project>
<Name>PocketSharp</Name>
@@ -124,10 +126,10 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\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)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.13\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.13\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="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" />
</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.
-76
View File
@@ -1,76 +0,0 @@
using PocketSharp.Models;
using System;
using System.Threading.Tasks;
using Xunit;
namespace PocketSharp.Tests
{
public class ReadTests : TestsBase
{
private PocketReader reader;
public ReadTests()
: base()
{
reader = new PocketReader();
}
[Fact]
public async Task ReadArticleTest()
{
PocketArticle result = await reader.Read(new PocketItem()
{
ID = "99",
Uri = new Uri("http://frontendplay.com/story/4/http-caching-demystified-part-2-implementation")
});
Assert.DoesNotContain("<!DOCTYPE html>", result.Content);
Assert.Contains("<h1>", result.Content);
Assert.True(result.Content.Length > 15000);
}
[Fact]
public async Task ReadArticleWithContainerNoHeadlineTest()
{
PocketArticle result = await reader.Read(new PocketItem()
{
ID = "99",
Uri = new Uri("http://frontendplay.com/story/4/http-caching-demystified-part-2-implementation")
}, false, true);
Assert.Contains("<!DOCTYPE html>", result.Content);
Assert.DoesNotContain("<h1>", result.Content);
Assert.True(result.Content.Length > 15000);
}
[Fact]
public async Task ReadArticleWithInvalidUriTest()
{
await ThrowsAsync<PocketException>(async () =>
{
await reader.Read(new PocketItem()
{
ID = "99",
Uri = new Uri("http://frontendplayyyyy.com")
});
});
}
[Fact]
public async Task IsBodyOnlyProperlyResolved()
{
PocketArticle result = await reader.Read(new PocketItem()
{
ID = "99",
Uri = new Uri("http://calebjacob.com/tooltipster/")
});
Assert.True(result.Content.Substring(0, 4) == "<div");
}
}
}
-7
View File
@@ -55,13 +55,6 @@ namespace PocketSharp.Tests
Assert.True(items.Count == 5000);
}
[Fact]
public async Task AreItemsRetrievedProperlyWithoutLimit()
{
List<PocketItem> items = await client.Get(state: State.all);
Assert.True(items.Count > 0);
}
[Fact]
public async Task IsSearchSuccessfullyOnBigList()
{
+1 -1
View File
@@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.18.0" newVersion="4.2.18.0" />
<bindingRedirect oldVersion="0.0.0.0-4.2.19.0" newVersion="4.2.19.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
+5 -4
View File
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.7" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.166" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.19" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.2" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
</packages>
+10 -53
View File
@@ -1,20 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp", "PocketSharp\PocketSharp.csproj", "{817200C3-A327-4E35-9B5F-63A51C088577}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.Wpf", "PocketSharp.Examples\PocketSharp.Wpf\PocketSharp.Wpf.csproj", "{775569C2-987F-4AC4-8BA5-A315A21ED1B7}"
ProjectSection(ProjectDependencies) = postProject
{817200C3-A327-4E35-9B5F-63A51C088577} = {817200C3-A327-4E35-9B5F-63A51C088577}
EndProjectSection
EndProject
# Visual Studio 2013
VisualStudioVersion = 12.0.30324.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PocketSharp.Examples", "PocketSharp.Examples", "{AFD4E3F1-B23C-4924-BA5B-D917FBADB8FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.Silverlight", "PocketSharp.Examples\PocketSharp.Silverlight\PocketSharp.Silverlight.csproj", "{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.WP8", "PocketSharp.Examples\PocketSharp.WP8\PocketSharp.WP8.csproj", "{47721A56-2128-4C5A-8B92-995FFC353304}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.Tests", "PocketSharp.Tests\PocketSharp.Tests.csproj", "{CA3C491B-A8CA-426C-A0BB-E91636767467}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19DD45B5-B849-49E7-89D6-16C89B9B96C7}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
@@ -22,13 +11,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19DD45
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NReadability", "PortablePorts\NReadability\NReadability.csproj", "{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp", "PocketSharp\PocketSharp.csproj", "{817200C3-A327-4E35-9B5F-63A51C088577}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SgmlReader", "PortablePorts\SgmlReader\SgmlReader.csproj", "{9112414C-E2D1-43BA-A298-A89F77D94332}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.Wpf", "PocketSharp.Examples\PocketSharp.Wpf\PocketSharp.Wpf.csproj", "{775569C2-987F-4AC4-8BA5-A315A21ED1B7}"
ProjectSection(ProjectDependencies) = postProject
{817200C3-A327-4E35-9B5F-63A51C088577} = {817200C3-A327-4E35-9B5F-63A51C088577}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PortablePorts", "PortablePorts", "{82F79DE3-76D7-4FCB-AA7E-16BA7E363E0D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.WP8", "PocketSharp.Examples\PocketSharp.WP8\PocketSharp.WP8.csproj", "{47721A56-2128-4C5A-8B92-995FFC353304}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.Reader", "PocketSharp.Reader\PocketSharp.Reader.csproj", "{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketSharp.Tests", "PocketSharp.Tests\PocketSharp.Tests.csproj", "{CA3C491B-A8CA-426C-A0BB-E91636767467}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -57,14 +49,6 @@ Global
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Release|Any CPU.Build.0 = Release|Any CPU
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Release|ARM.ActiveCfg = Release|Any CPU
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Release|x86.ActiveCfg = Release|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Debug|x86.ActiveCfg = Debug|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Release|Any CPU.Build.0 = Release|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Release|ARM.ActiveCfg = Release|Any CPU
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB}.Release|x86.ActiveCfg = Release|Any CPU
{47721A56-2128-4C5A-8B92-995FFC353304}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47721A56-2128-4C5A-8B92-995FFC353304}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47721A56-2128-4C5A-8B92-995FFC353304}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
@@ -91,39 +75,12 @@ Global
{CA3C491B-A8CA-426C-A0BB-E91636767467}.Release|Any CPU.Build.0 = Release|Any CPU
{CA3C491B-A8CA-426C-A0BB-E91636767467}.Release|ARM.ActiveCfg = Release|Any CPU
{CA3C491B-A8CA-426C-A0BB-E91636767467}.Release|x86.ActiveCfg = Release|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Debug|ARM.ActiveCfg = Debug|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Debug|x86.ActiveCfg = Debug|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Release|Any CPU.Build.0 = Release|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Release|ARM.ActiveCfg = Release|Any CPU
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}.Release|x86.ActiveCfg = Release|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Debug|x86.ActiveCfg = Debug|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Release|Any CPU.Build.0 = Release|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Release|ARM.ActiveCfg = Release|Any CPU
{9112414C-E2D1-43BA-A298-A89F77D94332}.Release|x86.ActiveCfg = Release|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Debug|x86.ActiveCfg = Debug|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Release|Any CPU.Build.0 = Release|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Release|ARM.ActiveCfg = Release|Any CPU
{9D1BBD72-C263-43D3-9F2A-98F9F99235A4}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{775569C2-987F-4AC4-8BA5-A315A21ED1B7} = {AFD4E3F1-B23C-4924-BA5B-D917FBADB8FA}
{656345D2-AF4C-4F88-9C9F-EBF54D7691DB} = {AFD4E3F1-B23C-4924-BA5B-D917FBADB8FA}
{47721A56-2128-4C5A-8B92-995FFC353304} = {AFD4E3F1-B23C-4924-BA5B-D917FBADB8FA}
{9112414C-E2D1-43BA-A298-A89F77D94332} = {82F79DE3-76D7-4FCB-AA7E-16BA7E363E0D}
{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2} = {82F79DE3-76D7-4FCB-AA7E-16BA7E363E0D}
EndGlobalSection
EndGlobal
+14 -44
View File
@@ -1,7 +1,6 @@
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@@ -61,7 +60,7 @@ namespace PocketSharp
RequestCode = requestCode;
}
return new Uri(string.Format(authentificationUri, RequestCode, CallbackUri));
return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0"));
}
@@ -103,56 +102,27 @@ namespace PocketSharp
/// <summary>
/// Registers a new account.
/// Account has to be activated via a activation email sent by Pocket.
/// Generate registration URI from requestCode
/// Follow the steps as with GenerateAuthenticationUri, but for unregistered users
/// </summary>
/// <param name="username">The username.</param>
/// <param name="email">The email.</param>
/// <param name="password">The password.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentNullException">All parameters are required</exception>
/// <exception cref="System.FormatException">Invalid email address.
/// or
/// Invalid username. Please only use letters, numbers, and/or dashes and between 1-20 characters.
/// or
/// Invalid password.</exception>
/// <exception cref="PocketException"></exception>
public async Task<bool> RegisterAccount(string username, string email, string password, CancellationToken cancellationToken = default(CancellationToken))
/// <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)
{
if (username == null || email == null || password == null)
// check if request code is available
if (RequestCode == null && requestCode == null)
{
throw new ArgumentNullException("All parameters are required");
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
}
Match matchEmail = Regex.Match(email, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,10}))$");
Match matchUsername = Regex.Match(username, @"^([\w\-_]{1,20})$");
if (!matchEmail.Success)
// override property with given param if available
if (requestCode != null)
{
throw new FormatException("(1) Invalid email address.");
RequestCode = requestCode;
}
if (!matchUsername.Success)
{
throw new FormatException("(2) Invalid username. Please only use letters, numbers, and/or dashes and between 1-20 characters.");
}
if (password.Length < 3)
{
throw new FormatException("(3) Invalid password.");
}
RegisterParameters parameters = new RegisterParameters()
{
Username = username,
Email = email,
Password = password
};
ResponseBase response = await Request<ResponseBase>("signup", cancellationToken, parameters.Convert(), false);
return response.Status;
return new Uri(String.Format("{0}&force=signup", String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0")));
}
}
}
+14
View File
@@ -24,6 +24,20 @@ namespace PocketSharp
}
/// <summary>
/// Sends an action.
/// See: http://getpocket.com/developer/docs/v3/modify
/// </summary>
/// <param name="action">The action.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> SendAction(PocketAction action, CancellationToken cancellationToken = default(CancellationToken))
{
return await Send(new List<PocketAction>() { action }, cancellationToken);
}
/// <summary>
/// Archives the specified item.
/// </summary>
-89
View File
@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="$(NCrunchOriginalSolutionDir) != '' And $(NCrunchOriginalSolutionDir) != '*Undefined*'">
<PropertyGroup>
<FodySolutionDir>$(NCrunchOriginalSolutionDir)</FodySolutionDir>
</PropertyGroup>
</When>
<When Condition="$(SolutionDir) != '' And $(SolutionDir) != '*Undefined*'">
<PropertyGroup>
<FodySolutionDir>$(SolutionDir)</FodySolutionDir>
</PropertyGroup>
</When>
<When Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">
<PropertyGroup>
<FodySolutionDir>$(MSBuildProjectDirectory)\..\</FodySolutionDir>
</PropertyGroup>
</When>
</Choose>
<Choose>
<When Condition="$(KeyOriginatorFile) != '' And $(KeyOriginatorFile) != '*Undefined*'">
<PropertyGroup>
<FodyKeyFilePath>$(KeyOriginatorFile)</FodyKeyFilePath>
</PropertyGroup>
</When>
<When Condition="$(AssemblyOriginatorKeyFile) != '' And $(AssemblyOriginatorKeyFile) != '*Undefined*'">
<PropertyGroup>
<FodyKeyFilePath>$(AssemblyOriginatorKeyFile)</FodyKeyFilePath>
</PropertyGroup>
</When>
<Otherwise >
<PropertyGroup>
<FodyKeyFilePath></FodyKeyFilePath>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<IntermediateDir>$(ProjectDir)$(IntermediateOutputPath)</IntermediateDir>
<FodyMessageImportance Condition="$(FodyMessageImportance) == '' Or $(FodyMessageImportance) == '*Undefined*'">Low</FodyMessageImportance>
<FodySignAssembly Condition="$(FodySignAssembly) == '' Or $(FodySignAssembly) == '*Undefined*'">$(SignAssembly)</FodySignAssembly>
<FodyPath Condition="$(FodyPath) == '' Or $(FodyPath) == '*Undefined*'">$(MSBuildThisFileDirectory)</FodyPath>
</PropertyGroup>
<UsingTask
TaskName="Fody.WeavingTask"
AssemblyFile="$(FodyPath)\Fody.dll" />
<Target
AfterTargets="AfterCompile"
Name="WinFodyTarget"
Condition=" '$(OS)' == 'Windows_NT'">
<Fody.WeavingTask
AssemblyPath="@(IntermediateAssembly)"
IntermediateDir="$(IntermediateDir)"
KeyFilePath="$(FodyKeyFilePath)"
MessageImportance="$(FodyMessageImportance)"
ProjectDirectory="$(ProjectDir)"
SolutionDir="$(FodySolutionDir)"
References="@(ReferencePath)"
SignAssembly="$(FodySignAssembly)"
ReferenceCopyLocalPaths="@(ReferenceCopyLocalPaths)"
DefineConstants="$(DefineConstants)"
/>
</Target>
<Target
AfterTargets="AfterBuild"
Name="NonWinFodyTarget"
Condition=" '$(OS)' != 'Windows_NT'">
<Fody.WeavingTask
AssemblyPath="$(TargetPath)"
IntermediateDir="$(IntermediateDir)"
KeyFilePath="$(FodyKeyFilePath)"
MessageImportance="$(FodyMessageImportance)"
ProjectDirectory="$(ProjectDir)"
SolutionDir="$(FodySolutionDir)"
References="@(ReferencePath)"
SignAssembly="$(FodySignAssembly)"
ReferenceCopyLocalPaths="$(ReferenceCopyLocalPaths)"
DefineConstants="$(DefineConstants)"
/>
</Target>
<!--Support for ncrunch-->
<ItemGroup>
<None Include="$(FodyPath)\*.*" />
</ItemGroup>
</Project>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<PropertyChanged />
</Weavers>
+13 -15
View File
@@ -41,6 +41,14 @@ namespace PocketSharp
/// The access code.
/// </value>
string AccessCode { get; set; }
/// <summary>
/// Action which is executed before every request
/// </summary>
/// <value>
/// The pre request callback.
/// </value>
Action<string> PreRequest { get; set; }
#endregion
#region account methods
@@ -76,22 +84,12 @@ namespace PocketSharp
Task<PocketUser> GetUser(string requestCode = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Registers a new account.
/// Account has to be activated via a activation email sent by Pocket.
/// Generate registration URI from requestCode
/// </summary>
/// <param name="username">The username.</param>
/// <param name="email">The email.</param>
/// <param name="password">The password.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentNullException">All parameters are required</exception>
/// <exception cref="System.FormatException">Invalid email address.
/// or
/// Invalid username. Please only use letters, numbers, and/or dashes and between 1-20 characters.
/// or
/// Invalid password.</exception>
/// <exception cref="PocketException"></exception>
Task<bool> RegisterAccount(string username, string email, string password, CancellationToken cancellationToken = default(CancellationToken));
/// <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>
Uri GenerateRegistrationUri(string requestCode = null);
#endregion
#region add methods
+17 -7
View File
@@ -23,16 +23,26 @@ namespace PocketSharp.Models
Dictionary<string, string> parameterDict = new Dictionary<string, string>();
// get object properties
IEnumerable<PropertyInfo> properties = this.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public)
.Where(p => Attribute.IsDefined(p, typeof(DataMemberAttribute)));
IEnumerable<MemberInfo> properties = this.GetType()
.GetTypeInfo()
.DeclaredMembers
.Where(p => p.CustomAttributes.FirstOrDefault(a => a.AttributeType == typeof(DataMemberAttribute)) != null);
// gather attributes of object
foreach (PropertyInfo propertyInfo in properties)
foreach (MemberInfo memberInfo in properties)
{
DataMemberAttribute attribute = (DataMemberAttribute)propertyInfo.GetCustomAttributes(typeof(DataMemberAttribute), false).FirstOrDefault();
string name = attribute.Name ?? propertyInfo.Name.ToLower();
object value = propertyInfo.GetValue(this, null);
DataMemberAttribute attribute = (DataMemberAttribute)memberInfo.GetCustomAttributes(typeof(DataMemberAttribute), false).FirstOrDefault();
string name = attribute.Name ?? memberInfo.Name.ToLower();
object value = null;
if (memberInfo is FieldInfo)
{
value = ((FieldInfo)memberInfo).GetValue(this);
}
else
{
value = ((PropertyInfo)memberInfo).GetValue(this, null);
}
// invalid parameter
if (value == null)
+1 -1
View File
@@ -105,7 +105,7 @@ namespace PocketSharp.Models
{ "action", Action }
};
if (ID != "0" && !String.IsNullOrEmpty(ID.ToString()))
if (!String.IsNullOrEmpty(ID) && ID != "0")
parameters.Add("item_id", ID.ToString());
if (Time != null)
parameters.Add("time", Time != null ? Utilities.GetUnixTimestamp(Time).ToString() : null);
-44
View File
@@ -1,44 +0,0 @@
using PropertyChanged;
using System;
namespace PocketSharp.Models
{
/// <summary>
/// Readable article
/// </summary>
[ImplementPropertyChanged]
public class PocketArticle
{
/// <summary>
/// Gets or sets the pocket item ID.
/// </summary>
/// <value>
/// The pocket item ID.
/// </value>
public string PocketItemID { get; set; }
/// <summary>
/// Gets or sets the content.
/// </summary>
/// <value>
/// The content.
/// </value>
public string Content { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the next page URL.
/// </summary>
/// <value>
/// The next page URL.
/// </value>
public Uri NextPage { get; set; }
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
using Newtonsoft.Json;
using System;
using PropertyChanged;
using System;
namespace PocketSharp.Models
{
+1 -1
View File
@@ -1,6 +1,6 @@
using Newtonsoft.Json;
using System;
using PropertyChanged;
using System;
namespace PocketSharp.Models
{
+22 -3
View File
@@ -13,6 +13,7 @@ namespace PocketSharp.Models
[JsonObject]
[ImplementPropertyChanged]
[DebuggerDisplay("Uri = {Uri}, Title = {Title}")]
public class PocketItem
{
/// <summary>
@@ -42,6 +43,15 @@ namespace PocketSharp.Models
[JsonProperty("normal_url")]
private Uri _NormalUri { get; set; }
/// <summary>
/// Gets or sets the given URI.
/// </summary>
/// <value>
/// The given URI.
/// </value>
[JsonProperty("given_url")]
private Uri _GivenUri { get; set; }
/// <summary>
/// Gets or sets the resolved URI.
/// </summary>
@@ -60,8 +70,8 @@ namespace PocketSharp.Models
[JsonIgnore]
public Uri Uri
{
get { return _ResolvedUri ?? _NormalUri; }
set { _NormalUri = value; _ResolvedUri = value; }
get { return _ResolvedUri ?? _GivenUri ?? _NormalUri; }
set { _NormalUri = value; _ResolvedUri = value; _GivenUri = value; }
}
/// <summary>
@@ -91,7 +101,7 @@ namespace PocketSharp.Models
[JsonIgnore]
public string Title
{
get { return _InternalTitle ?? _ResolvedTitle; }
get { return _InternalTitle ?? _ResolvedTitle ?? FullTitle; }
set { _InternalTitle = value; _ResolvedTitle = value; }
}
@@ -343,5 +353,14 @@ namespace PocketSharp.Models
{
get { return Images != null && Images.Count > 0 ? Images[0] : 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; }
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
using Newtonsoft.Json;
using System;
using PropertyChanged;
using System;
namespace PocketSharp.Models
{
+17 -2
View File
@@ -39,7 +39,12 @@ namespace PocketSharp
/// <summary>
/// The authentification URL
/// </summary>
protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}";
protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile={2}";
/// <summary>
/// Indicates, whether this client is used for mobile or desktop
/// </summary>
protected bool isMobileClient = true;
/// <summary>
/// callback URLi for API calls
@@ -91,11 +96,20 @@ namespace PocketSharp
/// <param name="callbackUri">The callback URL is called by Pocket after authentication</param>
/// <param name="handler">The HttpMessage handler.</param>
/// <param name="timeout">Request timeout (in seconds).</param>
public PocketClient(string consumerKey, string accessCode = null, string callbackUri = null, HttpMessageHandler handler = null, int? timeout = null)
/// <param name="isMobileClient">Indicates, whether this client is used for mobile or desktop</param>
public PocketClient(
string consumerKey,
string accessCode = null,
string callbackUri = null,
HttpMessageHandler handler = null,
int? timeout = null,
bool isMobileClient = true)
{
// assign public properties
ConsumerKey = consumerKey;
this.isMobileClient = isMobileClient;
// assign access code if submitted
if (accessCode != null)
{
@@ -213,6 +227,7 @@ namespace PocketSharp
},
Converters =
{
new PocketItemConverter(),
new BoolConverter(),
new UnixDateTimeConverter(),
new NullableIntConverter(),
+50 -30
View File
@@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{817200C3-A327-4E35-9B5F-63A51C088577}</ProjectGuid>
@@ -10,13 +10,33 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp</RootNamespace>
<AssemblyName>PocketSharp</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<FodyPath>..\packages\Fody.1.17.4.0</FodyPath>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>10f8a946</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -37,17 +57,17 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="Fody.targets" />
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Components\Statistics.cs" />
<Compile Include="IPocketClient.cs" />
<Compile Include="Models\Parameters\RegisterParameters.cs" />
<Compile Include="Models\PocketArticle.cs" />
<Compile Include="Models\PocketBoolean.cs" />
<Compile Include="Models\PocketLimits.cs" />
<Compile Include="Models\PocketStatistics.cs" />
<Compile Include="Utilities\PocketAuthException.cs" />
<Compile Include="Utilities\PocketException.cs" />
<Compile Include="Components\Add.cs" />
<Compile Include="Components\Account.cs" />
@@ -73,44 +93,43 @@
<Compile Include="Models\Response\Retrieve.cs" />
<Compile Include="PocketClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\PocketLimitException.cs" />
<Compile Include="Utilities\PocketRequestException.cs" />
<Compile Include="Utilities\Utilities.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.5.0.8\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\portable-net40+sl5+wp80+win8+monotouch+monoandroid\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PropertyChanged">
<HintPath>..\packages\PropertyChanged.Fody.1.41.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath>
<HintPath>..\packages\PropertyChanged.Fody.1.48.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.IO">
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl4+win8+wp71\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll</HintPath>
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl4+win8+wp71\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll</HintPath>
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
@@ -118,12 +137,13 @@
<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>
<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'))" />
</Target>
<Import Project="Fody.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<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')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.13\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.13\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="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" />
</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.
+3 -3
View File
@@ -17,7 +17,7 @@
For full release notes see https://github.com/ceee/PocketSharp/blob/master/CHANGELOG.md
]]>
</releaseNotes>
<copyright>Copyright by cee, 2013</copyright>
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability SgmlReader Reader Article SDK Pockem</tags>
<copyright>Copyright by cee, 2014</copyright>
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee Scott Lovegrove scottisafool NReadability SgmlReader Reader Article SDK Pockem</tags>
</metadata>
</package>
</package>
+3 -3
View File
@@ -8,7 +8,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("cee")]
[assembly: AssemblyProduct("PocketSharp")]
[assembly: AssemblyCopyright("Copyright © cee 2013")]
[assembly: AssemblyCopyright("Copyright © cee 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -22,5 +22,5 @@
// 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("3.0.0")]
[assembly: AssemblyFileVersion("3.0.0")]
[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.0")]
+42 -5
View File
@@ -3,6 +3,7 @@ using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using PocketSharp.Models;
namespace PocketSharp
{
@@ -79,9 +80,24 @@ namespace PocketSharp
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.String && Uri.IsWellFormedUriString(reader.Value.ToString(), UriKind.Absolute))
if (reader.TokenType != JsonToken.String)
{
return new Uri(reader.Value.ToString());
return null;
}
string value = reader.Value.ToString();
if (Uri.IsWellFormedUriString(value, UriKind.Absolute))
{
return new Uri(value);
}
else if (value.StartsWith("//") && Uri.IsWellFormedUriString("http:" + value, UriKind.Absolute))
{
return new Uri("http:" + value);
}
else if (value.StartsWith("www.") && Uri.IsWellFormedUriString("http://" + value, UriKind.Absolute))
{
return new Uri("http://" + value);
}
return null;
@@ -114,7 +130,6 @@ namespace PocketSharp
JObject jObject;
List<T> result = new List<T>();
T target;
// object is an array
if (reader.TokenType == JsonToken.StartArray)
{
@@ -137,8 +152,7 @@ namespace PocketSharp
// Populate the object properties
foreach (KeyValuePair<string, JToken> item in jObject)
{
target = new T();
serializer.Populate(item.Value.CreateReader(), target);
target = serializer.Deserialize<T>(item.Value.CreateReader());
result.Add(target);
}
@@ -154,5 +168,28 @@ namespace PocketSharp
{
return new List<T>();
}
}
public class PocketItemConverter : CustomCreationConverter<PocketItem>
{
public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)
{
var jObject = JObject.ReadFrom(reader);
var pocketItem = new PocketItem();
serializer.Populate(jObject.CreateReader(), pocketItem);
pocketItem.Json = jObject.ToString();
return pocketItem;
}
public override PocketItem Create(Type objectType)
{
return new PocketItem();
}
}
}
@@ -0,0 +1,7 @@
namespace PocketSharp
{
public class PocketAuthException : PocketException
{
}
}
@@ -0,0 +1,7 @@
namespace PocketSharp
{
public class PocketLimitException : PocketException
{
}
}
@@ -0,0 +1,7 @@
namespace PocketSharp
{
public class PocketRequestException : PocketException
{
}
}
+15
View File
@@ -0,0 +1,15 @@
<?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>
+6 -7
View File
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fody" version="1.17.4.0" targetFramework="portable-net403+sl40+wp71+win" />
<package id="Microsoft.Bcl" version="1.1.6" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Microsoft.Net.Http" version="2.2.18" targetFramework="portable-win+net403+sl40+wp71" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="portable-net45+sl40+wp71+win" />
<package id="PropertyChanged.Fody" version="1.41.0.0" targetFramework="portable-net403+sl40+wp71+win" />
<package id="Fody" version="1.22.1" targetFramework="portable-net403+sl50+win+wp80" developmentDependency="true" />
<package id="Microsoft.Bcl" version="1.1.7" targetFramework="portable-net403+sl50+win+wpa81+wp80" requireReinstallation="True" />
<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="Newtonsoft.Json" version="6.0.2" targetFramework="portable-net403+sl50+win+wp80" requireReinstallation="True" />
<package id="PropertyChanged.Fody" version="1.48.0.0" targetFramework="portable-net403+sl50+win+wp80" developmentDependency="true" requireReinstallation="True" />
</packages>
@@ -1,11 +0,0 @@
using System.Xml.Linq;
namespace PocketSharp.Ports.NReadability
{
public class AttributeTransformationInput
{
public string AttributeValue { get; set; }
public XElement Element { get; set; }
}
}
@@ -1,15 +0,0 @@
namespace PocketSharp.Ports.NReadability
{
public class AttributeTransformationResult
{
/// <summary>
/// Result of the transformation.
/// </summary>
public string TransformedValue { get; set; }
/// <summary>
/// Name of the attribute that will be used to store the original value. Can be null.
/// </summary>
public string OriginalValueAttributeName { get; set; }
}
}
@@ -1,67 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Xml.Linq;
namespace PocketSharp.Ports.NReadability
{
internal class ChildNodesTraverser
{
private readonly Action<XNode> _childNodeVisitor;
#region Constructor(s)
public ChildNodesTraverser(Action<XNode> childNodeVisitor)
{
if (childNodeVisitor == null)
{
throw new ArgumentNullException("childNodeVisitor");
}
_childNodeVisitor = childNodeVisitor;
}
#endregion
#region Public methods
public void Traverse(XNode node)
{
if (!(node is XContainer))
{
throw new ArgumentException("The node must be an XContainer in order to traverse its children.");
}
var childNode = ((XContainer)node).FirstNode;
while (childNode != null)
{
var nextChildNode = childNode.NextNode;
_childNodeVisitor(childNode);
childNode = nextChildNode;
}
}
#endregion
}
}
-28
View File
@@ -1,28 +0,0 @@
using System.Reflection;
namespace PocketSharp.Ports.NReadability
{
public static class Consts
{
private static readonly string _nReadabilityFullName;
#region Constructor(s)
static Consts()
{
_nReadabilityFullName = string.Format("NReadability {0}", Assembly.GetExecutingAssembly().FullName);
}
#endregion
#region Properties
public static string NReadabilityFullName
{
get { return _nReadabilityFullName; }
}
#endregion
}
}
-303
View File
@@ -1,303 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace PocketSharp.Ports.NReadability
{
public static class DomExtensions
{
#region XDocument extensions
public static XElement GetBody(this XDocument document)
{
if (document == null)
{
throw new ArgumentNullException("document");
}
var documentRoot = document.Root;
if (documentRoot == null)
{
return null;
}
return documentRoot.GetElementsByTagName("body").FirstOrDefault();
}
public static string GetTitle(this XDocument document)
{
if (document == null)
{
throw new ArgumentNullException("document");
}
var documentRoot = document.Root;
if (documentRoot == null)
{
return null;
}
var headElement = documentRoot.GetElementsByTagName("head").FirstOrDefault();
if (headElement == null)
{
return "";
}
var titleElement = headElement.GetChildrenByTagName("title").FirstOrDefault();
if (titleElement == null)
{
return "";
}
return (titleElement.Value ?? "").Trim();
}
public static XElement GetElementById(this XDocument document, string id)
{
if (document == null)
{
throw new ArgumentNullException("document");
}
if (string.IsNullOrEmpty(id))
{
throw new ArgumentNullException("id");
}
return
(from element in document.Descendants()
let idAttribute = element.Attribute("id")
where idAttribute != null && idAttribute.Value == id
select element).SingleOrDefault();
}
#endregion
#region XElement extensions
public static string GetId(this XElement element)
{
return element.GetAttributeValue("id", "");
}
public static void SetId(this XElement element, string id)
{
element.SetAttributeValue("id", id);
}
public static string GetClass(this XElement element)
{
return element.GetAttributeValue("class", "");
}
public static void SetClass(this XElement element, string @class)
{
element.SetAttributeValue("class", @class);
}
public static string GetStyle(this XElement element)
{
return element.GetAttributeValue("style", "");
}
public static void SetStyle(this XElement element, string style)
{
element.SetAttributeValue("style", style);
}
public static string GetAttributeValue(this XElement element, string attributeName, string defaultValue)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (string.IsNullOrEmpty(attributeName))
{
throw new ArgumentNullException("attributeName");
}
var attribute = element.Attribute(attributeName);
return attribute != null
? (attribute.Value ?? defaultValue)
: defaultValue;
}
public static void SetAttributeValue(this XElement element, string attributeName, string value)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (string.IsNullOrEmpty(attributeName))
{
throw new ArgumentNullException("attributeName");
}
if (value == null)
{
var attribute = element.Attribute(attributeName);
if (attribute != null)
{
attribute.Remove();
}
}
else
{
element.SetAttributeValue(attributeName, value);
}
}
public static string GetAttributesString(this XElement element, string separator)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (separator == null)
{
throw new ArgumentNullException("separator");
}
var resultSb = new StringBuilder();
bool isFirst = true;
element.Attributes().Aggregate(
resultSb,
(sb, attribute) =>
{
string attributeValue = attribute.Value;
if (string.IsNullOrEmpty(attributeValue))
{
return sb;
}
if (!isFirst)
{
resultSb.Append(separator);
}
isFirst = false;
sb.Append(attribute.Value);
return sb;
});
return resultSb.ToString();
}
public static string GetInnerHtml(this XContainer container)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
var resultSb = new StringBuilder();
foreach (var childNode in container.Nodes())
{
resultSb.Append(childNode.ToString(SaveOptions.DisableFormatting));
}
return resultSb.ToString();
}
public static void SetInnerHtml(this XElement element, string html)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
if (html == null)
{
throw new ArgumentNullException("html");
}
element.RemoveAll();
var tmpElement = new SgmlDomBuilder().BuildDocument(html);
if (tmpElement.Root == null)
{
return;
}
foreach (var node in tmpElement.Root.Nodes())
{
element.Add(node);
}
}
#endregion
#region XContainer extensions
public static IEnumerable<XElement> GetElementsByTagName(this XContainer container, string tagName)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
if (string.IsNullOrEmpty(tagName))
{
throw new ArgumentNullException("tagName");
}
return container.Descendants()
.Where(e => tagName.Equals(e.Name.LocalName, StringComparison.OrdinalIgnoreCase));
}
public static IEnumerable<XElement> GetChildrenByTagName(this XContainer container, string tagName)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
if (string.IsNullOrEmpty(tagName))
{
throw new ArgumentNullException("tagName");
}
return container.Elements()
.Where(e => e.Name != null && tagName.Equals(e.Name.LocalName, StringComparison.OrdinalIgnoreCase));
}
#endregion
}
}
@@ -1,56 +0,0 @@
namespace PocketSharp.Ports.NReadability
{
public class DomSerializationParams
{
#region Factory methods
/// <summary>
/// Creates an instance of DomSerializationParams with parameters set to their defaults.
/// </summary>
public static DomSerializationParams CreateDefault()
{
return new DomSerializationParams();
}
#endregion
#region Properties
/// <summary>
/// Determines whether the output will be formatted.
/// </summary>
public bool PrettyPrint { get; set; }
/// <summary>
/// Determines whether DOCTYPE will be included at the beginning of the output.
/// </summary>
public bool DontIncludeContentTypeMetaElement { get; set; }
/// <summary>
/// Determines whether mobile-specific elements (such as eg. meta HandheldFriendly) will be added/replaced in the output.
/// </summary>
public bool DontIncludeMobileSpecificMetaElements { get; set; }
/// <summary>
/// Determines whether a meta tag with a content-type specification will be added/replaced in the output.
/// </summary>
public bool DontIncludeDocTypeMetaElement { get; set; }
/// <summary>
/// Determines whether a meta tag with a generator specification will be added/replaced in the output.
/// </summary>
public bool DontIncludeGeneratorMetaElement { get; set; }
/// <summary>
/// Render complete Website or only the Body
/// </summary>
public bool BodyOnly { get; set; }
/// <summary>
/// Remove headline of website
/// </summary>
public bool NoHeadline { get; set; }
#endregion
}
}
@@ -1,67 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Xml.Linq;
namespace PocketSharp.Ports.NReadability
{
public class ElementsTraverser
{
private readonly Action<XElement> _elementVisitor;
#region Constructor(s)
public ElementsTraverser(Action<XElement> elementVisitor)
{
if (elementVisitor == null)
{
throw new ArgumentNullException("elementVisitor");
}
_elementVisitor = elementVisitor;
}
#endregion
#region Public methods
public void Traverse(XElement element)
{
_elementVisitor(element);
var childNode = element.FirstNode;
while (childNode != null)
{
var nextChildNode = childNode.NextNode;
if (childNode is XElement)
{
Traverse((XElement)childNode);
}
childNode = nextChildNode;
}
}
#endregion
}
}
@@ -1,62 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using System.Text;
namespace PocketSharp.Ports.NReadability
{
internal class EncodedStringWriter : StringWriter
{
private static readonly Encoding _DefaultEncoding = Encoding.UTF8;
private readonly Encoding _encoding;
#region Constructor(s)
public EncodedStringWriter(StringBuilder sb, Encoding encoding)
: base(sb)
{
if (encoding == null)
{
throw new ArgumentNullException("encoding");
}
_encoding = encoding;
}
public EncodedStringWriter(StringBuilder sb)
: this(sb, _DefaultEncoding)
{
}
#endregion
#region Properties
public override Encoding Encoding
{
get { return _encoding; }
}
#endregion
}
}
@@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace PocketSharp.Ports.NReadability
{
public static class EnumerableExtensions
{
/// <summary>
/// Returns the only one element in the sequence or default(T) if either the sequence doesn't contain any elements or it contains more than one element.
/// </summary>
public static T SingleOrNone<T>(this IEnumerable<T> enumerable)
where T : class
{
// ReSharper disable PossibleMultipleEnumeration
if (enumerable == null)
{
throw new ArgumentNullException("enumerable");
}
T firstElement = enumerable.FirstOrDefault();
if (firstElement == null)
{
// no elements
return null;
}
T secondElement = enumerable.Skip(1).FirstOrDefault();
if (secondElement != null)
{
// more than one element
return null;
}
return firstElement;
// ReSharper restore PossibleMultipleEnumeration
}
}
}
-110
View File
@@ -1,110 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace PocketSharp.Ports.NReadability
{
/// <summary>
/// Determines how the extracted article will be styled.
/// </summary>
public enum ReadingStyle
{
/// <summary>
/// Newspaper style.
/// </summary>
Newspaper,
/// <summary>
/// Novel style.
/// </summary>
Novel,
/// <summary>
/// Ebook style.
/// </summary>
Ebook,
/// <summary>
/// Terminal style.
/// </summary>
Terminal,
}
/// <summary>
/// Determines how wide the margin of the extracted article will be.
/// </summary>
public enum ReadingMargin
{
/// <summary>
/// Extra-narrow margin.
/// </summary>
XNarrow,
/// <summary>
/// Narrow margin.
/// </summary>
Narrow,
/// <summary>
/// Medium margin.
/// </summary>
Medium,
/// <summary>
/// Wide margin.
/// </summary>
Wide,
/// <summary>
/// Extra-wide margin.
/// </summary>
XWide,
}
/// <summary>
/// Determines how large the font of the extracted article will be.
/// </summary>
public enum ReadingSize
{
/// <summary>
/// Extra-small font.
/// </summary>
XSmall,
/// <summary>
/// Small font.
/// </summary>
Small,
/// <summary>
/// Medium font.
/// </summary>
Medium,
/// <summary>
/// Large font.
/// </summary>
Large,
/// <summary>
/// Extra-large font.
/// </summary>
XLarge,
}
}
-40
View File
@@ -1,40 +0,0 @@
using System;
namespace PocketSharp.Ports.NReadability
{
public static class HtmlUtils
{
public static string RemoveScriptTags(string htmlContent)
{
if (htmlContent == null)
{
throw new ArgumentNullException("htmlContent");
}
if (htmlContent.Length == 0)
{
return "";
}
int indexOfScriptTagStart = htmlContent.IndexOf("<script", StringComparison.OrdinalIgnoreCase);
if (indexOfScriptTagStart == -1)
{
return htmlContent;
}
int indexOfScriptTagEnd = htmlContent.IndexOf("</script>", indexOfScriptTagStart, StringComparison.OrdinalIgnoreCase);
if (indexOfScriptTagEnd == -1)
{
return htmlContent.Substring(0, indexOfScriptTagStart);
}
string strippedHtmlContent =
htmlContent.Substring(0, indexOfScriptTagStart) +
htmlContent.Substring(indexOfScriptTagEnd + "</script>".Length);
return RemoveScriptTags(strippedHtmlContent);
}
}
}
@@ -1,62 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Runtime.Serialization;
namespace PocketSharp.Ports.NReadability
{
/// <summary>
/// An exception that is thrown when an internal error occurrs in the application.
/// Internal error in the application means that there is a bug in the application.
/// </summary>
public class InternalErrorException : Exception
{
#region Constructor(s)
/// <summary>
/// Initializes a new instance of the InternalErrorException class with a specified error message and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
public InternalErrorException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Initializes a new instance of the InternalErrorException class with a specified error message.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public InternalErrorException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the InternalErrorException class.
/// </summary>
public InternalErrorException()
{
}
#endregion
}
}
@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{14C3EE6A-54A4-4A37-8B56-D52A3802F1C2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.Ports.NReadability</RootNamespace>
<AssemblyName>PocketSharp.Ports.NReadability</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<EmbeddedResource Include="Resources\readability.css" />
</ItemGroup>
<ItemGroup>
<Compile Include="AttributeTransformationInput.cs" />
<Compile Include="AttributeTransformationResult.cs" />
<Compile Include="ChildNodesTraverser.cs" />
<Compile Include="Consts.cs" />
<Compile Include="DomExtensions.cs" />
<Compile Include="DomSerializationParams.cs" />
<Compile Include="ElementsTraverser.cs" />
<Compile Include="EncodedStringWriter.cs" />
<Compile Include="EnumerableExtensions.cs" />
<Compile Include="Enums.cs" />
<Compile Include="HtmlUtils.cs" />
<Compile Include="InternalErrorException.cs" />
<Compile Include="NReadabilityTranscoder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SgmlDomBuilder.cs" />
<Compile Include="SgmlDomSerializer.cs" />
<Compile Include="TranscodingInput.cs" />
<Compile Include="TranscodingResult.cs" />
<Compile Include="UtilityExtensions.cs" />
<Compile Include="WebTranscodingInput.cs" />
<Compile Include="WebTranscodingResult.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SgmlReader\SgmlReader.csproj">
<Project>{9112414c-e2d1-43ba-a298-a89f77d94332}</Project>
<Name>SgmlReader</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
File diff suppressed because it is too large Load Diff
@@ -1,30 +0,0 @@
using System.Resources;
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("NReadabilityPCL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NReadabilityPCL")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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")]
@@ -1,82 +0,0 @@
/* Document */
body {font-size: 100%;}
#readability-logo,#arc90-logo,.footer-twitterLink,#readTools a,a.rdbTK-powered span{background-color:transparent!important;background-image:url(http://lab.arc90.com/experiments/readability/images/sprite-readability.png)!important;background-repeat:no-repeat!important;}
#readOverlay {display:block;position:absolute;top:0;left:0;width:100%;}
#readInner {line-height:1.4em;max-width:800px;margin:1em auto;}
#readInner a {color:#039;text-decoration:none;}
#readInner a:hover {text-decoration:underline;}
#readInner img {float:left;clear:both;margin: 0 12px 12px 0;}
#readInner h1 {display:block;width:100%;border-bottom:1px solid #333;font-size:1.2em;padding-bottom:.5em;margin-top:0;margin-bottom:.75em;}
#readInner sup{line-height:.8em;}
#readInner .page-separator{clear:both;display:block;font-size:.85em;filter:alpha(opacity=20);opacity:.20;text-align:center;}
.style-apertura #readInner h1 {border-bottom-color:#ededed;}
#readInner blockquote {margin-left:3em;margin-right:3em;}
#readability-inner * {margin-bottom:16px;border:none;background:none;}
/* Footer */
#readFooter {display:block;border-top:1px solid #333;text-align:center;clear:both;overflow:hidden;}
.style-apertura #readFooter {border-top-color:#ededed;}
#rdb-footer-left {display:inline;float:left;margin-top:15px;width:285px;background-position:0 -36px;}
.rdbTypekit #rdb-footer-left {width:475px;}
#rdb-footer-left a,#rdb-footer-left a:link {float:left;}
#readability-logo {display:inline;background-position:0 -36px;height:29px;width:189px;text-indent:-9000px;}
#arc90-logo {display:inline;background-position:right -36px;height:29px;width:96px;text-indent:-9000px;}
#readability-url {display:none;}
.style-apertura #readability-logo {background-position:0 -67px;}
.style-apertura #arc90-logo {background-position:right -67px;}
#rdb-footer-right {display:inline;float:right;text-align:right;font-size:.75em;margin-top:18px;}
#rdb-footer-right a {display:inline-block;float:left;overflow:visible;line-height:16px;vertical-align:baseline;}
.footer-twitterLink {height:20px;margin-left:20px;padding:4px 0 0 28px;background-position:0 -123px;font-size:12px;}
#rdb-footer-left .footer-twitterLink {display:none;margin-top:1px;padding-top:2px;}
.rdbTypekit #rdb-footer-right .footer-twitterLink {display:none;}
.rdbTypekit #rdb-footer-left .footer-twitterLink {display:inline-block!important;}
a.rdbTK-powered,a.rdbTK-powered:link,a.rdbTK-powered:hover {font-size:16px;color:#858789!important;text-decoration:none!important;}
a.rdbTK-powered span {display:inline-block;height:22px;margin-left:2px;padding:4px 0 0 26px;background-position:0 -146px!important;}
.style-apertura #rdb-inverse,.style-athelas #rdb-athelas {display:block;}
span.version {display:none;}
/* Tools */
#readTools {width:34px;height:150px;position:fixed;z-index:100;top:10px;left:10px;}
#readTools a {overflow:hidden;margin-bottom:8px;display:block;opacity:.4;text-indent:-99999px;height:34px;width:34px;text-decoration:none;filter:alpha(opacity=40);}
#reload-page {background-position:0 0;}
#print-page {background-position:-36px 0;}
#email-page {background-position:-72px 0;}
#kindle-page {background-position:-108px 0;}
#readTools a:hover {opacity:1;filter:alpha(opacity=100);}
/* -- USER-CONFIGURABLE STYLING -- */
/* Size */
.size-x-small {font-size:.75em;}
.size-small {font-size:.938em;}
.size-medium {font-size:1.125em;}
.size-large {font-size:1.375em;}
.size-x-large {font-size:1.75em;}
/* Style */
.style-newspaper {font-family:"Times New Roman", Times, serif;background:#fbfbfb;color:#080000;}
.style-newspaper h1 {text-transform:capitalize;font-family:Georgia, "Times New Roman", Times, serif;}
.style-newspaper #readInner a {color:#0924e1;}
.style-novel {font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;background:#f4eed9;color:#1d1916;}
.style-novel #readInner a {color:#1856ba;}
.style-ebook {font-family:Arial, Helvetica, sans-serif;background:#edebe8;color:#2c2d32;}
.style-ebook #readInner a {color:#187dc9;}
.style-ebook h1 {font-family:"Arial Black", Gadget, sans-serif;font-weight:400;}
.style-terminal {font-family:"Lucida Console", Monaco, monospace;background:#1d4e2c;color:#c6ffc6;}
.style-terminal #readInner a {color:#093;}
/* Typekit */
.style-apertura {font-family:"apertura-1", "apertura-2", sans-serif;background-color:#2d2828;color:#eae8e9;}
.style-apertura #readInner a {color:#58b0ff;}
.style-athelas {font-family:"athelas-1", "athelas-2", "Palatino Linotype", "Book Antiqua", Palatino, serif;background-color:#f7f7f7;color:#2b373d;}
.style-athelas #readInner a {color:#1e83cb;}
/* Margin */
.margin-x-narrow {width:95%;}
.margin-narrow {width:85%;}
.margin-medium {width:75%;}
.margin-wide {width:55%;}
.margin-x-wide {width:35%;}
/* -- USER-CONFIGURABLE STYLING -- */
/* -- DEBUG -- */
.bug-green {background:#bbf9b0;border:4px solid green;}
.bug-red {background:red;}
.bug-yellow {background:#ffff8e;}
.bug-blue {background:#bfdfff;}
/* -- EMAIL / KINDLE POP UP -- */
#kindle-container, #email-container {position:fixed;top:60px;left:50%;width:500px;height:490px;border:solid 3px #666;background-color:#fff;z-index:100!important;overflow:hidden;margin:0 0 0 -240px;padding:0;}
/* Override html styling attributes */
table, tr, td { background-color: transparent !important; }
@@ -1,114 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
using PocketSharp.Ports.Sgml;
using System.IO;
namespace PocketSharp.Ports.NReadability
{
/// <summary>
/// A class for constructing a DOM from HTML markup.
/// </summary>
public class SgmlDomBuilder
{
#region Public methods
/// <summary>
/// Constructs a DOM (System.Xml.Linq.XDocument) from HTML markup.
/// </summary>
/// <param name="htmlContent">HTML markup from which the DOM is to be constructed.</param>
/// <returns>System.Linq.Xml.XDocument instance which is a DOM of the provided HTML markup.</returns>
public XDocument BuildDocument(string htmlContent)
{
if (htmlContent == null)
{
throw new ArgumentNullException("htmlContent");
}
if (htmlContent.Trim().Length == 0)
{
return new XDocument();
}
// "trim end" htmlContent to ...</html>$ (codinghorror.com puts some scripts after the </html> - sic!)
const string htmlEnd = "</html";
int indexOfHtmlEnd = htmlContent.LastIndexOf(htmlEnd);
if (indexOfHtmlEnd != -1)
{
int indexOfHtmlEndBracket = htmlContent.IndexOf('>', indexOfHtmlEnd);
if (indexOfHtmlEndBracket != -1)
{
htmlContent = htmlContent.Substring(0, indexOfHtmlEndBracket + 1);
}
}
XDocument document;
try
{
document = LoadDocument(htmlContent);
}
catch (InvalidOperationException exc)
{
// sometimes SgmlReader doesn't handle <script> tags well and XDocument.Load() throws,
// so we can retry with the html content with <script> tags stripped off
if (!exc.Message.Contains("EndOfFile"))
{
throw;
}
htmlContent = HtmlUtils.RemoveScriptTags(htmlContent);
document = LoadDocument(htmlContent);
}
return document;
}
private static XDocument LoadDocument(string htmlContent)
{
using (var sgmlReader = new SgmlReader())
{
sgmlReader.CaseFolding = CaseFolding.ToLower;
sgmlReader.DocType = "HTML";
sgmlReader.WhitespaceHandling = WhitespaceHandling.None;
using (var sr = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(htmlContent))))
{
sgmlReader.InputStream = sr;
var document = XDocument.Load(sgmlReader);
return document;
}
}
}
#endregion
}
}
@@ -1,218 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Linq;
using System.Xml.Linq;
namespace PocketSharp.Ports.NReadability
{
/// <summary>
/// A class for serializing a DOM to string.
/// </summary>
public class SgmlDomSerializer
{
#region Public methods
/// <summary>
/// Serializes given DOM (System.Xml.Linq.XDocument object) to a string.
/// </summary>
/// <param name="document">System.Xml.Linq.XDocument instance containing the DOM to be serialized.</param>
/// <param name="domSerializationParams">Contains parameters that modify the behaviour of the output serialization.</param>
/// <param name="bodyOnly">if set to <c>true</c> [returns body only].</param>
/// <returns>
/// Serialized representation of the DOM.
/// </returns>
/// <exception cref="System.ArgumentException">
/// The document must have a root.
/// or
/// The document's root must be an html element.
/// </exception>
public string SerializeDocument(XDocument document, DomSerializationParams domSerializationParams)
{
if (!domSerializationParams.DontIncludeContentTypeMetaElement
|| !domSerializationParams.DontIncludeMobileSpecificMetaElements
|| !domSerializationParams.DontIncludeGeneratorMetaElement)
{
var documentRoot = document.Root;
if (documentRoot == null)
{
throw new ArgumentException("The document must have a root.");
}
if (documentRoot.Name == null || !"html".Equals(documentRoot.Name.LocalName, StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException("The document's root must be an html element.");
}
// add <head> element if not present
var headElement = documentRoot.GetChildrenByTagName("head").FirstOrDefault();
if (headElement == null)
{
headElement = new XElement("head");
documentRoot.AddFirst(headElement);
}
ProcessMetaElements(headElement, domSerializationParams);
}
string result = document.ToString(domSerializationParams.PrettyPrint ? SaveOptions.None : SaveOptions.DisableFormatting);
if (!domSerializationParams.DontIncludeDocTypeMetaElement)
{
result = "<!DOCTYPE html>\r\n" + result;
}
if (domSerializationParams.BodyOnly && document.Root != null)
{
var body = document.Root.GetElementsByTagName("body").FirstOrDefault();
if (body != null)
{
result = body.GetInnerHtml();
}
}
if (domSerializationParams.NoHeadline)
{
var h1 = document.Root.GetElementsByTagName("h1").FirstOrDefault();
if (h1 != null)
{
result = result.Replace(h1.ToString(), "");
}
}
return result;
}
/// <summary>
/// Serializes given DOM (System.Xml.Linq.XDocument object) to a string.
/// </summary>
/// <param name="document">System.Xml.Linq.XDocument instance containing the DOM to be serialized.</param>
/// <returns>Serialized representation of the DOM.</returns>
public string SerializeDocument(XDocument document)
{
return SerializeDocument(document, DomSerializationParams.CreateDefault());
}
#endregion
#region Private helper methods
private static void ProcessMetaElements(XElement headElement, DomSerializationParams domSerializationParams)
{
ProcessMetaContentTypeElement(headElement, domSerializationParams);
ProcessMobileSpecificMetaElements(headElement, domSerializationParams);
ProcessMetaGeneratorElement(headElement, domSerializationParams);
}
private static void ProcessMetaContentTypeElement(XElement headElement, DomSerializationParams domSerializationParams)
{
if (!domSerializationParams.DontIncludeContentTypeMetaElement)
{
XElement metaContentTypeElement =
(from metaElement in headElement.GetChildrenByTagName("meta")
where "content-type".Equals(metaElement.GetAttributeValue("http-equiv", ""), StringComparison.OrdinalIgnoreCase)
select metaElement).FirstOrDefault();
// remove meta 'http-equiv' element if present
if (metaContentTypeElement != null)
{
metaContentTypeElement.Remove();
}
// add <meta name="http-equiv" ... /> element
metaContentTypeElement =
new XElement(
XName.Get("meta", headElement.Name != null ? (headElement.Name.NamespaceName ?? "") : ""),
new XAttribute("http-equiv", "Content-Type"),
new XAttribute("content", "text/html; charset=utf-8"));
headElement.AddFirst(metaContentTypeElement);
}
}
private static void ProcessMobileSpecificMetaElements(XElement headElement, DomSerializationParams domSerializationParams)
{
XElement metaViewportElement =
(from metaElement in headElement.GetChildrenByTagName("meta")
where "viewport".Equals(metaElement.GetAttributeValue("name", ""), StringComparison.OrdinalIgnoreCase)
select metaElement).FirstOrDefault();
// remove meta 'viewport' element if present
if (metaViewportElement != null)
{
metaViewportElement.Remove();
}
XElement metaHandheldFriendlyElement =
(from metaElement in headElement.GetChildrenByTagName("meta")
where "HandheldFriendly".Equals(metaElement.GetAttributeValue("name", ""), StringComparison.OrdinalIgnoreCase)
select metaElement).FirstOrDefault();
// remove meta 'HandheldFriendly' element if present
if (metaHandheldFriendlyElement != null)
{
metaHandheldFriendlyElement.Remove();
}
if (!domSerializationParams.DontIncludeMobileSpecificMetaElements)
{
// add <meta name="HandheldFriendly" ... /> element
metaHandheldFriendlyElement = new XElement(
XName.Get("meta", headElement.Name != null ? (headElement.Name.NamespaceName ?? "") : ""),
new XAttribute("name", "HandheldFriendly"),
new XAttribute("content", "true"));
headElement.AddFirst(metaHandheldFriendlyElement);
}
}
private static void ProcessMetaGeneratorElement(XElement headElement, DomSerializationParams domSerializationParams)
{
if (!domSerializationParams.DontIncludeGeneratorMetaElement)
{
XElement metaGeneratorElement =
(from metaElement in headElement.GetChildrenByTagName("meta")
where "Generator".Equals(metaElement.GetAttributeValue("name", ""), StringComparison.OrdinalIgnoreCase)
select metaElement).FirstOrDefault();
// remove meta 'generator' element if present
if (metaGeneratorElement != null)
{
metaGeneratorElement.Remove();
}
// add <meta name="Generator" ... /> element
metaGeneratorElement = new XElement(
XName.Get("meta", headElement.Name != null ? (headElement.Name.NamespaceName ?? "") : ""),
new XAttribute("name", "Generator"),
new XAttribute("content", Consts.NReadabilityFullName));
headElement.AddFirst(metaGeneratorElement);
}
}
#endregion
}
}
@@ -1,29 +0,0 @@
using System;
namespace PocketSharp.Ports.NReadability
{
public class TranscodingInput
{
private DomSerializationParams _domSerializationParams;
public TranscodingInput(string htmlContent)
{
if (string.IsNullOrEmpty(htmlContent))
{
throw new ArgumentException("Argument can't be null nor empty.", "htmlContent");
}
HtmlContent = htmlContent;
}
public string HtmlContent { get; private set; }
public string Url { get; set; }
public DomSerializationParams DomSerializationParams
{
get { return _domSerializationParams ?? (_domSerializationParams = DomSerializationParams.CreateDefault()); }
set { _domSerializationParams = value; }
}
}
}
@@ -1,26 +0,0 @@
using System;
using System.Xml.Linq;
namespace PocketSharp.Ports.NReadability
{
public class TranscodingResult
{
public TranscodingResult(bool contentExtracted, bool titleExtracted)
{
ContentExtracted = contentExtracted;
TitleExtracted = titleExtracted;
}
public bool ContentExtracted { get; private set; }
public bool TitleExtracted { get; private set; }
public string ExtractedContent { get; set; }
public string ExtractedTitle { get; set; }
public string NextPageUrl { get; set; }
public XDocument RawDocument { get; set; }
}
}
@@ -1,45 +0,0 @@
/*
* NReadability
* http://code.google.com/p/nreadability/
*
* Copyright 2010 Marek Stój
* http://immortal.pl/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
namespace PocketSharp.Ports.NReadability
{
internal static class UtilityExtensions
{
#region Public methods
public static bool IsCloseToZero(this float x)
{
return Math.Abs(x) < float.Epsilon;
}
public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
{
foreach (var element in enumerable)
{
action(element);
}
}
#endregion
}
}
@@ -1,27 +0,0 @@
using System;
namespace PocketSharp.Ports.NReadability
{
public class WebTranscodingInput
{
private DomSerializationParams _domSerializationParams;
public WebTranscodingInput(string url)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentException("Argument can't be null nor empty.", "url");
}
Url = url;
}
public string Url { get; private set; }
public DomSerializationParams DomSerializationParams
{
get { return _domSerializationParams ?? (_domSerializationParams = DomSerializationParams.CreateDefault()); }
set { _domSerializationParams = value; }
}
}
}
@@ -1,19 +0,0 @@
namespace PocketSharp.Ports.NReadability
{
public class WebTranscodingResult
{
public WebTranscodingResult(bool contentExtracted, bool titleExtracted)
{
ContentExtracted = contentExtracted;
TitleExtracted = titleExtracted;
}
public bool ContentExtracted { get; private set; }
public bool TitleExtracted { get; private set; }
public string ExtractedContent { get; set; }
public string ExtractedTitle { get; set; }
}
}
-77
View File
@@ -1,77 +0,0 @@
<!-- Special characters for HTML -->
<!-- Character entity set. Typical invocation:
<!ENTITY % HTMLspecial PUBLIC
"-//W3C//ENTITIES Special//EN//HTML">
%HTMLspecial; -->
<!-- Portions (C) International Organization for Standardization 1986:
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Relevant ISO entity set is given unless names are newly introduced.
New names (i.e., not in ISO 8879 list) do not clash with any
existing ISO 8879 entity names. ISO 10646 character numbers
are given for each character, in hex. CDATA values are decimal
conversions of the ISO 10646 values and refer to the document
character set. Names are ISO 10646 names.
-->
<!-- C0 Controls and Basic Latin -->
<!ENTITY quot CDATA "&#34;" -- quotation mark = APL quote,
U+0022 ISOnum -->
<!ENTITY amp CDATA "&#38;" -- ampersand, U+0026 ISOnum -->
<!ENTITY lt CDATA "&#60;" -- less-than sign, U+003C ISOnum -->
<!ENTITY gt CDATA "&#62;" -- greater-than sign, U+003E ISOnum -->
<!-- Latin Extended-A -->
<!ENTITY OElig CDATA "&#338;" -- latin capital ligature OE,
U+0152 ISOlat2 -->
<!ENTITY oelig CDATA "&#339;" -- latin small ligature oe, U+0153 ISOlat2 -->
<!-- ligature is a misnomer, this is a separate character in some languages -->
<!ENTITY Scaron CDATA "&#352;" -- latin capital letter S with caron,
U+0160 ISOlat2 -->
<!ENTITY scaron CDATA "&#353;" -- latin small letter s with caron,
U+0161 ISOlat2 -->
<!ENTITY Yuml CDATA "&#376;" -- latin capital letter Y with diaeresis,
U+0178 ISOlat2 -->
<!-- Spacing Modifier Letters -->
<!ENTITY circ CDATA "&#710;" -- modifier letter circumflex accent,
U+02C6 ISOpub -->
<!ENTITY tilde CDATA "&#732;" -- small tilde, U+02DC ISOdia -->
<!-- General Punctuation -->
<!ENTITY ensp CDATA "&#8194;" -- en space, U+2002 ISOpub -->
<!ENTITY emsp CDATA "&#8195;" -- em space, U+2003 ISOpub -->
<!ENTITY thinsp CDATA "&#8201;" -- thin space, U+2009 ISOpub -->
<!ENTITY zwnj CDATA "&#8204;" -- zero width non-joiner,
U+200C NEW RFC 2070 -->
<!ENTITY zwj CDATA "&#8205;" -- zero width joiner, U+200D NEW RFC 2070 -->
<!ENTITY lrm CDATA "&#8206;" -- left-to-right mark, U+200E NEW RFC 2070 -->
<!ENTITY rlm CDATA "&#8207;" -- right-to-left mark, U+200F NEW RFC 2070 -->
<!ENTITY ndash CDATA "&#8211;" -- en dash, U+2013 ISOpub -->
<!ENTITY mdash CDATA "&#8212;" -- em dash, U+2014 ISOpub -->
<!ENTITY lsquo CDATA "&#8216;" -- left single quotation mark,
U+2018 ISOnum -->
<!ENTITY rsquo CDATA "&#8217;" -- right single quotation mark,
U+2019 ISOnum -->
<!ENTITY sbquo CDATA "&#8218;" -- single low-9 quotation mark, U+201A NEW -->
<!ENTITY ldquo CDATA "&#8220;" -- left double quotation mark,
U+201C ISOnum -->
<!ENTITY rdquo CDATA "&#8221;" -- right double quotation mark,
U+201D ISOnum -->
<!ENTITY bdquo CDATA "&#8222;" -- double low-9 quotation mark, U+201E NEW -->
<!ENTITY dagger CDATA "&#8224;" -- dagger, U+2020 ISOpub -->
<!ENTITY Dagger CDATA "&#8225;" -- double dagger, U+2021 ISOpub -->
<!ENTITY permil CDATA "&#8240;" -- per mille sign, U+2030 ISOtech -->
<!ENTITY lsaquo CDATA "&#8249;" -- single left-pointing angle quotation mark,
U+2039 ISO proposed -->
<!-- lsaquo is proposed but not yet ISO standardized -->
<!ENTITY rsaquo CDATA "&#8250;" -- single right-pointing angle quotation mark,
U+203A ISO proposed -->
<!-- rsaquo is proposed but not yet ISO standardized -->
<!ENTITY euro CDATA "&#8364;" -- euro sign, U+20AC NEW -->
-241
View File
@@ -1,241 +0,0 @@
<!-- Mathematical, Greek and Symbolic characters for HTML -->
<!-- Character entity set. Typical invocation:
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols//EN//HTML">
%HTMLsymbol; -->
<!-- Portions (C) International Organization for Standardization 1986:
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Relevant ISO entity set is given unless names are newly introduced.
New names (i.e., not in ISO 8879 list) do not clash with any
existing ISO 8879 entity names. ISO 10646 character numbers
are given for each character, in hex. CDATA values are decimal
conversions of the ISO 10646 values and refer to the document
character set. Names are ISO 10646 names.
-->
<!-- Latin Extended-B -->
<!ENTITY fnof CDATA "&#402;" -- latin small f with hook = function
= florin, U+0192 ISOtech -->
<!-- Greek -->
<!ENTITY Alpha CDATA "&#913;" -- greek capital letter alpha, U+0391 -->
<!ENTITY Beta CDATA "&#914;" -- greek capital letter beta, U+0392 -->
<!ENTITY Gamma CDATA "&#915;" -- greek capital letter gamma,
U+0393 ISOgrk3 -->
<!ENTITY Delta CDATA "&#916;" -- greek capital letter delta,
U+0394 ISOgrk3 -->
<!ENTITY Epsilon CDATA "&#917;" -- greek capital letter epsilon, U+0395 -->
<!ENTITY Zeta CDATA "&#918;" -- greek capital letter zeta, U+0396 -->
<!ENTITY Eta CDATA "&#919;" -- greek capital letter eta, U+0397 -->
<!ENTITY Theta CDATA "&#920;" -- greek capital letter theta,
U+0398 ISOgrk3 -->
<!ENTITY Iota CDATA "&#921;" -- greek capital letter iota, U+0399 -->
<!ENTITY Kappa CDATA "&#922;" -- greek capital letter kappa, U+039A -->
<!ENTITY Lambda CDATA "&#923;" -- greek capital letter lambda,
U+039B ISOgrk3 -->
<!ENTITY Mu CDATA "&#924;" -- greek capital letter mu, U+039C -->
<!ENTITY Nu CDATA "&#925;" -- greek capital letter nu, U+039D -->
<!ENTITY Xi CDATA "&#926;" -- greek capital letter xi, U+039E ISOgrk3 -->
<!ENTITY Omicron CDATA "&#927;" -- greek capital letter omicron, U+039F -->
<!ENTITY Pi CDATA "&#928;" -- greek capital letter pi, U+03A0 ISOgrk3 -->
<!ENTITY Rho CDATA "&#929;" -- greek capital letter rho, U+03A1 -->
<!-- there is no Sigmaf, and no U+03A2 character either -->
<!ENTITY Sigma CDATA "&#931;" -- greek capital letter sigma,
U+03A3 ISOgrk3 -->
<!ENTITY Tau CDATA "&#932;" -- greek capital letter tau, U+03A4 -->
<!ENTITY Upsilon CDATA "&#933;" -- greek capital letter upsilon,
U+03A5 ISOgrk3 -->
<!ENTITY Phi CDATA "&#934;" -- greek capital letter phi,
U+03A6 ISOgrk3 -->
<!ENTITY Chi CDATA "&#935;" -- greek capital letter chi, U+03A7 -->
<!ENTITY Psi CDATA "&#936;" -- greek capital letter psi,
U+03A8 ISOgrk3 -->
<!ENTITY Omega CDATA "&#937;" -- greek capital letter omega,
U+03A9 ISOgrk3 -->
<!ENTITY alpha CDATA "&#945;" -- greek small letter alpha,
U+03B1 ISOgrk3 -->
<!ENTITY beta CDATA "&#946;" -- greek small letter beta, U+03B2 ISOgrk3 -->
<!ENTITY gamma CDATA "&#947;" -- greek small letter gamma,
U+03B3 ISOgrk3 -->
<!ENTITY delta CDATA "&#948;" -- greek small letter delta,
U+03B4 ISOgrk3 -->
<!ENTITY epsilon CDATA "&#949;" -- greek small letter epsilon,
U+03B5 ISOgrk3 -->
<!ENTITY zeta CDATA "&#950;" -- greek small letter zeta, U+03B6 ISOgrk3 -->
<!ENTITY eta CDATA "&#951;" -- greek small letter eta, U+03B7 ISOgrk3 -->
<!ENTITY theta CDATA "&#952;" -- greek small letter theta,
U+03B8 ISOgrk3 -->
<!ENTITY iota CDATA "&#953;" -- greek small letter iota, U+03B9 ISOgrk3 -->
<!ENTITY kappa CDATA "&#954;" -- greek small letter kappa,
U+03BA ISOgrk3 -->
<!ENTITY lambda CDATA "&#955;" -- greek small letter lambda,
U+03BB ISOgrk3 -->
<!ENTITY mu CDATA "&#956;" -- greek small letter mu, U+03BC ISOgrk3 -->
<!ENTITY nu CDATA "&#957;" -- greek small letter nu, U+03BD ISOgrk3 -->
<!ENTITY xi CDATA "&#958;" -- greek small letter xi, U+03BE ISOgrk3 -->
<!ENTITY omicron CDATA "&#959;" -- greek small letter omicron, U+03BF NEW -->
<!ENTITY pi CDATA "&#960;" -- greek small letter pi, U+03C0 ISOgrk3 -->
<!ENTITY rho CDATA "&#961;" -- greek small letter rho, U+03C1 ISOgrk3 -->
<!ENTITY sigmaf CDATA "&#962;" -- greek small letter final sigma,
U+03C2 ISOgrk3 -->
<!ENTITY sigma CDATA "&#963;" -- greek small letter sigma,
U+03C3 ISOgrk3 -->
<!ENTITY tau CDATA "&#964;" -- greek small letter tau, U+03C4 ISOgrk3 -->
<!ENTITY upsilon CDATA "&#965;" -- greek small letter upsilon,
U+03C5 ISOgrk3 -->
<!ENTITY phi CDATA "&#966;" -- greek small letter phi, U+03C6 ISOgrk3 -->
<!ENTITY chi CDATA "&#967;" -- greek small letter chi, U+03C7 ISOgrk3 -->
<!ENTITY psi CDATA "&#968;" -- greek small letter psi, U+03C8 ISOgrk3 -->
<!ENTITY omega CDATA "&#969;" -- greek small letter omega,
U+03C9 ISOgrk3 -->
<!ENTITY thetasym CDATA "&#977;" -- greek small letter theta symbol,
U+03D1 NEW -->
<!ENTITY upsih CDATA "&#978;" -- greek upsilon with hook symbol,
U+03D2 NEW -->
<!ENTITY piv CDATA "&#982;" -- greek pi symbol, U+03D6 ISOgrk3 -->
<!-- General Punctuation -->
<!ENTITY bull CDATA "&#8226;" -- bullet = black small circle,
U+2022 ISOpub -->
<!-- bullet is NOT the same as bullet operator, U+2219 -->
<!ENTITY hellip CDATA "&#8230;" -- horizontal ellipsis = three dot leader,
U+2026 ISOpub -->
<!ENTITY prime CDATA "&#8242;" -- prime = minutes = feet, U+2032 ISOtech -->
<!ENTITY Prime CDATA "&#8243;" -- double prime = seconds = inches,
U+2033 ISOtech -->
<!ENTITY oline CDATA "&#8254;" -- overline = spacing overscore,
U+203E NEW -->
<!ENTITY frasl CDATA "&#8260;" -- fraction slash, U+2044 NEW -->
<!-- Letterlike Symbols -->
<!ENTITY weierp CDATA "&#8472;" -- script capital P = power set
= Weierstrass p, U+2118 ISOamso -->
<!ENTITY image CDATA "&#8465;" -- blackletter capital I = imaginary part,
U+2111 ISOamso -->
<!ENTITY real CDATA "&#8476;" -- blackletter capital R = real part symbol,
U+211C ISOamso -->
<!ENTITY trade CDATA "&#8482;" -- trade mark sign, U+2122 ISOnum -->
<!ENTITY alefsym CDATA "&#8501;" -- alef symbol = first transfinite cardinal,
U+2135 NEW -->
<!-- alef symbol is NOT the same as hebrew letter alef,
U+05D0 although the same glyph could be used to depict both characters -->
<!-- Arrows -->
<!ENTITY larr CDATA "&#8592;" -- leftwards arrow, U+2190 ISOnum -->
<!ENTITY uarr CDATA "&#8593;" -- upwards arrow, U+2191 ISOnum-->
<!ENTITY rarr CDATA "&#8594;" -- rightwards arrow, U+2192 ISOnum -->
<!ENTITY darr CDATA "&#8595;" -- downwards arrow, U+2193 ISOnum -->
<!ENTITY harr CDATA "&#8596;" -- left right arrow, U+2194 ISOamsa -->
<!ENTITY crarr CDATA "&#8629;" -- downwards arrow with corner leftwards
= carriage return, U+21B5 NEW -->
<!ENTITY lArr CDATA "&#8656;" -- leftwards double arrow, U+21D0 ISOtech -->
<!-- ISO 10646 does not say that lArr is the same as the 'is implied by' arrow
but also does not have any other character for that function. So ? lArr can
be used for 'is implied by' as ISOtech suggests -->
<!ENTITY uArr CDATA "&#8657;" -- upwards double arrow, U+21D1 ISOamsa -->
<!ENTITY rArr CDATA "&#8658;" -- rightwards double arrow,
U+21D2 ISOtech -->
<!-- ISO 10646 does not say this is the 'implies' character but does not have
another character with this function so ?
rArr can be used for 'implies' as ISOtech suggests -->
<!ENTITY dArr CDATA "&#8659;" -- downwards double arrow, U+21D3 ISOamsa -->
<!ENTITY hArr CDATA "&#8660;" -- left right double arrow,
U+21D4 ISOamsa -->
<!-- Mathematical Operators -->
<!ENTITY forall CDATA "&#8704;" -- for all, U+2200 ISOtech -->
<!ENTITY part CDATA "&#8706;" -- partial differential, U+2202 ISOtech -->
<!ENTITY exist CDATA "&#8707;" -- there exists, U+2203 ISOtech -->
<!ENTITY empty CDATA "&#8709;" -- empty set = null set = diameter,
U+2205 ISOamso -->
<!ENTITY nabla CDATA "&#8711;" -- nabla = backward difference,
U+2207 ISOtech -->
<!ENTITY isin CDATA "&#8712;" -- element of, U+2208 ISOtech -->
<!ENTITY notin CDATA "&#8713;" -- not an element of, U+2209 ISOtech -->
<!ENTITY ni CDATA "&#8715;" -- contains as member, U+220B ISOtech -->
<!-- should there be a more memorable name than 'ni'? -->
<!ENTITY prod CDATA "&#8719;" -- n-ary product = product sign,
U+220F ISOamsb -->
<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
the same glyph might be used for both -->
<!ENTITY sum CDATA "&#8721;" -- n-ary sumation, U+2211 ISOamsb -->
<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
though the same glyph might be used for both -->
<!ENTITY minus CDATA "&#8722;" -- minus sign, U+2212 ISOtech -->
<!ENTITY lowast CDATA "&#8727;" -- asterisk operator, U+2217 ISOtech -->
<!ENTITY radic CDATA "&#8730;" -- square root = radical sign,
U+221A ISOtech -->
<!ENTITY prop CDATA "&#8733;" -- proportional to, U+221D ISOtech -->
<!ENTITY infin CDATA "&#8734;" -- infinity, U+221E ISOtech -->
<!ENTITY ang CDATA "&#8736;" -- angle, U+2220 ISOamso -->
<!ENTITY and CDATA "&#8743;" -- logical and = wedge, U+2227 ISOtech -->
<!ENTITY or CDATA "&#8744;" -- logical or = vee, U+2228 ISOtech -->
<!ENTITY cap CDATA "&#8745;" -- intersection = cap, U+2229 ISOtech -->
<!ENTITY cup CDATA "&#8746;" -- union = cup, U+222A ISOtech -->
<!ENTITY int CDATA "&#8747;" -- integral, U+222B ISOtech -->
<!ENTITY there4 CDATA "&#8756;" -- therefore, U+2234 ISOtech -->
<!ENTITY sim CDATA "&#8764;" -- tilde operator = varies with = similar to,
U+223C ISOtech -->
<!-- tilde operator is NOT the same character as the tilde, U+007E,
although the same glyph might be used to represent both -->
<!ENTITY cong CDATA "&#8773;" -- approximately equal to, U+2245 ISOtech -->
<!ENTITY asymp CDATA "&#8776;" -- almost equal to = asymptotic to,
U+2248 ISOamsr -->
<!ENTITY ne CDATA "&#8800;" -- not equal to, U+2260 ISOtech -->
<!ENTITY equiv CDATA "&#8801;" -- identical to, U+2261 ISOtech -->
<!ENTITY le CDATA "&#8804;" -- less-than or equal to, U+2264 ISOtech -->
<!ENTITY ge CDATA "&#8805;" -- greater-than or equal to,
U+2265 ISOtech -->
<!ENTITY sub CDATA "&#8834;" -- subset of, U+2282 ISOtech -->
<!ENTITY sup CDATA "&#8835;" -- superset of, U+2283 ISOtech -->
<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
font encoding and is not included. Should it be, for symmetry?
It is in ISOamsn -->
<!ENTITY nsub CDATA "&#8836;" -- not a subset of, U+2284 ISOamsn -->
<!ENTITY sube CDATA "&#8838;" -- subset of or equal to, U+2286 ISOtech -->
<!ENTITY supe CDATA "&#8839;" -- superset of or equal to,
U+2287 ISOtech -->
<!ENTITY oplus CDATA "&#8853;" -- circled plus = direct sum,
U+2295 ISOamsb -->
<!ENTITY otimes CDATA "&#8855;" -- circled times = vector product,
U+2297 ISOamsb -->
<!ENTITY perp CDATA "&#8869;" -- up tack = orthogonal to = perpendicular,
U+22A5 ISOtech -->
<!ENTITY sdot CDATA "&#8901;" -- dot operator, U+22C5 ISOamsb -->
<!-- dot operator is NOT the same character as U+00B7 middle dot -->
<!-- Miscellaneous Technical -->
<!ENTITY lceil CDATA "&#8968;" -- left ceiling = apl upstile,
U+2308 ISOamsc -->
<!ENTITY rceil CDATA "&#8969;" -- right ceiling, U+2309 ISOamsc -->
<!ENTITY lfloor CDATA "&#8970;" -- left floor = apl downstile,
U+230A ISOamsc -->
<!ENTITY rfloor CDATA "&#8971;" -- right floor, U+230B ISOamsc -->
<!ENTITY lang CDATA "&#9001;" -- left-pointing angle bracket = bra,
U+2329 ISOtech -->
<!-- lang is NOT the same character as U+003C 'less than'
or U+2039 'single left-pointing angle quotation mark' -->
<!ENTITY rang CDATA "&#9002;" -- right-pointing angle bracket = ket,
U+232A ISOtech -->
<!-- rang is NOT the same character as U+003E 'greater than'
or U+203A 'single right-pointing angle quotation mark' -->
<!-- Geometric Shapes -->
<!ENTITY loz CDATA "&#9674;" -- lozenge, U+25CA ISOpub -->
<!-- Miscellaneous Symbols -->
<!ENTITY spades CDATA "&#9824;" -- black spade suit, U+2660 ISOpub -->
<!-- black here seems to mean filled as opposed to hollow -->
<!ENTITY clubs CDATA "&#9827;" -- black club suit = shamrock,
U+2663 ISOpub -->
<!ENTITY hearts CDATA "&#9829;" -- black heart suit = valentine,
U+2665 ISOpub -->
<!ENTITY diams CDATA "&#9830;" -- black diamond suit, U+2666 ISOpub -->
File diff suppressed because it is too large Load Diff
@@ -1,30 +0,0 @@
using System.Resources;
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("SgmlReader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SgmlReader")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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")]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9112414C-E2D1-43BA-A298-A89F77D94332}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PocketSharp.Ports.SgmlReader</RootNamespace>
<AssemblyName>PocketSharp.Ports.SgmlReader</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<EmbeddedResource Include="Html.dtd" />
</ItemGroup>
<ItemGroup>
<Compile Include="SgmlParser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SgmlReader.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-194
View File
@@ -1,194 +0,0 @@
<!-- Portions (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % HTMLlat1 PUBLIC
"-//W3C//ENTITIES Latin 1//EN//HTML">
%HTMLlat1;
-->
<!ENTITY nbsp CDATA "&#160;" -- no-break space = non-breaking space,
U+00A0 ISOnum -->
<!ENTITY iexcl CDATA "&#161;" -- inverted exclamation mark, U+00A1 ISOnum -->
<!ENTITY cent CDATA "&#162;" -- cent sign, U+00A2 ISOnum -->
<!ENTITY pound CDATA "&#163;" -- pound sign, U+00A3 ISOnum -->
<!ENTITY curren CDATA "&#164;" -- currency sign, U+00A4 ISOnum -->
<!ENTITY yen CDATA "&#165;" -- yen sign = yuan sign, U+00A5 ISOnum -->
<!ENTITY brvbar CDATA "&#166;" -- broken bar = broken vertical bar,
U+00A6 ISOnum -->
<!ENTITY sect CDATA "&#167;" -- section sign, U+00A7 ISOnum -->
<!ENTITY uml CDATA "&#168;" -- diaeresis = spacing diaeresis,
U+00A8 ISOdia -->
<!ENTITY copy CDATA "&#169;" -- copyright sign, U+00A9 ISOnum -->
<!ENTITY ordf CDATA "&#170;" -- feminine ordinal indicator, U+00AA ISOnum -->
<!ENTITY laquo CDATA "&#171;" -- left-pointing double angle quotation mark
= left pointing guillemet, U+00AB ISOnum -->
<!ENTITY not CDATA "&#172;" -- not sign, U+00AC ISOnum -->
<!ENTITY shy CDATA "&#173;" -- soft hyphen = discretionary hyphen,
U+00AD ISOnum -->
<!ENTITY reg CDATA "&#174;" -- registered sign = registered trade mark sign,
U+00AE ISOnum -->
<!ENTITY macr CDATA "&#175;" -- macron = spacing macron = overline
= APL overbar, U+00AF ISOdia -->
<!ENTITY deg CDATA "&#176;" -- degree sign, U+00B0 ISOnum -->
<!ENTITY plusmn CDATA "&#177;" -- plus-minus sign = plus-or-minus sign,
U+00B1 ISOnum -->
<!ENTITY sup2 CDATA "&#178;" -- superscript two = superscript digit two
= squared, U+00B2 ISOnum -->
<!ENTITY sup3 CDATA "&#179;" -- superscript three = superscript digit three
= cubed, U+00B3 ISOnum -->
<!ENTITY acute CDATA "&#180;" -- acute accent = spacing acute,
U+00B4 ISOdia -->
<!ENTITY micro CDATA "&#181;" -- micro sign, U+00B5 ISOnum -->
<!ENTITY para CDATA "&#182;" -- pilcrow sign = paragraph sign,
U+00B6 ISOnum -->
<!ENTITY middot CDATA "&#183;" -- middle dot = Georgian comma
= Greek middle dot, U+00B7 ISOnum -->
<!ENTITY cedil CDATA "&#184;" -- cedilla = spacing cedilla, U+00B8 ISOdia -->
<!ENTITY sup1 CDATA "&#185;" -- superscript one = superscript digit one,
U+00B9 ISOnum -->
<!ENTITY ordm CDATA "&#186;" -- masculine ordinal indicator,
U+00BA ISOnum -->
<!ENTITY raquo CDATA "&#187;" -- right-pointing double angle quotation mark
= right pointing guillemet, U+00BB ISOnum -->
<!ENTITY frac14 CDATA "&#188;" -- vulgar fraction one quarter
= fraction one quarter, U+00BC ISOnum -->
<!ENTITY frac12 CDATA "&#189;" -- vulgar fraction one half
= fraction one half, U+00BD ISOnum -->
<!ENTITY frac34 CDATA "&#190;" -- vulgar fraction three quarters
= fraction three quarters, U+00BE ISOnum -->
<!ENTITY iquest CDATA "&#191;" -- inverted question mark
= turned question mark, U+00BF ISOnum -->
<!ENTITY Agrave CDATA "&#192;" -- latin capital letter A with grave
= latin capital letter A grave,
U+00C0 ISOlat1 -->
<!ENTITY Aacute CDATA "&#193;" -- latin capital letter A with acute,
U+00C1 ISOlat1 -->
<!ENTITY Acirc CDATA "&#194;" -- latin capital letter A with circumflex,
U+00C2 ISOlat1 -->
<!ENTITY Atilde CDATA "&#195;" -- latin capital letter A with tilde,
U+00C3 ISOlat1 -->
<!ENTITY Auml CDATA "&#196;" -- latin capital letter A with diaeresis,
U+00C4 ISOlat1 -->
<!ENTITY Aring CDATA "&#197;" -- latin capital letter A with ring above
= latin capital letter A ring,
U+00C5 ISOlat1 -->
<!ENTITY AElig CDATA "&#198;" -- latin capital letter AE
= latin capital ligature AE,
U+00C6 ISOlat1 -->
<!ENTITY Ccedil CDATA "&#199;" -- latin capital letter C with cedilla,
U+00C7 ISOlat1 -->
<!ENTITY Egrave CDATA "&#200;" -- latin capital letter E with grave,
U+00C8 ISOlat1 -->
<!ENTITY Eacute CDATA "&#201;" -- latin capital letter E with acute,
U+00C9 ISOlat1 -->
<!ENTITY Ecirc CDATA "&#202;" -- latin capital letter E with circumflex,
U+00CA ISOlat1 -->
<!ENTITY Euml CDATA "&#203;" -- latin capital letter E with diaeresis,
U+00CB ISOlat1 -->
<!ENTITY Igrave CDATA "&#204;" -- latin capital letter I with grave,
U+00CC ISOlat1 -->
<!ENTITY Iacute CDATA "&#205;" -- latin capital letter I with acute,
U+00CD ISOlat1 -->
<!ENTITY Icirc CDATA "&#206;" -- latin capital letter I with circumflex,
U+00CE ISOlat1 -->
<!ENTITY Iuml CDATA "&#207;" -- latin capital letter I with diaeresis,
U+00CF ISOlat1 -->
<!ENTITY ETH CDATA "&#208;" -- latin capital letter ETH, U+00D0 ISOlat1 -->
<!ENTITY Ntilde CDATA "&#209;" -- latin capital letter N with tilde,
U+00D1 ISOlat1 -->
<!ENTITY Ograve CDATA "&#210;" -- latin capital letter O with grave,
U+00D2 ISOlat1 -->
<!ENTITY Oacute CDATA "&#211;" -- latin capital letter O with acute,
U+00D3 ISOlat1 -->
<!ENTITY Ocirc CDATA "&#212;" -- latin capital letter O with circumflex,
U+00D4 ISOlat1 -->
<!ENTITY Otilde CDATA "&#213;" -- latin capital letter O with tilde,
U+00D5 ISOlat1 -->
<!ENTITY Ouml CDATA "&#214;" -- latin capital letter O with diaeresis,
U+00D6 ISOlat1 -->
<!ENTITY times CDATA "&#215;" -- multiplication sign, U+00D7 ISOnum -->
<!ENTITY Oslash CDATA "&#216;" -- latin capital letter O with stroke
= latin capital letter O slash,
U+00D8 ISOlat1 -->
<!ENTITY Ugrave CDATA "&#217;" -- latin capital letter U with grave,
U+00D9 ISOlat1 -->
<!ENTITY Uacute CDATA "&#218;" -- latin capital letter U with acute,
U+00DA ISOlat1 -->
<!ENTITY Ucirc CDATA "&#219;" -- latin capital letter U with circumflex,
U+00DB ISOlat1 -->
<!ENTITY Uuml CDATA "&#220;" -- latin capital letter U with diaeresis,
U+00DC ISOlat1 -->
<!ENTITY Yacute CDATA "&#221;" -- latin capital letter Y with acute,
U+00DD ISOlat1 -->
<!ENTITY THORN CDATA "&#222;" -- latin capital letter THORN,
U+00DE ISOlat1 -->
<!ENTITY szlig CDATA "&#223;" -- latin small letter sharp s = ess-zed,
U+00DF ISOlat1 -->
<!ENTITY agrave CDATA "&#224;" -- latin small letter a with grave
= latin small letter a grave,
U+00E0 ISOlat1 -->
<!ENTITY aacute CDATA "&#225;" -- latin small letter a with acute,
U+00E1 ISOlat1 -->
<!ENTITY acirc CDATA "&#226;" -- latin small letter a with circumflex,
U+00E2 ISOlat1 -->
<!ENTITY atilde CDATA "&#227;" -- latin small letter a with tilde,
U+00E3 ISOlat1 -->
<!ENTITY auml CDATA "&#228;" -- latin small letter a with diaeresis,
U+00E4 ISOlat1 -->
<!ENTITY aring CDATA "&#229;" -- latin small letter a with ring above
= latin small letter a ring,
U+00E5 ISOlat1 -->
<!ENTITY aelig CDATA "&#230;" -- latin small letter ae
= latin small ligature ae, U+00E6 ISOlat1 -->
<!ENTITY ccedil CDATA "&#231;" -- latin small letter c with cedilla,
U+00E7 ISOlat1 -->
<!ENTITY egrave CDATA "&#232;" -- latin small letter e with grave,
U+00E8 ISOlat1 -->
<!ENTITY eacute CDATA "&#233;" -- latin small letter e with acute,
U+00E9 ISOlat1 -->
<!ENTITY ecirc CDATA "&#234;" -- latin small letter e with circumflex,
U+00EA ISOlat1 -->
<!ENTITY euml CDATA "&#235;" -- latin small letter e with diaeresis,
U+00EB ISOlat1 -->
<!ENTITY igrave CDATA "&#236;" -- latin small letter i with grave,
U+00EC ISOlat1 -->
<!ENTITY iacute CDATA "&#237;" -- latin small letter i with acute,
U+00ED ISOlat1 -->
<!ENTITY icirc CDATA "&#238;" -- latin small letter i with circumflex,
U+00EE ISOlat1 -->
<!ENTITY iuml CDATA "&#239;" -- latin small letter i with diaeresis,
U+00EF ISOlat1 -->
<!ENTITY eth CDATA "&#240;" -- latin small letter eth, U+00F0 ISOlat1 -->
<!ENTITY ntilde CDATA "&#241;" -- latin small letter n with tilde,
U+00F1 ISOlat1 -->
<!ENTITY ograve CDATA "&#242;" -- latin small letter o with grave,
U+00F2 ISOlat1 -->
<!ENTITY oacute CDATA "&#243;" -- latin small letter o with acute,
U+00F3 ISOlat1 -->
<!ENTITY ocirc CDATA "&#244;" -- latin small letter o with circumflex,
U+00F4 ISOlat1 -->
<!ENTITY otilde CDATA "&#245;" -- latin small letter o with tilde,
U+00F5 ISOlat1 -->
<!ENTITY ouml CDATA "&#246;" -- latin small letter o with diaeresis,
U+00F6 ISOlat1 -->
<!ENTITY divide CDATA "&#247;" -- division sign, U+00F7 ISOnum -->
<!ENTITY oslash CDATA "&#248;" -- latin small letter o with stroke,
= latin small letter o slash,
U+00F8 ISOlat1 -->
<!ENTITY ugrave CDATA "&#249;" -- latin small letter u with grave,
U+00F9 ISOlat1 -->
<!ENTITY uacute CDATA "&#250;" -- latin small letter u with acute,
U+00FA ISOlat1 -->
<!ENTITY ucirc CDATA "&#251;" -- latin small letter u with circumflex,
U+00FB ISOlat1 -->
<!ENTITY uuml CDATA "&#252;" -- latin small letter u with diaeresis,
U+00FC ISOlat1 -->
<!ENTITY yacute CDATA "&#253;" -- latin small letter y with acute,
U+00FD ISOlat1 -->
<!ENTITY thorn CDATA "&#254;" -- latin small letter thorn,
U+00FE ISOlat1 -->
<!ENTITY yuml CDATA "&#255;" -- latin small letter y with diaeresis,
U+00FF ISOlat1 -->
+16 -24
View File
@@ -2,22 +2,24 @@
**PocketSharp** is a C#.NET portable class library that integrates the [Pocket API v3](http://getpocket.com/developer).
## Install [PocketSharp](https://www.nuget.org/packages/PocketSharp/) using NuGet
## Install PocketSharp using [NuGet](https://www.nuget.org/packages/PocketSharp/)
```
Install-Package PocketSharp
```
for the [PocketSharp.Reader](https://www.nuget.org/packages/PocketSharp.Reader/)
```
Install-Package PocketSharp.Reader
```
## Documentation
See [wiki](https://github.com/ceee/PocketSharp/wiki)
## Where's the Article View API?
PocketSharp doesn't include PocketSharp.Reader (an article view implementation) anymore.
**PocketSharp.Reader is now [ReadSharp](https://github.com/ceee/ReadSharp) and hosted without PocketSharp.**
---
## Usage Example:
@@ -56,28 +58,18 @@ PocketSharp is a **Portable Class Library**, therefore it's compatible with mult
You can find examples for Silverlight 5, WP8 and WPF in the `PocketSharp.Examples` ([@github](https://github.com/ceee/PocketSharp/tree/master/PocketSharp.Examples)) folder.
## What's next?
- [ ] Preferences API, if Pocket will ever release it to the public -.-
## Dependencies
- [Microsoft.Bcl.Async](https://www.nuget.org/packages/Microsoft.Bcl.Async/) _(used in PocketSharp & PocketSharp.Reader)_
- [Microsoft.Net.Http](https://www.nuget.org/packages/Microsoft.Net.Http/) _(used in PocketSharp & PocketSharp.Reader)_
- [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/) _(only for PocketSharp project)_
- [PropertyChanged.Fody](https://github.com/Fody/PropertyChanged) _(only for PocketSharp project)_
## Forked Dependencies
_used in PocketSharp.Reader_
- [NReadability](https://github.com/marek-stoj/NReadability) - converted to a PCL with minor adaptations
- [SgmlReader](https://github.com/MindTouch/SGMLReader) - converted to a PCL
- [Microsoft.Bcl.Async](https://www.nuget.org/packages/Microsoft.Bcl.Async/)
- [Microsoft.Net.Http](https://www.nuget.org/packages/Microsoft.Net.Http/)
- [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/)
- [PropertyChanged.Fody](https://github.com/Fody/PropertyChanged)
## Contributors
| [![ceee](http://gravatar.com/avatar/9c61b1f4307425f12f05d3adb930ba66?s=70)](https://github.com/ceee "Tobias Klika") | [![ScottIsAFool](http://gravatar.com/avatar/6df656872a87b09a7470feb4867ed927?s=70)](https://github.com/ScottIsAFool "Scott Lovegrove") |
|---|---|
| [ceee](https://github.com/ceee) | [ScottIsAFool](https://github.com/ScottIsAFool) |
| [![ceee](http://gravatar.com/avatar/9c61b1f4307425f12f05d3adb930ba66?s=70)](https://github.com/ceee "Tobias Klika") | [![ScottIsAFool](http://gravatar.com/avatar/6df656872a87b09a7470feb4867ed927?s=70)](https://github.com/ScottIsAFool "Scott Lovegrove") | [![StephenErstad](http://gravatar.com/avatar/3cfe2c5dbc5bc26697e0fe2c428e46e7?s=70)](https://github.com/StephenErstad "Stephen Erstad") |
|---|---|---|
| [ceee](https://github.com/ceee) | [ScottIsAFool](https://github.com/ScottIsAFool) | [StephenErstad](https://github.com/StephenErstad) |
## License