Commits

Matt Hamilton committed f7db8cc

Removed support for .Net 4.0

  • Participants
  • Parent commits 13c48b2
  • Branches httpclient

Comments (0)

Files changed (11)

File Budgie.Playground/Budgie.Playground.csproj

     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Budgie.Playground</RootNamespace>
     <AssemblyName>Budgie.Playground</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
     <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
     <RestorePackages>true</RestorePackages>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <PlatformTarget>x86</PlatformTarget>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Microsoft.Threading.Tasks">
-      <HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Threading.Tasks.Extensions">
-      <HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
-      <HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
-    </Reference>
-    <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net40\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
-    <Reference Include="System.IO">
-      <HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\net40\System.IO.dll</HintPath>
-    </Reference>
     <Reference Include="System.Net" />
-    <Reference Include="System.Net.Http, Version=2.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net40\System.Net.Http.dll</HintPath>
-    </Reference>
+    <Reference Include="System.Net.Http" />
     <Reference Include="System.Net.Http.Extensions">
-      <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net40\System.Net.Http.Extensions.dll</HintPath>
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Extensions.dll</HintPath>
     </Reference>
     <Reference Include="System.Net.Http.Primitives">
-      <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net40\System.Net.Http.Primitives.dll</HintPath>
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
-    </Reference>
-    <Reference Include="System.Runtime">
-      <HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\net40\System.Runtime.dll</HintPath>
-    </Reference>
-    <Reference Include="System.Threading.Tasks">
-      <HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\net40\System.Threading.Tasks.dll</HintPath>
-    </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />

File Budgie.Playground/Program.cs

 
             Authenticate(client);
 
-            var media = System.IO.File.ReadAllBytes(@"D:\Projects\Budgie\Images\budgie-256.png");
+            //var media = System.IO.File.ReadAllBytes(@"D:\Projects\Budgie\Images\budgie-256.png");
             //var r = client.PostAsync("Testing image upload with Budgie and HttpClient!", new[] { media }).Result;
-            var r = client.PostAsync("And testing a tweet with no media to make sure that's not broken. :|").Result;
-
-            Console.WriteLine(r.StatusCode + "\t" + r.ErrorMessage);
+            //var r = client.PostAsync("And testing a tweet with no media to make sure that's not broken. :|").Result;
+            TestHomeTimeline(client);
+            //Console.WriteLine(r.StatusCode + "\t" + r.ErrorMessage);
             //TestAuthentication(client);
             //TestHomeTimeline(client);
             // TestFavorites(client);

File Budgie.Playground/app.config

 <?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.3.0" newVersion="2.6.3.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
-      </dependentAssembly>
-    </assemblyBinding>
-  </runtime>
-</configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>

File Budgie.Playground/packages.config

 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Microsoft.Bcl" version="1.1.3" targetFramework="net40-Client" />
-  <package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="net40-Client" />
+  <package id="Microsoft.Bcl" version="1.1.3" targetFramework="net45" />
   <package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="net40-Client" />
-  <package id="Microsoft.Net.Http" version="2.2.15" targetFramework="net40-Client" />
-  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="net40-Client" />
+  <package id="Microsoft.Net.Http" version="2.2.15" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
 </packages>

File Budgie.nuspec

 <?xml version="1.0"?>
 <package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
   <metadata>
-    <version>2.1.0</version>
+    <version>3.0.0</version>
     <authors>mabster</authors>
     <owners>Matt Hamilton</owners>
     <licenseUrl>http://www.opensource.org/licenses/ms-pl.html</licenseUrl>
     <iconUrl>http://matthamilton.net/get/budgie/budgie-32.png</iconUrl>
     <dependencies>
       <dependency id="Newtonsoft.Json" />
+      <dependency id="Microsoft.Net.Http" />
     </dependencies>
     <id>Budgie</id>
     <title />
     <tags>twitter</tags>
   </metadata>
   <files>
-    <file src="Budgie\bin\Release\Budgie.dll" target="lib\portable-windows8+net40+windowsphone8\Budgie.dll" />
+    <file src="Budgie\bin\Release\Budgie.dll" target="lib\portable-windows8+net45+windowsphone8\Budgie.dll" />
   </files>
 </package>

