Spliting the solution up into two projects. One project for 4.0 and another for 4.5.

Added retargeting code so the 4.0 project can use async await
Added extention methods to work around differences in reflection and async support.
Changed the output folders for each project, to relfect the .NET framework version they are being built with.
Updated the unit test project to build take a reference to the 4.5/PCL assembly.
Updated the example projects to take a dependency on the 4.5/PCL assembly.

Implements blueprint support-net35
Change-Id: Iefb776912cd8257b38a9aaf97cc7bb1b347b8892
This commit is contained in:
Wayne Foley
2014-05-06 16:36:23 -07:00
parent 7f51ce1c1b
commit 63d036cc88
32 changed files with 1760 additions and 70 deletions

View File

@@ -35,8 +35,9 @@
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\Bin\Debug\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OpenStack">
<HintPath>..\..\Bin\Debug\OpenStack.dll</HintPath>
<Reference Include="OpenStack, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Bin\net45\Debug\OpenStack.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@@ -35,9 +35,9 @@
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\Bin\Debug\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OpenStack, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="OpenStack, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Bin\Debug\OpenStack.dll</HintPath>
<HintPath>..\..\Bin\net45\Debug\OpenStack.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@@ -224,7 +224,7 @@ namespace OpenStack.Test.HttpAbstraction
{
var inner = ex.InnerException;
Assert.IsTrue(DateTime.Now - startTime < TimeSpan.FromSeconds(30));
Assert.IsTrue(inner.Message.Contains("A task was canceled"));
Assert.IsTrue(inner.Message.Contains("was canceled"));
}
}

View File

