Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2013-05-09 00:47:14 +0400
committerJérémie Laval <jeremie.laval@gmail.com>2013-05-09 00:47:14 +0400
commit558a55936c39136690008bd557f589d440cad75f (patch)
tree329e6851b8d5069dd05a71aea1cbaad0fc75e420
parent6c29c35f61b0947a3e386f396fff5f4f8e0765af (diff)
[macdoc] Fix apple documentation feed caching to be product specific
-rw-r--r--AppleDocHandler.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/AppleDocHandler.cs b/AppleDocHandler.cs
index 7270980..757abd6 100644
--- a/AppleDocHandler.cs
+++ b/AppleDocHandler.cs
@@ -4,6 +4,7 @@ using System.Net;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
+using System.Collections.Generic;
namespace macdoc
{
@@ -35,7 +36,7 @@ namespace macdoc
readonly XNamespace atomNamespace = "http://www.w3.org/2005/Atom";
readonly string baseApplicationPath;
- XDocument appleFeed;
+ Dictionary<string, XDocument> appleFeeds = new Dictionary<string, XDocument> ();
public AppleDocHandler (string baseApplicationPath)
{
@@ -45,12 +46,13 @@ namespace macdoc
// We load the atom field that contains a timeline of the modifications down to documentation by Apple
XDocument LoadAppleFeed (string feedUrl)
{
- if (appleFeed != null)
+ XDocument appleFeed;
+ if (appleFeeds.TryGetValue (feedUrl, out appleFeed))
return appleFeed;
-
+
WebClient wc = new WebClient ();
var feed = wc.DownloadString (feedUrl);
- return appleFeed = XDocument.Parse (feed);
+ return appleFeeds[feedUrl] = XDocument.Parse (feed);
}
// This method transforms the Atom XML data into a POCO for the the most recent item of the feed