File Budgie/Budgie.csproj

     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Budgie</RootNamespace>
     <AssemblyName>Budgie</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
-    <TargetFrameworkProfile>Profile136</TargetFrameworkProfile>
+    <TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
+    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Microsoft.Threading.Tasks">
-      <HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\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.16\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
-    </Reference>
     <Reference Include="Newtonsoft.Json">
-      <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
+      <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
-    <Reference Include="System.IO">
-      <HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl5+win8+wp8\System.IO.dll</HintPath>
-    </Reference>
     <Reference Include="System.Net.Http">
       <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
     </Reference>
     <Reference Include="System.Net.Http.Primitives">
       <HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime">
-      <HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl5+win8+wp8\System.Runtime.dll</HintPath>
-    </Reference>
-    <Reference Include="System.Threading.Tasks">
-      <HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl5+win8+wp8\System.Threading.Tasks.dll</HintPath>
-    </Reference>
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Entities\TwitterMention.cs" />
     <Compile Include="Entities\TwitterUrl.cs" />
     <Compile Include="Extensions\StringExceptions.cs" />
-    <Compile Include="Extensions\WebRequestExtensions.cs" />
     <Compile Include="Extensions\WebResponseExtensions.cs" />
     <Compile Include="IPlatformAdaptor.cs" />
     <Compile Include="Json\JsonError.cs" />
     <Compile Include="TwitterUser.cs" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="app.config" />
     <None Include="packages.config" />
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

File Budgie/Extensions/WebRequestExtensions.cs

-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Net;
-using System.Threading.Tasks;
-
-namespace Budgie.Extensions
-{
-    internal static class WebRequestExtensions
-    {
-        internal static Task<WebResponse> GetResponseAsync(this WebRequest request, TimeSpan timeout)
-        {
-            return Task.Factory.StartNew<WebResponse>(() =>
-            {
-                var t = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);
-
-                if (!t.Wait(timeout)) throw new TimeoutException();
-
-                return t.Result;
-            });
-        }
-    }
-}

File Budgie/TwitterClient.OAuth.cs

             string responseString = await response.Content.ReadAsStringAsync();
             if (String.IsNullOrWhiteSpace(responseString)) return null;
 
-            var result = new TwitterRequestToken(_baseUri);
+            var result = new TwitterRequestToken(_client.BaseAddress);
             foreach (var i in responseString.Split('&'))
             {
                 var kv = i.Split('=');

File Budgie/TwitterClient.cs

 
             _client = new HttpClient(new OAuthMessageHandler(new HttpClientHandler(), consumerKey, consumerSecret, platformAdaptor))
             {
-                BaseAddress = _baseUri,
+                BaseAddress = new Uri("https://api.twitter.com/1.1/"),
                 Timeout = TimeSpan.FromSeconds(100),
             };
         }
 
         TwitterAccessToken _accessToken;
         HttpClient _client;
-        Uri _baseUri = new Uri("https://api.twitter.com/1.1/");
 
         T Deserialize<T>(string value)
         {

File Budgie/app.config

-<?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.3.0" newVersion="2.6.3.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" />
-      </dependentAssembly>
-    </assemblyBinding>
-  </runtime>
-</configuration>

File Budgie/packages.config

 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Microsoft.Bcl" version="1.1.3" targetFramework="portable-win+net40+sl50+wp80" />
-  <package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="portable-win+net40+sl50+wp80" />
+  <package id="Microsoft.Bcl" version="1.1.3" targetFramework="portable-win+net45+wp80" />
   <package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="portable-win+net40+sl50+wp80" />
-  <package id="Microsoft.Net.Http" version="2.2.15" targetFramework="portable-win+net40+sl50+wp80" />
-  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="portable-win+net40" />
+  <package id="Microsoft.Net.Http" version="2.2.15" targetFramework="portable-win+net45+wp80" />
+  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="portable-win+net45+wp80" />
 </packages>