@@ -188,7 +188,6 @@ namespace OpenStack.Test.Identity
public void CannotGetPublicEndpointForAServiceThatIsNotInTheRegion()
{
var serviceName = "Test Service";
var regionName = "some region";
var expectedEndpoint = "http://public.endpoint.org";
var serviceDef = new OpenStackServiceDefinition(serviceName, "Test-Service",
new List<OpenStackServiceEndpoint>()

View File

@@ -21,7 +21,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<OutputPath>..\bin\net45\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -29,7 +29,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<OutputPath>..\bin\net45\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -103,13 +103,13 @@
<Compile Include="OpenStackClientTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenStack\OpenStack.csproj">
<Project>{5660f8aa-14d5-4b3b-ada0-f79a286ef483}</Project>
<Name>OpenStack</Name>
</ProjectReference>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<ProjectReference Include="..\OpenStack45-PCL\OpenStack45-PCL.csproj">
<Project>{5660f8aa-14d5-4b3b-ada0-f79a286ef483}</Project>
<Name>OpenStack45-PCL</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">

View File

@@ -11,7 +11,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\README.rst = ..\README.rst
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenStack", "OpenStack\OpenStack.csproj", "{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenStack40", "OpenStack\OpenStack40.csproj", "{E9F05CCA-2748-4785-9F72-5D3F8893BC28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenStack45-PCL", "OpenStack45-PCL\OpenStack45-PCL.csproj", "{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,6 +25,10 @@ Global
{7AF6DEC5-2257-4A29-BB55-66711DE3055D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AF6DEC5-2257-4A29-BB55-66711DE3055D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AF6DEC5-2257-4A29-BB55-66711DE3055D}.Release|Any CPU.Build.0 = Release|Any CPU
{E9F05CCA-2748-4785-9F72-5D3F8893BC28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9F05CCA-2748-4785-9F72-5D3F8893BC28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9F05CCA-2748-4785-9F72-5D3F8893BC28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9F05CCA-2748-4785-9F72-5D3F8893BC28}.Release|Any CPU.Build.0 = Release|Any CPU
{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -0,0 +1,69 @@
// /* ============================================================================
// Copyright 2014 Hewlett Packard
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================ */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace OpenStack.Common
{
/// <summary>
/// Static class for extending reflection classes.
/// </summary>
internal static class ReflectionExtentions
{
/// <summary>
/// Gets the assembly that contains the extended type.
/// </summary>
/// <param name="input">The given Type</param>
/// <returns>The assembly that contains the given type.</returns>
public static Assembly GetAssembly(this Type input)
{
return input.Assembly;
}
/// <summary>
/// Determines if the given type is an interface.
/// </summary>
/// <param name="input">The given type.</param>
/// <returns>A value indicating if the given type is an interface.</returns>
public static bool IsInterface(this Type input)
{
return input.IsInterface;
}
/// <summary>
/// Gets a list of types that are defined in the given assembly.
/// </summary>
/// <param name="input">The given assembly.</param>
/// <returns>A list of types defined in the given assembly.</returns>
public static IEnumerable<Type> GetDefinedTypes(this Assembly input)
{
return input.GetTypes().ToList();
}
/// <summary>
/// Gets a list of defined constructors for the given type.
/// </summary>
/// <param name="input">The given type.</param>
/// <returns>A list of constructors for the given type.</returns>
public static IEnumerable<ConstructorInfo> GetDefinedConstructors(this Type input)
{
return input.GetConstructors();
}
}
}

View File

@@ -103,38 +103,33 @@ namespace OpenStack.Common.ServiceLocation
/// <returns>A list of types.</returns>
internal IEnumerable<Type> InternalGetRegistrarTypes()
{
var rawTypeInfos = new List<TypeInfo>();
var serviceRegistrarTypeInfo = typeof (IServiceLocationRegistrar).GetTypeInfo();
var rawTypes = new List<Type>();
var serviceRegistrarType = typeof (IServiceLocationRegistrar);
foreach (var assembly in this._assemblies)
{
try
{
rawTypeInfos.AddRange(assembly.DefinedTypes);
rawTypes.AddRange(assembly.GetDefinedTypes());
}
catch (ReflectionTypeLoadException loadEx)
{
var foundTypes = (from t in loadEx.Types where t != null select t.GetTypeInfo()).ToList();
rawTypeInfos.AddRange(foundTypes);
var foundTypes = (from t in loadEx.Types where t != null select t).ToList();
rawTypes.AddRange(foundTypes);
}
}
var rawRegistrarTypes = new List<Type>();
foreach (var typeInfo in rawTypeInfos)
foreach (var type in rawTypes)
{
if (typeInfo.IsInterface)
if (type.IsInterface())
{
continue;
}
if (serviceRegistrarTypeInfo.IsAssignableFrom(typeInfo) && typeInfo.DeclaredConstructors.Any(c => !c.GetParameters().Any()))
if (serviceRegistrarType.IsAssignableFrom(type) && type.GetDefinedConstructors().Any(c => !c.GetParameters().Any()))
{
//This is an odd 'feature' in the PCL reflection code. Basically using TypeInfo.GetType() does not give you the 'real' type
//so when the caller tries to use the returned type in a call to Activator.CreateInstance, it will try and create a RuntimeType object (which does not have a default constructor)
//and fail. But by asking the assembly that the type came from for a reference to the type, the type that is returned can be created. Weird I know... but hey.
var rawType = typeInfo.Assembly.GetType(typeInfo.FullName);
rawRegistrarTypes.Add(rawType);
rawRegistrarTypes.Add(type);
}
}

View File

@@ -102,9 +102,8 @@ namespace OpenStack.Common.ServiceLocation
throw new InvalidOperationException(msg);
}
var typeInfo = type.GetTypeInfo();
if (!typeInfo.IsInterface)
if (!type.IsInterface())
{
var msg = string.Format(
CultureInfo.InvariantCulture,
@@ -113,8 +112,7 @@ namespace OpenStack.Common.ServiceLocation
throw new InvalidOperationException(msg);
}
var implementationInfo = implementation.GetTypeInfo();
if (!typeInfo.IsAssignableFrom(implementationInfo))
if (!type.IsAssignableFrom(implementation))
{
var msg = string.Format(
CultureInfo.InvariantCulture,

View File

@@ -35,7 +35,7 @@ namespace OpenStack.Common.ServiceLocation
this._runtimeManager = new ServiceLocationRuntimeManager(this);
this._services.Add(typeof(IServiceLocationRuntimeManager), this._runtimeManager);
this._services.Add(typeof(IServiceLocationOverrideManager), new ServiceLocationOverrideManager(this));
this._scanner.AddAssembly(this.GetType().GetTypeInfo().Assembly);
this._scanner.AddAssembly(this.GetType().GetAssembly());
this.RegisterServices();
}

View File

@@ -0,0 +1,38 @@
// /* ============================================================================
// Copyright 2014 Hewlett Packard
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================ */
using System.IO;
using System.Threading.Tasks;
namespace OpenStack.Common
{
/// <summary>
/// Static class for extending the Stream class.
/// </summary>
public static class StreamExtentions
{
/// <summary>
/// Copies the given stream into another stream asynchronously.
/// </summary>
/// <param name="input">The given stream.</param>
/// <param name="output">The stream that will be copied into.</param>
/// <returns>An asynchronous task.</returns>
public static Task CopyAsync(this Stream input, Stream output)
{
return Task.Factory.StartNew(() => input.CopyTo(output));
}
}
}

View File

@@ -2,24 +2,21 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}</ProjectGuid>
<ProjectGuid>{E9F05CCA-2748-4785-9F72-5D3F8893BC28}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenStack</RootNamespace>
<AssemblyName>OpenStack</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Bin\Debug\</OutputPath>
<OutputPath>..\Bin\net40\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -27,15 +24,11 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\Bin\net40\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Common\Http\DisposableClass.cs" />
<Compile Include="Common\Http\HttpAbstractionClient.cs" />
@@ -47,6 +40,7 @@
<Compile Include="Common\Http\IHttpHeadersAbstraction.cs" />
<Compile Include="Common\Http\IHttpResponseAbstraction.cs" />
<Compile Include="Common\ObjectExtentions.cs" />
<Compile Include="Common\ReflectionExtentions.cs" />
<Compile Include="Common\ServiceLocation\IServiceLocationAssemblyScanner.cs" />
<Compile Include="Common\ServiceLocation\IServiceLocationManager.cs" />
<Compile Include="Common\ServiceLocation\IServiceLocationOverrideManager.cs" />
@@ -59,6 +53,7 @@
<Compile Include="Common\ServiceLocation\ServiceLocationManager.cs" />
<Compile Include="Common\ServiceLocation\ServiceLocationRegistrarFactory.cs" />
<Compile Include="Common\ServiceLocation\ServiceLocator.cs" />
<Compile Include="Common\StreamExtentions.cs" />
<Compile Include="Identity\AccessTokenPayloadConverter.cs" />
<Compile Include="Identity\IAccessTokenPayloadConverter.cs" />
<Compile Include="Identity\ICredential.cs" />
@@ -135,27 +130,32 @@
<Compile Include="Storage\StorageServicePocoClientFactory.cs" />
<Compile Include="Storage\StorageServiceRestClient.cs" />
<Compile Include="Storage\StorageServiceRestClientFactory.cs" />
<Compile Include="Threading\System.Runtime.CompilerServices\AsyncTaskMethodBuilder.cs" />
<Compile Include="Threading\System.Runtime.CompilerServices\AsyncTaskMethodBuilderOfT.cs" />
<Compile Include="Threading\System.Runtime.CompilerServices\AsyncVoidMethodBuilder.cs" />
<Compile Include="Threading\System.Runtime.CompilerServices\IAsyncStateMachine.cs" />
<Compile Include="Threading\System.Runtime.CompilerServices\ICriticalNotifyCompletion.cs" />
<Compile Include="Threading\System.Runtime.CompilerServices\INotifyCompletion.cs" />
<Compile Include="Threading\System.Threading.Tasks\TaskAwaiter.cs" />
<Compile Include="Threading\System.Threading.Tasks\TaskAwaiterOfT.cs" />
<Compile Include="Threading\System.Threading.Tasks\TaskCoreExtensions.cs" />
<Compile Include="Threading\System.Threading.Tasks\TaskEx.cs" />
<Compile Include="Threading\System.Threading.Tasks\TaskSchedularHelper.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@@ -60,7 +60,7 @@ namespace OpenStack
version.AssertIsNotNull("version", "Cannot create an OpenStack client with a null version.");
//Ensure that the assembly that contains the credential has a chance to register itself.
this.ServiceLocator.EnsureAssemblyRegistration(credential.GetType().GetTypeInfo().Assembly);
this.ServiceLocator.EnsureAssemblyRegistration(credential.GetType().GetAssembly());
return this.GetSupportedClient(this.clients, credential, token, version);
}
@@ -84,8 +84,8 @@ namespace OpenStack
version.AssertIsNotNull("version", "Cannot create an OpenStack client with a null version.");
//Ensure that the assemblies that contain the credential and client type has had a chance to register itself.
this.ServiceLocator.EnsureAssemblyRegistration(credential.GetType().GetTypeInfo().Assembly);
this.ServiceLocator.EnsureAssemblyRegistration(typeof(T).GetTypeInfo().Assembly);
this.ServiceLocator.EnsureAssemblyRegistration(credential.GetType().GetAssembly());
this.ServiceLocator.EnsureAssemblyRegistration(typeof(T).GetAssembly());
return this.GetSupportedClient(this.clients.Where(c => c == typeof(T)), credential, token, version);
}

View File

@@ -49,10 +49,10 @@ namespace OpenStack
//Ensure that the assembly that contains this credential has had a chance to be service located.
//This is, at least for now, the entry point for third-parties can extend the API/SDK.
this.ServiceLocator.EnsureAssemblyRegistration(credential.GetType().GetTypeInfo().Assembly);
this.ServiceLocator.EnsureAssemblyRegistration(typeof(T).GetTypeInfo().Assembly);
this.ServiceLocator.EnsureAssemblyRegistration(credential.GetType().GetAssembly());
this.ServiceLocator.EnsureAssemblyRegistration(typeof(T).GetAssembly());
foreach (var serviceClientDef in this.serviceClientDefinitions.Where(s =>typeof(T).GetTypeInfo().IsAssignableFrom(s.Key.GetTypeInfo())))
foreach (var serviceClientDef in this.serviceClientDefinitions.Where(s =>typeof(T).IsAssignableFrom(s.Key)))
{
if (serviceClientDef.Value != null && serviceClientDef.Value.IsSupported(credential))
{

View File

@@ -224,7 +224,7 @@ namespace OpenStack.Storage
var converter = this.ServiceLocator.Locate<IStorageObjectPayloadConverter>();
var obj = converter.Convert(containerName, objectName, resp.Headers);
await resp.Content.CopyToAsync(outputStream);
await resp.Content.CopyAsync(outputStream);
outputStream.Position = 0;
return obj;

View File

@@ -0,0 +1,160 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Runtime.CompilerServices
{
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
/// <summary>
/// Represents a builder for asynchronous methods that return a task.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes",
Justification = "Reference equality is correct in this case. [tgs]")]
[DebuggerNonUserCode]
public struct AsyncTaskMethodBuilder
{
private TaskCompletionSource<object> tcs;
/// <summary>
/// Gets the task for this builder.
/// </summary>
public Task Task
{
get
{
return this.tcs.Task;
}
}
/// <summary>
/// Creates an instance of the AsyncTaskMethodBuilder class.
/// </summary>
/// <returns>
/// A new instance of the builder.
/// </returns>
[DebuggerNonUserCode]
public static AsyncTaskMethodBuilder Create()
{
AsyncTaskMethodBuilder b;
b.tcs = new TaskCompletionSource<object>();
return b;
}
/// <summary>
/// Begins running the builder with the associated state machine.
/// </summary>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="stateMachine">
/// The state machine instance, passed by reference.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
{
stateMachine.MoveNext();
}
/// <summary>
/// Associates the builder with the specified state machine.
/// </summary>
/// <param name="stateMachine">
/// The state machine instance to associate with the builder.
/// </param>
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stateMachine",
Justification = "Required to maintain the expected pattern. [tgs].")]
[DebuggerNonUserCode]
public void SetStateMachine(IAsyncStateMachine stateMachine)
{
// Method is not implemented as it is not needed for our purpose.
throw new NotImplementedException();
}
/// <summary>
/// Schedules the state machine to proceed to the next action when the specified awaiter completes.
/// </summary>
/// <typeparam name="TAwaiter">
/// The type of the awaiter.
/// </typeparam>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="awaiter">
/// The awaiter.
/// </param>
/// <param name="stateMachine">
/// The state machine.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : INotifyCompletion
where TStateMachine : IAsyncStateMachine
{
awaiter.OnCompleted(stateMachine.MoveNext);
}
/// <summary>
/// Schedules the state machine to proceed to the next action when the specified awaiter completes.
/// This method can be called from partially trusted code.
/// <para>
/// NOTE: As this assembly does not support APTC, this method is simply a call to AwaitOnCompleted.
/// </para>
/// </summary>
/// <typeparam name="TAwaiter">
/// The type of the awaiter.
/// </typeparam>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="awaiter">
/// The awaiter.
/// </param>
/// <param name="stateMachine">
/// The state machine.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : ICriticalNotifyCompletion
where TStateMachine : IAsyncStateMachine
{
awaiter.OnCompleted(stateMachine.MoveNext);
}
/// <summary>
/// Marks the task as successfully completed.
/// </summary>
[DebuggerNonUserCode]
public void SetResult()
{
this.tcs.SetResult(null);
}
/// <summary>
/// Marks the task as failed and binds the specified exception to the task.
/// </summary>
/// <param name="exception">
/// The exception to bind to the task.
/// </param>
[DebuggerNonUserCode]
public void SetException(Exception exception)
{
this.tcs.SetException(exception);
}
}
}

View File

@@ -0,0 +1,172 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Runtime.CompilerServices
{
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
/// <summary>
/// Represents a builder for asynchronous methods that return a task.
/// </summary>
/// <typeparam name="T">
/// The result to use to complete the task.
/// </typeparam>
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes",
Justification = "Reference equality is correct in this case. [tgs]")]
[DebuggerNonUserCode]
public struct AsyncTaskMethodBuilder<T>
{
/// <summary>
/// The TaskCompletionSource for this builder.
/// </summary>
private TaskCompletionSource<T> tcs;
/// <summary>
/// Gets the task for this builder.
/// </summary>
[DebuggerNonUserCode]
public Task<T> Task
{
get
{
return this.tcs.Task;
}
}
/// <summary>
/// Creates an instance of the AsyncTaskMethodBuilder&lt;TResult&gt; class.
/// </summary>
/// <returns>
/// A new instance of the builder.
/// </returns>
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes",
Justification = "Acceptable in this case in order to maintain the overall pattern. [tgs]")]
[DebuggerNonUserCode]
public static AsyncTaskMethodBuilder<T> Create()
{
AsyncTaskMethodBuilder<T> builder;
builder.tcs = new TaskCompletionSource<T>();
return builder;
}
/// <summary>
/// Begins running the builder with the associated state machine.
/// </summary>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="stateMachine">
/// The state machine instance, passed by reference.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
{
stateMachine.MoveNext();
}
/// <summary>
/// Associates the builder with the specified state machine.
/// </summary>
/// <param name="stateMachine">
/// The state machine instance to associate with the builder.
/// </param>
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stateMachine",
Justification = "Required to maintain the expected pattern. [tgs].")]
[DebuggerNonUserCode]
public void SetStateMachine(IAsyncStateMachine stateMachine)
{
// Method is not implemented as it is not needed for our purpose.
throw new NotImplementedException();
}
/// <summary>
/// Schedules the state machine to proceed to the next action when the specified awaiter completes.
/// </summary>
/// <typeparam name="TAwaiter">
/// The type of the awaiter.
/// </typeparam>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="awaiter">
/// The awaiter.
/// </param>
/// <param name="stateMachine">
/// The state machine.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : INotifyCompletion
where TStateMachine : IAsyncStateMachine
{
awaiter.OnCompleted(stateMachine.MoveNext);
}
/// <summary>
/// Schedules the state machine to proceed to the next action when the specified awaiter completes.
/// This method can be called from partially trusted code.
/// <para>
/// NOTE: As this assembly does not support APTC, this method is simply a call to AwaitOnCompleted.
/// </para>
/// </summary>
/// <typeparam name="TAwaiter">
/// The type of the awaiter.
/// </typeparam>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="awaiter">
/// The awaiter.
/// </param>
/// <param name="stateMachine">
/// The state machine.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : ICriticalNotifyCompletion
where TStateMachine : IAsyncStateMachine
{
this.AwaitOnCompleted(ref awaiter, ref stateMachine);
}
/// <summary>
/// Marks the task as successfully completed.
/// </summary>
/// <param name="result">
/// The result to use to complete the task.
/// </param>
[DebuggerNonUserCode]
public void SetResult(T result)
{
this.tcs.SetResult(result);
}
/// <summary>
/// Marks the task as failed and binds the specified exception to the task.
/// </summary>
/// <param name="exception">
/// The exception to bind to the task.
/// </param>
[DebuggerNonUserCode]
public void SetException(Exception exception)
{
this.tcs.SetException(exception);
}
}
}

