Port to .NET Core (#1503)

Port to .NET Core
This commit is contained in:
Mickaël Derriey
2017-01-21 15:42:02 +11:00
committed by Ryan Gribble
parent 3c818934b8
commit 13d5dab516
155 changed files with 1334 additions and 6014 deletions
+20 -15
View File
@@ -7,6 +7,9 @@ using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Octokit.Internal;
#if !HAS_ENVIRONMENT
using System.Runtime.InteropServices;
#endif
namespace Octokit
{
@@ -59,7 +62,7 @@ namespace Octokit
/// the user agent for analytics purposes.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
/// instance</param>
public Connection(ProductHeaderValue productInformation, Uri baseAddress)
: this(productInformation, baseAddress, _anonymousCredentials)
@@ -87,7 +90,7 @@ namespace Octokit
/// the user agent for analytics purposes.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
/// instance</param>
/// <param name="credentialStore">Provides credentials to the client when making requests</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
@@ -104,7 +107,7 @@ namespace Octokit
/// the user agent for analytics purposes.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
/// instance</param>
/// <param name="credentialStore">Provides credentials to the client when making requests</param>
/// <param name="httpClient">A raw <see cref="IHttpClient"/> used to make requests</param>
@@ -539,9 +542,9 @@ namespace Octokit
/// Gets or sets the credentials used by the connection.
/// </summary>
/// <remarks>
/// You can use this property if you only have a single hard-coded credential. Otherwise, pass in an
/// <see cref="ICredentialStore"/> to the constructor.
/// Setting this property will change the <see cref="ICredentialStore"/> to use
/// You can use this property if you only have a single hard-coded credential. Otherwise, pass in an
/// <see cref="ICredentialStore"/> to the constructor.
/// Setting this property will change the <see cref="ICredentialStore"/> to use
/// the default <see cref="InMemoryCredentialStore"/> with just these credentials.
/// </remarks>
public Credentials Credentials
@@ -670,17 +673,19 @@ namespace Octokit
static string FormatUserAgent(ProductHeaderValue productInformation)
{
var format =
#if !HAS_ENVIRONMENT
"{0} ({1}; {2}; {3}; Octokit {4})";
#else
"{0} ({1} {2}; {3}; {4}; Octokit {5})";
#endif
return string.Format(CultureInfo.InvariantCulture,
"{0} ({1} {2}; {3}; {4}; Octokit {5})",
format,
productInformation,
#if NETFX_CORE
// Microsoft doesn't want you changing your Windows Store Application based on the processor or
// Windows version. If we really wanted this information, we could do a best guess based on
// this approach: http://attackpattern.com/2013/03/device-information-in-windows-8-store-apps/
// But I don't think we care all that much.
"WindowsRT",
"8+",
"unknown",
#if !HAS_ENVIRONMENT
RuntimeInformation.OSDescription,
RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant(),
#else
Environment.OSVersion.Platform,
Environment.OSVersion.Version.ToString(3),