aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsenShnurkov <Arsen.Shnurkov@gmail.com>2016-01-07 08:07:20 +0300
committerArsenShnurkov <Arsen.Shnurkov@gmail.com>2016-01-07 08:07:20 +0300
commit9df07e1aef012ef4d0ffa4d7856b0be62454e675 (patch)
tree898f0769163b6d6b3dc4b0c3e603deb9eca57337 /dev-util/monodevelop/files
parentMerge pull request #158 from ArsenShnurkov/deveeldb (diff)
downloaddotnet-9df07e1aef012ef4d0ffa4d7856b0be62454e675.tar.gz
dotnet-9df07e1aef012ef4d0ffa4d7856b0be62454e675.tar.bz2
dotnet-9df07e1aef012ef4d0ffa4d7856b0be62454e675.zip
https://github.com/mrward/monodevelop-nuget-addin/issues/59
Diffstat (limited to 'dev-util/monodevelop/files')
-rw-r--r--dev-util/monodevelop/files/local-nuget-icons.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/dev-util/monodevelop/files/local-nuget-icons.patch b/dev-util/monodevelop/files/local-nuget-icons.patch
new file mode 100644
index 0000000..329c57f
--- /dev/null
+++ b/dev-util/monodevelop/files/local-nuget-icons.patch
@@ -0,0 +1,48 @@
+From c5f730b3ffcecfd15dc291353332a6a3f0bb515a Mon Sep 17 00:00:00 2001
+From: Matt Ward <matt.ward@xamarin.com>
+Date: Sat, 2 Jan 2016 15:29:00 +0000
+Subject: [PATCH] [NuGet] Support NuGet packages that use icons from local
+ files.
+
+Allows a NuGet package to use an icon, shown in the Add Packages
+dialog, taken from the local file system using a file url.
+Previously this would fail with an invalid cast exception.
+---
+ .../MonoDevelop.PackageManagement/ImageLoader.cs | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ImageLoader.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ImageLoader.cs
+index 07b7b99..98eff92 100644
+--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ImageLoader.cs
++++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ImageLoader.cs
+@@ -91,8 +91,7 @@ namespace MonoDevelop.PackageManagement
+ ImageLoadedEventArgs LoadImage (Uri uri, object state)
+ {
+ try {
+- var httpClient = new HttpClient (uri);
+- Stream stream = httpClient.GetResponse ().GetResponseStream ();
++ Stream stream = GetResponseStream (uri);
+ Image image = Image.FromStream (stream);
+
+ return new ImageLoadedEventArgs (image, uri, state);
+@@ -101,6 +100,17 @@ namespace MonoDevelop.PackageManagement
+ }
+ }
+
++ static Stream GetResponseStream (Uri uri)
++ {
++ if (uri.IsFile) {
++ var request = WebRequest.Create (uri);
++ return request.GetResponse ().GetResponseStream ();
++ }
++
++ var httpClient = new HttpClient (uri);
++ return httpClient.GetResponse ().GetResponseStream ();
++ }
++
+ void OnLoaded (ITask<ImageLoadedEventArgs> task, Uri uri, object state)
+ {
+ if (task.IsFaulted) {
+--
+2.6.0
+