View File

@@ -0,0 +1,143 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Runtime.CompilerServices
{
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
/// <summary>
/// Represents a builder for asynchronous methods that do not return a value.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes",
Justification = "Reference equality is correct in this case. [tgs]")]
[DebuggerNonUserCode]
public struct AsyncVoidMethodBuilder
{
/// <summary>
/// Creates an instance of the AsyncVoidMethodBuilder class.
/// </summary>
/// <returns>
/// A new instance of the builder.
/// </returns>
[DebuggerNonUserCode]
public static AsyncVoidMethodBuilder Create()
{
return new AsyncVoidMethodBuilder();
}
/// <summary>
/// Binds an exception to the method builder.
/// </summary>
/// <param name="exception">
/// The exception to bind.
/// </param>
[DebuggerNonUserCode]
public void SetException(Exception exception)
{
throw exception;
}
/// <summary>
/// Marks the method builder as successfully completed.
/// </summary>
[DebuggerNonUserCode]
public void SetResult()
{
}
/// <summary>
/// Associates the builder with the specified state machine.
/// </summary>
/// <param name="stateMachine">
/// The state machine instance to associate with the builder.
/// </param>
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stateMachine",
Justification = "Required to maintain the expected pattern. [tgs].")]
[DebuggerNonUserCode]
public void SetStateMachine(IAsyncStateMachine stateMachine)
{
// Method is not implemented as it is not needed for our purpose.
throw new NotImplementedException();
}
/// <summary>
/// Begins running the builder with the associated state machine.
/// </summary>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="stateMachine">
/// The state machine instance, passed by reference.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
{
stateMachine.MoveNext();
}
/// <summary>
/// Schedules the state machine to proceed to the next action when the specified awaiter completes.
/// </summary>
/// <typeparam name="TAwaiter">
/// The type of the awaiter.
/// </typeparam>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="awaiter">
/// The awaiter.
/// </param>
/// <param name="stateMachine">
/// The state machine.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : INotifyCompletion
where TStateMachine : IAsyncStateMachine
{
awaiter.OnCompleted(stateMachine.MoveNext);
}
/// <summary>
/// Schedules the state machine to proceed to the next action when the specified awaiter completes.
/// This method can be called from partially trusted code.
/// <para>
/// NOTE: As this assembly does not support APTC, this method is simply a call to AwaitOnCompleted.
/// </para>
/// </summary>
/// <typeparam name="TAwaiter">
/// The type of the awaiter.
/// </typeparam>
/// <typeparam name="TStateMachine">
/// The type of the state machine.
/// </typeparam>
/// <param name="awaiter">
/// The awaiter.
/// </param>
/// <param name="stateMachine">
/// The state machine.
/// </param>
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", Justification = "Per design of the framework. [tgs]")]
[DebuggerNonUserCode]
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : ICriticalNotifyCompletion
where TStateMachine : IAsyncStateMachine
{
awaiter.OnCompleted(stateMachine.MoveNext);
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Represents state machines that are generated for asynchronous methods. This type is intended for compiler use only.
/// </summary>
public interface IAsyncStateMachine
{
/// <summary>
/// Moves the state machine to its next state.
/// </summary>
void MoveNext();
/// <summary>
/// Configures the state machine with a heap-allocated replica.
/// </summary>
/// <param name="stateMachine">
/// The heap-allocated replica.
/// </param>
void SetStateMachine(IAsyncStateMachine stateMachine);
}
}

