Skip to content

Commit

Permalink
Start of documentation for mono usage.
Browse files Browse the repository at this point in the history
Fixes 83
Fixes 67
Fixes 85
  • Loading branch information
digitallyborn committed Feb 26, 2011
1 parent 101eff0 commit e200901
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 5 deletions.
21 changes: 21 additions & 0 deletions Twitterizer2.Async.nuspec
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>twitterizer-async</id>
<title>Asynchronous Twitterizer</title>
<version>2.3.1</version>
<authors>Ricky Smith</authors>
<description>Adds asynchronous method wrappers to the Twitterizer library.</description>
<language>en-US</language>
<licenseUrl>http://www.twitterizer.net/license/</licenseUrl>
<projectUrl>http://www.twitterizer.net/</projectUrl>
<iconUrl>http://www.twitterizer.net/twitterizer-icon-draft1.png</iconUrl>
<tags>twitter twitterizer asynchronous</tags>
<dependencies>
<dependency id="twitterizer" version="2.3.1" />
</dependencies>
</metadata>
<files>
<file src="Release\Twitterizer2-WithAddons\Twitterizer2.Asynchronous.*" target="lib" />
</files>
</package>
21 changes: 21 additions & 0 deletions Twitterizer2.nuspec
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>twitterizer</id>
<title>Twitterizer</title>
<version>2.3.1</version>
<authors>Ricky Smith</authors>
<description>A wrapper library for the Twitter API.</description>
<language>en-US</language>
<licenseUrl>http://www.twitterizer.net/license/</licenseUrl>
<projectUrl>http://www.twitterizer.net/</projectUrl>
<iconUrl>http://www.twitterizer.net/twitterizer-icon-draft1.png</iconUrl>
<tags>twitter twitterizer</tags>
<dependencies>
<dependency id="Newtonsoft.Json" version="3.5" />
</dependencies>
</metadata>
<files>
<file src="Release\Twitterizer2\Twitterizer2.*" target="lib" />
</files>
</package>
3 changes: 2 additions & 1 deletion Twitterizer2.shfbproj
Expand Up @@ -7,7 +7,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9223c5ca-4b52-49ce-a51c-ae1252eaff5b}</ProjectGuid> <ProjectGuid>{9223c5ca-4b52-49ce-a51c-ae1252eaff5b}</ProjectGuid>
<SHFBSchemaVersion>1.8.0.3</SHFBSchemaVersion> <SHFBSchemaVersion>1.9.0.0</SHFBSchemaVersion>
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual <!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
Studio adds them anyway --> Studio adds them anyway -->
<AssemblyName>Documentation</AssemblyName> <AssemblyName>Documentation</AssemblyName>
Expand Down Expand Up @@ -98,6 +98,7 @@
<ContentLayout Include="XML Documentation\Twitterizer2.content" /> <ContentLayout Include="XML Documentation\Twitterizer2.content" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="XML Documentation\Mono.aml" />
<None Include="XML Documentation\Examples.aml" /> <None Include="XML Documentation\Examples.aml" />
<None Include="XML Documentation\HowDoI.aml" /> <None Include="XML Documentation\HowDoI.aml" />
<None Include="XML Documentation\Troubleshooting.aml" /> <None Include="XML Documentation\Troubleshooting.aml" />
Expand Down
2 changes: 2 additions & 0 deletions Twitterizer2/Core/TwitterCommand.cs
Expand Up @@ -254,6 +254,8 @@ public TwitterResponse<T> ExecuteCommand()
}.Contains(wex.Status)) }.Contains(wex.Status))
{ {
twitterResponse.Result = RequestResult.ConnectionFailure; twitterResponse.Result = RequestResult.ConnectionFailure;
twitterResponse.ErrorMessage = wex.Message;
return twitterResponse;
} }


// The exception response should always be an HttpWebResponse, but we check for good measure. // The exception response should always be an HttpWebResponse, but we check for good measure.
Expand Down
7 changes: 3 additions & 4 deletions Twitterizer2/Exceptions/TwitterizerException.cs
Expand Up @@ -37,7 +37,6 @@ namespace Twitterizer
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using Core; using Core;


