Skip to content

Commit

Permalink
- Added the NuGet package Microsoft.CompilerServices.AsyncTargetingPa…
Browse files Browse the repository at this point in the history
…ck as a dependency which provides Microsoft's official TaskEx class implimentation for .NET 4.0.

- Removed the unofficial TaskEx class.
- Removed the DownloadDataTaskAsync(WebClient, Uri) overload since it's already provided by AsyncTargetingPack.
- Fixed malformed XML comments.
  • Loading branch information
Allon-Guralnek committed May 24, 2012
1 parent 7c96e3c commit 1aeb5dd
Show file tree
Hide file tree
Showing 16 changed files with 3,515 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ protected internal override string BaseUrl

/// <summary>
/// avoid (optional) indicates that the calculated route(s) should avoid the indicated features. Currently, this parameter supports the following two arguments:
//tolls indicates that the calculated route should avoid toll roads/bridges.
//highways indicates that the calculated route should avoid highways.
//(For more information see Route Restrictions below.)
/// tolls indicates that the calculated route should avoid toll roads/bridges.
/// highways indicates that the calculated route should avoid highways.
/// (For more information see Route Restrictions below.)
/// </summary>
public AvoidWay Avoid { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion GoogleMapsApi/Entities/Directions/Response/Route.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace GoogleMapsApi.Entities.Directions.Response
{
/// <summary>
/// When the Directions API returns results, it places them within a (JSON) routes array. Even if the service returns no results (such as if the origin and/or destination doesn't exist) it still returns an empty routes array. (XML responses consist of zero or more <route> elements.)
/// When the Directions API returns results, it places them within a (JSON) routes array. Even if the service returns no results (such as if the origin and/or destination doesn't exist) it still returns an empty routes array. (XML responses consist of zero or more route elements.)
/// Each element of the routes array contains a single result from the specified origin and destination. This route may consist of one or more legs depending on whether any waypoints were specified. As well, the route also contains copyright and warning information which must be displayed to the user in addition to the routing information.
/// </summary>
[DataContract(Name = "route")]
Expand Down
2 changes: 1 addition & 1 deletion GoogleMapsApi/Entities/Geocoding/Response/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace GoogleMapsApi.Entities.Geocoding.Response
{
/// <summary>
/// When the geocoder returns results, it places them within a (JSON) results array. Even if the geocoder returns no results (such as if the address doesn't exist) it still returns an empty results array. (XML responses consist of zero or more <result> elements.)
/// When the geocoder returns results, it places them within a (JSON) results array. Even if the geocoder returns no results (such as if the address doesn't exist) it still returns an empty results array. (XML responses consist of zero or more result elements.)
/// </summary>
[DataContract]
public class Result
Expand Down
6 changes: 0 additions & 6 deletions GoogleMapsApi/Entities/Places/Response/PlacesResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,5 @@ public string StatusStr
/// </summary>
[DataMember(Name="results")]
public IEnumerable<Result> Results { get; set; }

/// <summary>
/// html_attributions contain a set of attributions about this listing which must be displayed to the user.
/// </summary>
//[DataMember(Name="html_attributions")]
//public string HtmlAttributions { get; set; }
}
}
5 changes: 4 additions & 1 deletion GoogleMapsApi/GoogleMapsApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<DocumentationFile>bin\Release\GoogleMapsApi.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CompilerServices.AsyncTargetingPack.Net4">
<HintPath>..\packages\Microsoft.CompilerServices.AsyncTargetingPack.1.0.0\lib\net40\Microsoft.CompilerServices.AsyncTargetingPack.Net4.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
Expand Down Expand Up @@ -102,12 +105,12 @@
<Compile Include="StaticMaps\Enums\MapVisibility.cs" />
<Compile Include="StaticMaps\Enums\MarkerSize.cs" />
<Compile Include="StaticMaps\StaticMapsEngine.cs" />
<Compile Include="TaskEx.cs" />
<Compile Include="WebClientExtensionMethods.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="Entities\Directions\The Google Directions API - Google Maps API Web Services - Google Code.htm" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
2 changes: 1 addition & 1 deletion GoogleMapsApi/StaticMaps/Entities/MapStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class MapStyle
public float? Saturation { get; set; }

/// <summary>
/// (a floating point value between 0.01 and 10.0, where 1.0 applies no correction) indicates the amount of gamma correction to apply to the element. Gammas modify the lightness of hues in a non-linear fashion, while unaffecting white or black values. Gammas are typically used to modify the contrast of multiple elements. For example, you could modify the gamma to increase or decrease the contrast between the edges and interiors of elements. Low gamma values (< 1) increase contrast, while high values (> 1) decrease contrast.
/// (a floating point value between 0.01 and 10.0, where 1.0 applies no correction) indicates the amount of gamma correction to apply to the element. Gammas modify the lightness of hues in a non-linear fashion, while unaffecting white or black values. Gammas are typically used to modify the contrast of multiple elements. For example, you could modify the gamma to increase or decrease the contrast between the edges and interiors of elements. Low gamma values (less than 1) increase contrast, while high values (> 1) decrease contrast.
/// </summary>
public float? Gamma { get; set; }

Expand Down
78 changes: 0 additions & 78 deletions GoogleMapsApi/TaskEx.cs

This file was deleted.

19 changes: 6 additions & 13 deletions GoogleMapsApi/WebClientExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ namespace GoogleMapsApi
public static class WebClientExtensionMethods
{
/// <summary>
/// Asynchronously downloads the resource with the specified URI as a Byte array. Note that this overload specifies an infinite timeout.
/// Constant. Specified an infinite timeout duration. This is a TimeSpan of negative one (-1) milliseconds.
/// </summary>
/// <param name="client">The client with which to download the specified resource.</param>
/// <param name="address">The address of the resource to download.</param>
/// <returns>A Task with the future value of the downloaded string.</returns>
/// <exception cref="ArgumentNullException">Thrown when a null value is passed to the client or address parameters.</exception>
public static Task<byte[]> DownloadDataTaskAsync(this WebClient client, Uri address)
{
return client.DownloadDataTaskAsync(address, TimeSpan.FromSeconds(Timeout.Infinite));
}
public static readonly TimeSpan InfiniteTimeout = TimeSpan.FromMilliseconds(-1);

/// <summary>
/// Asynchronously downloads the resource with the specified URI as a Byte array limited by the specified timeout.
Expand Down Expand Up @@ -72,7 +65,7 @@ public static Task<byte[]> DownloadDataTaskAsync(this WebClient client, Uri addr
{
if (client == null) throw new ArgumentNullException("client");
if (address == null) throw new ArgumentNullException("address");
if (timeout.TotalMilliseconds < 0 && timeout.TotalMilliseconds != Timeout.Infinite)
if (timeout.TotalMilliseconds < 0 && timeout != InfiniteTimeout)
throw new ArgumentOutOfRangeException("address", timeout, "The timeout value must be a positive value or have a TotalMilliseconds value of Timeout.Infinite.");

var tcs = new TaskCompletionSource<byte[]>();
Expand All @@ -82,9 +75,9 @@ public static Task<byte[]> DownloadDataTaskAsync(this WebClient client, Uri addr
{
delayTokenSource.Cancel();
client.CancelAsync();
});
if (timeout.TotalMilliseconds != Timeout.Infinite)
});

if (timeout != InfiniteTimeout)
{
TaskEx.Delay(timeout, delayTokenSource.Token).ContinueWith(t =>
{
Expand Down
4 changes: 4 additions & 0 deletions GoogleMapsApi/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CompilerServices.AsyncTargetingPack" version="1.0.0" />
</packages>
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 1aeb5dd

Please sign in to comment.