View File

@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Runtime.CompilerServices
{
using System.Security;
/// <summary>
/// Represents an awaiter that schedules continuations when an await operation completes.
/// </summary>
public interface ICriticalNotifyCompletion : INotifyCompletion
{
/// <summary>
/// Schedules the continuation action that's invoked when the instance completes.
/// </summary>
/// <param name="continuation">
/// The action to invoke when the operation completes.
/// </param>
[SecurityCritical]
void UnsafeOnCompleted(Action continuation);
}
}

View File

@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Represents an operation that schedules continuations when it completes.
/// </summary>
public interface INotifyCompletion
{
/// <summary>
/// Schedules the continuation action that's invoked when the instance completes.
/// </summary>
/// <param name="continuation">
/// The action to invoke when the operation completes.
/// </param>
void OnCompleted(Action continuation);
}
}

View File

@@ -0,0 +1,93 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Threading.Tasks
{
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
/// <summary>
/// Provides an object that waits for the completion of an asynchronous task.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes",
Justification = "Reference equality is correct in this case. [tgs]")]
[DebuggerNonUserCode]
public struct TaskAwaiter : INotifyCompletion
{
private readonly Task task;
/// <summary>
/// Initializes a new instance of the TaskAwaiter structure.
/// </summary>
/// <param name="task">
/// The task.
/// </param>
[DebuggerNonUserCode]
public TaskAwaiter(Task task)
{
this.task = task;
}
/// <summary>
/// Gets a task scheduler.
/// </summary>
[DebuggerNonUserCode]
public static TaskScheduler TaskScheduler
{
get
{
return TaskSchedularHelper.TaskScheduler;
}
}
/// <summary>
/// Gets a value indicating whether the asynchronous task has completed.
/// </summary>
[DebuggerNonUserCode]
public bool IsCompleted
{
get { return this.task.IsCompleted; }
}
/// <summary>
/// Sets the action to perform when the TaskAwaiter object stops waiting for the asynchronous task to complete.
/// </summary>
/// <param name="continuation">
/// The action to perform when the wait operation completes.
/// </param>
[DebuggerNonUserCode]
public void OnCompleted(Action continuation)
{
TaskCoreExtensions.CompletedInternal(continuation);
}
/// <summary>
/// Ends the wait for the completion of the asynchronous task.
/// </summary>
[DebuggerNonUserCode]
public void GetResult()
{
try
{
this.task.Wait();
}
catch (AggregateException ex)
{
throw ex.InnerExceptions[0];
}
}
}
}