Expand Down Expand Up @@ -207,10 +206,10 @@ protected void ParseRateLimitHeaders(WebResponse response)
this.RateLimiting.Remaining = int.Parse(response.Headers["X-RateLimit-Remaining"], CultureInfo.InvariantCulture); this.RateLimiting.Remaining = int.Parse(response.Headers["X-RateLimit-Remaining"], CultureInfo.InvariantCulture);
} }


if (string.IsNullOrEmpty(response.Headers["X-RateLimit-Reset"])) if (!string.IsNullOrEmpty(response.Headers["X-RateLimit-Reset"]))
{ {
this.RateLimiting.ResetDate = (new DateTime(1970, 1, 1, 0, 0, 0, 0)) this.RateLimiting.ResetDate = DateTime.SpecifyKind(new DateTime(1970, 1, 1, 0, 0, 0, 0)
.AddSeconds(double.Parse(response.Headers["X-RateLimit-Reset"], CultureInfo.InvariantCulture)); .AddSeconds(double.Parse(response.Headers["X-RateLimit-Reset"], CultureInfo.InvariantCulture)), DateTimeKind.Utc);
} }
} }
} }
Expand Down
73 changes: 73 additions & 0 deletions XML Documentation/Mono.aml
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<topic id="383058b8-9426-4547-94e0-a8e920929425" revisionNumber="1">
<developerTroubleshootingDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<summary>
<para>Working with Twitterizer in Mono</para>
</summary>

<introduction>
<!-- Uncomment this to generate an outline of the section and sub-section
titles. Specify a numeric value as the inner text to limit it to
a specific number of sub-topics when creating the outline. Specify
zero (0) to limit it to top-level sections only. -->
<!-- <autoOutline /> -->
<para>While the library is not developed for or tested with Mono, Twitterizer should require only a few modifications in order to work well.</para>
</introduction>
<!-- Zero or more sections. These are collapsible. If using
<autoOutline />, add an address attribute to identify it and specify
a title so that it can be jumped to with a hyperlink. -->
<section address="certificate">
<title>Invalid Certificate</title>
<content>
<para>Currently a bug exists in Mono which hinders communication with some SSL sites, including the Twitter API.
This issue isn't unique to Twitterizer, so this workaround should be valid for other projects.</para>
<code language="cs">private static bool ValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
if (sslPolicyErrors == SslPolicyErrors.None)
return true;

// HACK: Mono's certificate chain validator is buggy
if (sslPolicyErrors == SslPolicyErrors.RemoteCertificateChainErrors && sender is HttpWebRequest) {
var request = (HttpWebRequest) sender;
if (request.RequestUri.Host == "api.twitter.com" && certificate.Issuer == "OU=Equifax Secure Certificate Authority, O=Equifax, C=US")
return true;
}
return false;
}
}</code>
<!-- <procedure>Optional procedures. See How To document for procedure layout example.</procedure> -->
</content>
</section>

<relatedTopics><!-- One or more of the following:
- A local link
- An external link
- A code entity reference
<link xlink:href="Other Topic's ID">Link text</link>
<externalLink>
<linkText>Link text</linkText>
<linkAlternateText>Optional alternate link text</linkAlternateText>
<linkUri>URI</linkUri>
</externalLink>
<codeEntityReference>API member ID</codeEntityReference>
Examples:
<link xlink:href="00e97994-e9e6-46e0-b420-5be86b2f8278">Some other topic</link>
<externalLink>
<linkText>SHFB on CodePlex</linkText>
<linkAlternateText>Go to CodePlex</linkAlternateText>
<linkUri>http://shfb.codeplex.com</linkUri>
</externalLink>
<codeEntityReference>T:TestDoc.TestClass</codeEntityReference>
<codeEntityReference>P:TestDoc.TestClass.SomeProperty</codeEntityReference>
<codeEntityReference>M:TestDoc.TestClass.#ctor</codeEntityReference>
<codeEntityReference>M:TestDoc.TestClass.#ctor(System.String,System.Int32)</codeEntityReference>
<codeEntityReference>M:TestDoc.TestClass.ToString</codeEntityReference>
<codeEntityReference>M:TestDoc.TestClass.FirstMethod</codeEntityReference>
<codeEntityReference>M:TestDoc.TestClass.SecondMethod(System.Int32,System.String)</codeEntityReference>
--></relatedTopics></developerTroubleshootingDocument>
</topic>

0 comments on commit e200901

Please sign in to comment.