Commits

Devin Martin committed b4568c6

Add QRCode

  • Participants
  • Parent commits 271f50d

Comments (0)

Files changed (6)

File FlipSideOut.Linqpad/DisplayExtensions.cs

+using System;
+using System.Drawing;
+using System.IO;
+using System.Net;
+using System.Web;
+
+namespace FlipSideOut.Linqpad
+{
+    public static class DisplayExtensions
+    {
+
+        public static Bitmap ToQrCode(this string data)
+        {
+            var url = string.Format("http://qrcode.kaywa.com/img.php?s=4&d={0}", HttpUtility.UrlEncode(data));
+            using (var web = new WebClient())
+            {
+                var imageData = web.DownloadData(url);
+                using (var stream = new MemoryStream(imageData))
+                {
+                    return new Bitmap(stream);
+                }
+            }
+        }
+
+        public static Bitmap ToQrCode(this Uri data)
+        {
+            return data.ToString().ToQrCode();
+        }
+    }
+}

File FlipSideOut.Linqpad/EnumerableExtensions.cs

 {
     using System;
     using System.Collections.Generic;
-    using System.Linq;
-    using System.Text;
-    using System.Threading.Tasks;
 
     public static class EnumerableExtensions
     {

File FlipSideOut.Linqpad/FlipSideOut.Linqpad.csproj

     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms.DataVisualization" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ConversionExtensions.cs" />
+    <Compile Include="DisplayExtensions.cs" />
     <Compile Include="EnumerableExtensions.cs" />
     <Compile Include="FluentMathExtensions.cs" />
     <Compile Include="FluentRangeExtensions.cs" />

File FlipSideOut.Linqpad/FluentMathExtensions.cs

-using System;
-
-namespace FlipSideOut.Linqpad
+namespace FlipSideOut.Linqpad
 {
     public static class FluentMathExtensions
     {

File FlipSideOut.Linqpad/FunctionalExtensions.cs

 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace FlipSideOut.Linqpad
 {

File FlipSideOut.Linqpad/Properties/AssemblyInfo.cs

 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 // General Information about an assembly is controlled through the following