View File

@@ -0,0 +1,87 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Threading.Tasks
{
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
/// <summary>
/// Represents an object that waits for the completion of an asynchronous task and provides a parameter for the result.
/// </summary>
/// <typeparam name="T">
/// The result for the task.
/// </typeparam>
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes",
Justification = "Reference equality is correct in this case. [tgs]")]
[DebuggerNonUserCode]
public struct TaskAwaiter<T> : INotifyCompletion
{
private readonly Task<T> task;
/// <summary>
/// Initializes a new instance of the TaskAwaiter structure.
/// </summary>
/// <param name="task">
/// The task to await.
/// </param>
[DebuggerNonUserCode]
public TaskAwaiter(Task<T> task)
{
this.task = task;
}
/// <summary>
/// Gets a value indicating whether the asynchronous task has completed.
/// </summary>
[DebuggerNonUserCode]
public bool IsCompleted
{
get { return this.task.IsCompleted; }
}
/// <summary>
/// Sets the action to perform when the TaskAwaiter object stops waiting for the asynchronous task to complete.
/// </summary>
/// <param name="continuation">
/// The action to perform when the wait operation completes.
/// </param>
[DebuggerNonUserCode]
public void OnCompleted(Action continuation)
{
TaskCoreExtensions.CompletedInternal(continuation);
}
/// <summary>
/// Ends the wait for the completion of the asynchronous task.
/// </summary>
/// <returns>
/// The result of the completed task.
/// </returns>
[DebuggerNonUserCode]
public T GetResult()
{
try
{
return this.task.Result;
}
catch (AggregateException ex)
{
throw ex.InnerExceptions[0];
}
}
}
}

View File

@@ -0,0 +1,95 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Threading.Tasks
{
using System.IO;
using System.Diagnostics;
/// <summary>
/// Provides core extension methods for task.
/// </summary>
[DebuggerNonUserCode]
public static class TaskCoreExtensions
{
/// <summary>
/// Reads all characters from the current position to the end of the TextReader
/// and returns them as one string asynchronously.
/// </summary>
/// <param name="source">The source reader.</param>
/// <returns>
/// A Task that represents the asynchronous operation.
/// </returns>
[DebuggerNonUserCode]
public static Task<string> ReadToEndAsync(this TextReader source)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
else
{
return Task.Factory.StartNew<string>((Func<string>)(() => source.ReadToEnd()), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);
}
}
/// <summary>
/// Gets an awaiter used to await this Task.
/// </summary>
/// <param name="task">
/// The task object being extended.
/// </param>
/// <returns>
/// An awaiter instance.
/// </returns>
[DebuggerNonUserCode]
public static TaskAwaiter GetAwaiter(this Task task)
{
return new TaskAwaiter(task);
}
/// <summary>
/// Gets an awaiter used to await this Task&lt;TResult%gt;.
/// </summary>
/// <typeparam name="T">
/// The return type for the task.
/// </typeparam>
/// <param name="task">
/// The task object being extended.
/// </param>
/// <returns>
/// An awaiter instance.
/// </returns>
[DebuggerNonUserCode]
public static TaskAwaiter<T> GetAwaiter<T>(this Task<T> task)
{
return new TaskAwaiter<T>(task);
}
/// <summary>
/// Schedules the continuation onto the <see cref="Task" /> associated with this <see cref="TaskAwaiter" /> .
/// </summary>
/// <param name="continuation"> The action to invoke when the await operation completes. </param>
[DebuggerNonUserCode]
internal static void CompletedInternal(Action continuation)
{
var scheduler = TaskScheduler.Current;
Task.Factory.StartNew(state => ((Action)state)(),
continuation,
CancellationToken.None,
TaskCreationOptions.None,
scheduler);
}
}
}

View File

@@ -0,0 +1,183 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Threading.Tasks
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
/// <summary>
/// Provides extra functions to be used in place of NetFx 4.5 task standard static methods.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix",
Justification = "This naming is by convention for this usage as set by other standard async targeting packages. [tgs]")]
public static class TaskEx
{
/// <summary>
/// Returns a task that has been completed.
/// </summary>
/// <returns>
/// A completed task.
/// </returns>
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope",
Justification = "In this case the pattern is correct. [TGS]")]
public static Task GetCompletedTask()
{
Task retval = null;
try
{
retval = new Task(() => { });
}
catch (Exception)
{
if (!ReferenceEquals(retval, null))
{
retval.Dispose();
}
throw;
}
retval.Start();
retval.Wait();
return retval;
}
/// <summary>
/// Creates a task that runs the specified action.
/// </summary>
/// <param name="action">The action to execute asynchronously.</param>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="action"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task Run(Action action)
{
return TaskEx.Run(action, CancellationToken.None);
}
/// <summary>
/// Creates a task that runs the specified action.
/// </summary>
/// <param name="action">The action to execute.</param><param name="cancellationToken">The CancellationToken to use to request cancellation of this task.</param>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="action"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task Run(Action action, CancellationToken cancellationToken)
{
return Task.Factory.StartNew(action, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
}
/// <summary>
/// Creates a task that runs the specified function.
/// </summary>
/// <param name="function">The function to execute asynchronously.</param>
/// <typeparam name="TResult">
/// The result type of the function.
/// </typeparam>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task<TResult> Run<TResult>(Func<TResult> function)
{
return TaskEx.Run<TResult>(function, CancellationToken.None);
}
/// <summary>
/// Creates a task that runs the specified function.
/// </summary>
/// <param name="function">The action to execute.</param><param name="cancellationToken">The CancellationToken to use to cancel the task.</param>
/// <typeparam name="TResult">
/// The result type of the function.
/// </typeparam>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task<TResult> Run<TResult>(Func<TResult> function, CancellationToken cancellationToken)
{
return Task.Factory.StartNew<TResult>(function, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
}
/// <summary>
/// Creates a task that runs the specified function.
/// </summary>
/// <param name="function">The action to execute asynchronously.</param>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task Run(Func<Task> function)
{
return TaskEx.Run(function, CancellationToken.None);
}
/// <summary>
/// Creates a task that runs the specified function.
/// </summary>
/// <param name="function">The function to execute.</param><param name="cancellationToken">The CancellationToken to use to request cancellation of this task.</param>
/// <returns>
/// A task that represents the completion of the function.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task Run(Func<Task> function, CancellationToken cancellationToken)
{
return TaskExtensions.Unwrap(TaskEx.Run<Task>(function, cancellationToken));
}
/// <summary>
/// Creates a task that runs the specified function.
/// </summary>
/// <param name="function">The function to execute asynchronously.</param>
/// <typeparam name="TResult">
/// The result type of the function.
/// </typeparam>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task<TResult> Run<TResult>(Func<Task<TResult>> function)
{
return TaskEx.Run<TResult>(function, CancellationToken.None);
}
/// <summary>
/// Creates a task that runs the specified function.
/// </summary>
/// <param name="function">The action to execute.</param><param name="cancellationToken">The CancellationToken to use to cancel the task.</param>
/// <typeparam name="TResult">
/// The result type of the function.
/// </typeparam>
/// <returns>
/// A task that represents the completion of the action.
/// </returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function"/> argument is null.</exception>
[DebuggerNonUserCode]
public static Task<TResult> Run<TResult>(Func<Task<TResult>> function, CancellationToken cancellationToken)
{
return TaskExtensions.Unwrap<TResult>(TaskEx.Run<Task<TResult>>(function, cancellationToken));
}
}
}

View File

@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace System.Threading.Tasks
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
internal static class TaskSchedularHelper
{
/// <summary>
/// Gets a task scheduler.
/// </summary>
[DebuggerNonUserCode]
public static TaskScheduler TaskScheduler
{
get
{
if (SynchronizationContext.Current == null)
{
return TaskScheduler.Default;
}
return TaskScheduler.FromCurrentSynchronizationContext();
}
}
}
}

View File

@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.7" targetFramework="portable-net45+wp80+win" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable-net45+wp80+win" />
<package id="Microsoft.Net.Http" version="2.2.19" targetFramework="portable-net45+wp80+win" />
<package id="Newtonsoft.Json" version="6.0.2" targetFramework="portable-net45+wp80+win" />
</packages>

View File

@@ -0,0 +1,80 @@
// /* ============================================================================
// Copyright 2014 Hewlett Packard
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================ */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace OpenStack.Common
{
/// <summary>
/// Static class for extending reflection classes.
/// </summary>
internal static class ReflectionExtentions
{
/// <summary>
/// Gets the assembly that contains the extended type.
/// </summary>
/// <param name="input">The given Type</param>
/// <returns>The assembly that contains the given type.</returns>
public static Assembly GetAssembly(this Type input)
{
return input.GetTypeInfo().Assembly;
}
/// <summary>
/// Determines if a type is assignable from the given type.
/// </summary>
/// <param name="input">The given type.</param>
/// <param name="target">The type to evaluate.</param>
/// <returns>A value indicating if the target is assignable from the given type.</returns>
public static bool IsAssignableFrom(this Type input, Type target)
{
return input.GetTypeInfo().IsAssignableFrom(target.GetTypeInfo());
}
/// <summary>
/// Determines if the given type is an interface.
/// </summary>
/// <param name="input">The given type.</param>
/// <returns>A value indicating if the given type is an interface.</returns>
public static bool IsInterface(this Type input)
{
return input.GetTypeInfo().IsInterface;
}
/// <summary>
/// Gets a list of types that are defined in the given assembly.
/// </summary>
/// <param name="input">The given assembly.</param>
/// <returns>A list of types defined in the given assembly.</returns>
public static IEnumerable<Type> GetDefinedTypes(this Assembly input)
{
return input.DefinedTypes.Select(ti => ti.AsType());
}
/// <summary>
/// Gets a list of defined constructors for the given type.
/// </summary>
/// <param name="input">The given type.</param>
/// <returns>A list of constructors for the given type.</returns>
public static IEnumerable<ConstructorInfo> GetDefinedConstructors(this Type input)
{
return input.GetTypeInfo().DeclaredConstructors;
}
}
}

View File

@@ -0,0 +1,38 @@
// /* ============================================================================
// Copyright 2014 Hewlett Packard
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================ */
using System.IO;
using System.Threading.Tasks;
namespace OpenStack.Common
{
/// <summary>
/// Static class for extending the Stream class.
/// </summary>
public static class StreamExtentions
{
/// <summary>
/// Copies the given stream into another stream asynchronously.
/// </summary>
/// <param name="input">The given stream.</param>
/// <param name="output">The stream that will be copied into.</param>
/// <returns>An asynchronous task.</returns>
public static Task CopyAsync(this Stream input, Stream output)
{
return input.CopyToAsync(output);
}
}
}

View File

@@ -0,0 +1,356 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5660F8AA-14D5-4B3B-ADA0-F79A286EF483}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenStack</RootNamespace>
<AssemblyName>OpenStack</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Bin\net45\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Bin\net45\Debug\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\OpenStack\Common\Http\DisposableClass.cs">
<Link>Common\Http\DisposableClass.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\HttpAbstractionClient.cs">
<Link>Common\Http\HttpAbstractionClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\HttpAbstractionClientFactory.cs">
<Link>Common\Http\HttpAbstractionClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\HttpHeadersAbstraction.cs">
<Link>Common\Http\HttpHeadersAbstraction.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\HttpResponseAbstraction.cs">
<Link>Common\Http\HttpResponseAbstraction.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\IHttpAbstractionClient.cs">
<Link>Common\Http\IHttpAbstractionClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\IHttpAbstractionClientFactory.cs">
<Link>Common\Http\IHttpAbstractionClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\IHttpHeadersAbstraction.cs">
<Link>Common\Http\IHttpHeadersAbstraction.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\Http\IHttpResponseAbstraction.cs">
<Link>Common\Http\IHttpResponseAbstraction.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ObjectExtentions.cs">
<Link>Common\ObjectExtentions.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocationAssemblyScanner.cs">
<Link>Common\ServiceLocation\IServiceLocationAssemblyScanner.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocationManager.cs">
<Link>Common\ServiceLocation\IServiceLocationManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocationOverrideManager.cs">
<Link>Common\ServiceLocation\IServiceLocationOverrideManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocationRegistrar.cs">
<Link>Common\ServiceLocation\IServiceLocationRegistrar.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocationRegistrarFactory.cs">
<Link>Common\ServiceLocation\IServiceLocationRegistrarFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocationRuntimeManager.cs">
<Link>Common\ServiceLocation\IServiceLocationRuntimeManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\IServiceLocator.cs">
<Link>Common\ServiceLocation\IServiceLocator.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\RuntimeRegistrationManager.cs">
<Link>Common\ServiceLocation\RuntimeRegistrationManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\ServiceLocationAssemblyScanner.cs">
<Link>Common\ServiceLocation\ServiceLocationAssemblyScanner.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\ServiceLocationManager.cs">
<Link>Common\ServiceLocation\ServiceLocationManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\ServiceLocationRegistrarFactory.cs">
<Link>Common\ServiceLocation\ServiceLocationRegistrarFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Common\ServiceLocation\ServiceLocator.cs">
<Link>Common\ServiceLocation\ServiceLocator.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\AccessTokenPayloadConverter.cs">
<Link>Identity\AccessTokenPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IAccessTokenPayloadConverter.cs">
<Link>Identity\IAccessTokenPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\ICredential.cs">
<Link>Identity\ICredential.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IdentityServiceClient.cs">
<Link>Identity\IdentityServiceClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IdentityServiceClientDefinition.cs">
<Link>Identity\IdentityServiceClientDefinition.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IdentityServicePocoClient.cs">
<Link>Identity\IdentityServicePocoClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IdentityServicePocoClientFactory.cs">
<Link>Identity\IdentityServicePocoClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IdentityServiceRestClient.cs">
<Link>Identity\IdentityServiceRestClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IdentityServiceRestClientFactory.cs">
<Link>Identity\IdentityServiceRestClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IIdentityServiceClient.cs">
<Link>Identity\IIdentityServiceClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IIdentityServicePocoClient.cs">
<Link>Identity\IIdentityServicePocoClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IIdentityServicePocoClientFactory.cs">
<Link>Identity\IIdentityServicePocoClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IIdentityServiceRestClient.cs">
<Link>Identity\IIdentityServiceRestClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IIdentityServiceRestClientFactory.cs">
<Link>Identity\IIdentityServiceRestClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IOpenStackCredential.cs">
<Link>Identity\IOpenStackCredential.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IOpenStackRegionResolver.cs">
<Link>Identity\IOpenStackRegionResolver.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IOpenStackServiceCatalog.cs">
<Link>Identity\IOpenStackServiceCatalog.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IOpenStackServiceCatalogPayloadConverter.cs">
<Link>Identity\IOpenStackServiceCatalogPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IOpenStackServiceDefinitionPayloadConverter.cs">
<Link>Identity\IOpenStackServiceDefinitionPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\IOpenStackServiceEndpointPayloadConverter.cs">
<Link>Identity\IOpenStackServiceEndpointPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackCredential.cs">
<Link>Identity\OpenStackCredential.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackRegionResolver.cs">
<Link>Identity\OpenStackRegionResolver.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackServiceCatalog.cs">
<Link>Identity\OpenStackServiceCatalog.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackServiceCatalogPayloadConverter.cs">
<Link>Identity\OpenStackServiceCatalogPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackServiceDefinition.cs">
<Link>Identity\OpenStackServiceDefinition.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackServiceDefinitionPayloadConverter.cs">
<Link>Identity\OpenStackServiceDefinitionPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackServiceEndpoint.cs">
<Link>Identity\OpenStackServiceEndpoint.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Identity\OpenStackServiceEndpointPayloadConverter.cs">
<Link>Identity\OpenStackServiceEndpointPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\IOpenStackClient.cs">
<Link>IOpenStackClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\IOpenStackClientManager.cs">
<Link>IOpenStackClientManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\IOpenStackServiceClient.cs">
<Link>IOpenStackServiceClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\IOpenStackServiceClientDefinition.cs">
<Link>IOpenStackServiceClientDefinition.cs</Link>
</Compile>
<Compile Include="..\OpenStack\IOpenStackServiceClientManager.cs">
<Link>IOpenStackServiceClientManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\OpenStackClient.cs">
<Link>OpenStackClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\OpenStackClientFactory.cs">
<Link>OpenStackClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\OpenStackClientManager.cs">
<Link>OpenStackClientManager.cs</Link>
</Compile>
<Compile Include="..\OpenStack\OpenStackServiceClientManager.cs">
<Link>OpenStackServiceClientManager.cs</Link>
</Compile>
<Compile Include="Common\ReflectionExtentions.cs" />
<Compile Include="Common\StreamExtentions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="..\OpenStack\ServiceRegistrar.cs">
<Link>ServiceRegistrar.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\ContainerNameValidator.cs">
<Link>Storage\ContainerNameValidator.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\DynamicLargeObjectManifest.cs">
<Link>Storage\DynamicLargeObjectManifest.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\FolderNameValidator.cs">
<Link>Storage\FolderNameValidator.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\ILargeStorageObjectCreator.cs">
<Link>Storage\ILargeStorageObjectCreator.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\ILargeStorageObjectCreatorFactory.cs">
<Link>Storage\ILargeStorageObjectCreatorFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageAccountPayloadConverter.cs">
<Link>Storage\IStorageAccountPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageContainerPayloadConverter.cs">
<Link>Storage\IStorageContainerPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageFolderPayloadConverter.cs">
<Link>Storage\IStorageFolderPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageObjectPayloadConverter.cs">
<Link>Storage\IStorageObjectPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageServiceClient.cs">
<Link>Storage\IStorageServiceClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageServicePocoClient.cs">
<Link>Storage\IStorageServicePocoClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageServicePocoClientFactory.cs">
<Link>Storage\IStorageServicePocoClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageServiceRestClient.cs">
<Link>Storage\IStorageServiceRestClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\IStorageServiceRestClientFactory.cs">
<Link>Storage\IStorageServiceRestClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\LargeStorageObjectCreator.cs">
<Link>Storage\LargeStorageObjectCreator.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\LargeStorageObjectCreatorFactory.cs">
<Link>Storage\LargeStorageObjectCreatorFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StaticLargeObjectManifest.cs">
<Link>Storage\StaticLargeObjectManifest.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageAccount.cs">
<Link>Storage\StorageAccount.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageAccountPayloadConverter.cs">
<Link>Storage\StorageAccountPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageContainer.cs">
<Link>Storage\StorageContainer.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageContainerPayloadConverter.cs">
<Link>Storage\StorageContainerPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageFolder.cs">
<Link>Storage\StorageFolder.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageFolderPayloadConverter.cs">
<Link>Storage\StorageFolderPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageItem.cs">
<Link>Storage\StorageItem.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageManifest.cs">
<Link>Storage\StorageManifest.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageObject.cs">
<Link>Storage\StorageObject.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageObjectPayloadConverter.cs">
<Link>Storage\StorageObjectPayloadConverter.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServiceClient.cs">
<Link>Storage\StorageServiceClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServiceClientContext.cs">
<Link>Storage\StorageServiceClientContext.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServiceClientDefinition.cs">
<Link>Storage\StorageServiceClientDefinition.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServicePocoClient.cs">
<Link>Storage\StorageServicePocoClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServicePocoClientFactory.cs">
<Link>Storage\StorageServicePocoClientFactory.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServiceRestClient.cs">
<Link>Storage\StorageServiceRestClient.cs</Link>
</Compile>
<Compile Include="..\OpenStack\Storage\StorageServiceRestClientFactory.cs">
<Link>Storage\StorageServiceRestClientFactory.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,34 @@
// /* ============================================================================
// Copyright 2014 Hewlett Packard
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================ */
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenStack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("OpenStack.org")]
[assembly: AssemblyProduct("OpenStack")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("OpenStack.Test")]

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="portable-net45+wp80+win" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable-net45+wp80+win" />
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="portable-net45+wp80+win" />
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="portable-net45+wp80+win" />
</packages>