Add utf8 with bom (#2641)

* Change default file encoding
This commit is contained in:
JoannaaKL
2023-06-02 21:47:59 +02:00
committed by GitHub
parent 3a1376f90e
commit efffbaeabc
268 changed files with 477 additions and 488 deletions

View File

@@ -13,7 +13,7 @@ namespace GitHub.Services.Common
{
protected FederatedCredential(IssuedToken initialToken)
: base(initialToken)
{
{
}
public override bool IsAuthenticationChallenge(IHttpResponse webResponse)

View File

@@ -262,7 +262,7 @@ namespace GitHub.Services.Common
aadAuthTokenTimer.Stop();
TimeSpan getTokenTime = aadAuthTokenTimer.Elapsed;
if(getTokenTime.TotalSeconds >= c_slowTokenAcquisitionTimeInSeconds)
if (getTokenTime.TotalSeconds >= c_slowTokenAcquisitionTimeInSeconds)
{
// It may seem strange to pass the string value of TotalSeconds into this method, but testing
// showed that ETW is persnickety when you register a method in an EventSource that doesn't
@@ -513,7 +513,7 @@ namespace GitHub.Services.Common
{
VssHttpEventSource.Log.IssuedTokenWaitStart(traceActivity, this.Provider, this.ActivityId);
token = await Task.Factory.ContinueWhenAll<IssuedToken>(new Task[] { CompletionSource.Task }, (x) => CompletionSource.Task.Result, cancellationToken).ConfigureAwait(false);
token = await Task.Factory.ContinueWhenAll<IssuedToken>(new Task[] { CompletionSource.Task }, (x) => CompletionSource.Task.Result, cancellationToken).ConfigureAwait(false);
}
finally
{

View File

@@ -44,7 +44,7 @@ namespace GitHub.Services.Common
[EditorBrowsable(EditorBrowsableState.Never)]
public class GenerateAllConstantsAttribute : GenerateConstantAttribute
{
public GenerateAllConstantsAttribute(string alternateName = null)
public GenerateAllConstantsAttribute(string alternateName = null)
: base(alternateName)
{
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Net;
using System.Net.Http;
using System.Threading;

View File

@@ -30,7 +30,7 @@ namespace GitHub.Services.Common
{
Debug.Assert(a1 != null, "a1 was null");
Debug.Assert(a2 != null, "a2 was null");
// Check if the lengths are the same.
if (a1.Length != a2.Length)
{
@@ -91,7 +91,7 @@ namespace GitHub.Services.Common
int i;
for (i = length >> 2; i > 0; --i)
{
if (*((int*) q1) != *((int*) q2))
if (*((int*)q1) != *((int*)q2))
{
return false;
}
@@ -114,7 +114,7 @@ namespace GitHub.Services.Common
}
return true;
}
//****************************************************************************************
/// <summary>
/// Convert the byte array to a lower case hex string.

View File

@@ -21,7 +21,7 @@ namespace GitHub.Services.Common.Internal
public const String VssRateLimitDelay = "X-RateLimit-Delay";
public const String VssRateLimitReset = "X-RateLimit-Reset";
public const String VssHostOfflineError = "X-VSS-HostOfflineError";
public const string VssRequestPriority = "X-VSS-RequestPriority";

View File

@@ -75,7 +75,7 @@ namespace GitHub.Services.Common.Internal
/// </summary>
/// <param name="propertyName"></param>
public static void ValidatePropertyName(String propertyName)
{
{
ValidatePropertyString(propertyName, c_maxPropertyNameLengthInChars, "propertyName");
// Key must not start or end in whitespace. ValidatePropertyString() checks for null and empty strings,

View File

@@ -121,7 +121,7 @@ namespace GitHub.Services.Common
return message;
}
private static string ScrubSecret(string message, string token, string mask, bool assertOnDetection, bool maskToken=false)
private static string ScrubSecret(string message, string token, string mask, bool assertOnDetection, bool maskToken = false)
{
int startIndex = -1;

View File

@@ -58,7 +58,7 @@ namespace GitHub.Services.Common
public override bool CanRead
{
get
get
{
return m_stream.CanRead && m_stream.Position <= this.EndingPostionOnOuterStream;
}
@@ -81,7 +81,7 @@ namespace GitHub.Services.Common
public override long Length
{
get
get
{
return m_length;
}
@@ -150,7 +150,7 @@ namespace GitHub.Services.Common
}
else if (origin == SeekOrigin.End && 0 >= offset && offset > -m_length)
{
return m_stream.Seek(offset - ((m_stream.Length-1) - this.EndingPostionOnOuterStream), origin);
return m_stream.Seek(offset - ((m_stream.Length - 1) - this.EndingPostionOnOuterStream), origin);
}
else if (origin == SeekOrigin.Current && (offset + m_stream.Position) >= this.StartingPostionOnOuterStream && (offset + m_stream.Position) < this.EndingPostionOnOuterStream)
{

View File

@@ -696,7 +696,7 @@ namespace GitHub.Services.Common.Internal
return uri;
}
#region functionality forked from System.Web.HttpUtility
#region functionality forked from System.Web.HttpUtility
//*************************************************************************************************
// This region UriUtility contains functionality forked from System.Web.HttpUtility.
// Only our server assemblies can take a dependency on System.Web because it is not part of the
@@ -710,7 +710,7 @@ namespace GitHub.Services.Common.Internal
// Don't entity encode high chars (160 to 256), to fix bugs VSWhidbey 85857/111927
// REVIEW: comment out this line to fix VSWhidbey 85857/111927, after we verify that it's safe to do so
#region ParseFragmentString
#region ParseFragmentString
public static NameValueCollection ParseFragmentString(string fragment)
{
@@ -735,9 +735,9 @@ namespace GitHub.Services.Common.Internal
return new HttpValueCollection(fragment, false, urlEncoded, encoding);
}
#endregion
#endregion
#region ParseQueryString
#region ParseQueryString
// *** Source: ndp/fx/src/xsp/system/web/httpserverutility.cs
@@ -764,9 +764,9 @@ namespace GitHub.Services.Common.Internal
return new HttpValueCollection(query, false, urlEncoded, encoding);
}
#endregion
#endregion
#region UrlEncode implementation
#region UrlEncode implementation
// *** Source: ndp/fx/src/xsp/system/web/util/httpencoder.cs
@@ -887,9 +887,9 @@ namespace GitHub.Services.Common.Internal
return expandedBytes;
}
#endregion
#endregion
#region UrlEncode public methods
#region UrlEncode public methods
// *** Source: ndp/fx/src/xsp/system/web/httpserverutility.cs
@@ -972,9 +972,9 @@ namespace GitHub.Services.Common.Internal
return UrlEncodeSpaces(UrlEncodeNonAscii(str, Encoding.UTF8));
}
#endregion
#endregion
#region UrlEncodeUnicode
#region UrlEncodeUnicode
// *** Source: ndp/fx/src/xsp/system/web/util/httpencoder.cs
@@ -1022,9 +1022,9 @@ namespace GitHub.Services.Common.Internal
return sb.ToString();
}
#endregion
#endregion
#region HttpValueCollection nested class
#region HttpValueCollection nested class
// *** Source: ndp/fx/src/xsp/system/web/httpvaluecollection.cs
@@ -1260,9 +1260,9 @@ namespace GitHub.Services.Common.Internal
}
}
#endregion
#endregion
#region HtmlEncode
#region HtmlEncode
// *** Source: ndp/fx/src/net/system/net/webutility.cs
@@ -1362,7 +1362,7 @@ namespace GitHub.Services.Common.Internal
#endregion
#region HtmlEncode/Decode helper methods
#region HtmlEncode/Decode helper methods
// *** Source: ndp/fx/src/net/system/net/webutility.cs
@@ -1400,9 +1400,9 @@ namespace GitHub.Services.Common.Internal
return -1;
}
#endregion
#endregion
#region UrlDecode implementation
#region UrlDecode implementation
// *** Source: ndp/fx/src/xsp/system/web/util/httpencoder.cs
@@ -1579,9 +1579,9 @@ namespace GitHub.Services.Common.Internal
return helper.GetString();
}
#endregion
#endregion
#region UrlDecode public methods
#region UrlDecode public methods
// *** Source: ndp/fx/src/xsp/system/web/httpserverutility.cs
@@ -1649,9 +1649,9 @@ namespace GitHub.Services.Common.Internal
return UrlDecodeInternal(bytes, offset, count);
}
#endregion
#endregion
#region Helper methods
#region Helper methods
// *** Source: ndp/fx/src/xsp/system/web/util/httpencoderutility.cs
@@ -1729,9 +1729,9 @@ namespace GitHub.Services.Common.Internal
return (b >= 0x7F || b < 0x20);
}
#endregion
#endregion
#region UrlDecoder nested class
#region UrlDecoder nested class
// *** Source: ndp/fx/src/xsp/system/web/util/httpencoder.cs
@@ -1797,9 +1797,9 @@ namespace GitHub.Services.Common.Internal
}
}
#endregion
#endregion
#region HtmlDecode
#region HtmlDecode
// *** Source: ndp/fx/src/net/system/net/webutility.cs
@@ -1904,9 +1904,9 @@ namespace GitHub.Services.Common.Internal
}
}
#endregion
#endregion
#region HtmlEntities nested class
#region HtmlEntities nested class
// *** Source: ndp/fx/src/net/system/net/webutility.cs
@@ -2195,10 +2195,10 @@ namespace GitHub.Services.Common.Internal
}
}
#endregion
#endregion
// *** Source: ndp/fx/src/net/system/net/webutility.cs
private static char[] _htmlEntityEndingChars = new char[] { ';', '&' };
#endregion
#endregion
}
}

View File

@@ -152,7 +152,7 @@ namespace GitHub.Services.Common
public static VssStringComparer LinkName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer MachineName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer MailAddress { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer PropertyName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer PropertyName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer RegistrationAttributeName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer ReservedGroupName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer WMDSchemaClassName { get { return s_ordinalIgnoreCase; } }
@@ -188,7 +188,7 @@ namespace GitHub.Services.Common
public static VssStringComparer Collation { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer FeatureAvailabilityName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer TagName { get { return s_currentCultureIgnoreCase; } }
//Framework Hosting comparers.
public static VssStringComparer HostingAccountPropertyName { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer MessageBusName { get { return s_ordinalIgnoreCase; } }
@@ -213,7 +213,7 @@ namespace GitHub.Services.Common
public static VssStringComparer DomainUrl { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer AccountInfoAccount { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer AccountInfoPassword { get { return s_ordinal; } }
public static VssStringComparer AttributesDescriptor { get { return s_ordinalIgnoreCase; } }
public static VssStringComparer AttributesDescriptor { get { return s_ordinalIgnoreCase; } }
// Converters comparer
public static VssStringComparer VSSServerPath { get { return s_ordinalIgnoreCase; } }

View File

@@ -63,7 +63,7 @@ namespace GitHub.Services.Common.Internal
}
file = new FileStream(path, fileMode, fileAccess, sharing);
if (loadAsXmlDocument)
{
XmlReaderSettings settings = new XmlReaderSettings()

View File

@@ -163,7 +163,7 @@ namespace GitHub.Services.Common
public static readonly IReadOnlyDictionary<String, String> IdentityTypeMap;
}
/// <summary>
/// Common attributes tags used in the collection of properties of TeamFoundationIdentity.
/// </summary>

View File

@@ -137,8 +137,8 @@ namespace GitHub.Services.Common
info.AddValue("m_eventId", EventId);
}
/// <summary>Indicate whether this exception instance should be logged</summary>
/// <value>True (false) if the exception should (should not) be logged</value>
/// <summary>Indicate whether this exception instance should be logged</summary>
/// <value>True (false) if the exception should (should not) be logged</value>
public bool LogException
{
get
@@ -213,7 +213,7 @@ namespace GitHub.Services.Common
typeName = GetBackCompatAssemblyQualifiedName(exceptionType);
}
}
if (typeName == null)
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;

View File

@@ -15,7 +15,7 @@ namespace GitHub.Services.Common
public class VssHttpRetryOptions
{
public VssHttpRetryOptions()
: this (new VssHttpRetryableStatusCodeFilter[] { s_hostShutdownFilter } )
: this(new VssHttpRetryableStatusCodeFilter[] { s_hostShutdownFilter })
{
}

View File

@@ -79,7 +79,7 @@ namespace GitHub.Services.Common
fixed (char* pcSt = st)
{
dataDesc[1].DataPointer = (IntPtr)(pcSt);
WriteEventCore(eventId, parameters, dataDesc);
}
}
@@ -224,7 +224,7 @@ namespace GitHub.Services.Common
fixed (char* pcst1 = st1, pcst2 = st2, pcst3 = st3)
{
dataDesc[1].DataPointer = (IntPtr)(pcst1);
dataDesc[2].DataPointer = (IntPtr)(pcst2);
dataDesc[2].DataPointer = (IntPtr)(pcst2);
dataDesc[3].DataPointer = (IntPtr)(pcst3);
WriteEventCore(eventId, parameters, dataDesc);
@@ -312,10 +312,10 @@ namespace GitHub.Services.Common
dataDesc[3].Size = sizeof(long);
fixed (char* pcst1 = st1, pcst2 = st2)
{
{
dataDesc[1].DataPointer = (IntPtr)(pcst1);
dataDesc[2].DataPointer = (IntPtr)(pcst2);
WriteEventCore(eventId, parameters, dataDesc);
}
}

View File

@@ -321,7 +321,7 @@ namespace GitHub.DistributedTask.Expressions2
context.Operators.Pop();
}
var functionOperands = PopOperands(context, parameterCount);
// Node already exists on the operand stack
function = (Function)context.Operands.Peek();

View File

@@ -21,4 +21,5 @@ namespace GitHub.DistributedTask.Expressions2.Sdk.Functions
return token.ToPipelineContextData();
}
}
}}
}
}

View File

@@ -213,7 +213,7 @@ namespace GitHub.DistributedTask.Expressions2.Sdk.Operators
resultMemory = null;
return null;
}
private class FilteredArray : IReadOnlyArray
{
public FilteredArray()

View File

@@ -1,4 +1,4 @@
/*
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
@@ -341,7 +341,7 @@ namespace GitHub.DistributedTask.WebApi
Guid locationId = new Guid("27d7f831-88c1-4719-8ca1-6a061dad90eb");
object routeValues = new { scopeIdentifier = scopeIdentifier, hubName = hubName, planId = planId };
HttpContent content = new ObjectContent<ActionReferenceList>(actionReferenceList, new VssJsonMediaTypeFormatter(true));
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
queryParams.Add("jobId", jobId);
return SendAsync<ActionDownloadInfoCollection>(

View File

@@ -85,10 +85,10 @@ namespace GitHub.DistributedTask.Logging
{
// if the secret is passed to PS as a command and it causes an error, sections of it can be surrounded by color codes
// or printed individually.
// The secret secretpart1&secretpart2&secretpart3 would be split into 2 sections:
// 'secretpart1&secretpart2&' and 'secretpart3'. This method masks for the first section.
// The secret secretpart1&+secretpart2&secretpart3 would be split into 2 sections:
// 'secretpart1&+' and (no 's') 'ecretpart2&secretpart3'. This method masks for the first section.

View File

@@ -16,7 +16,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Schema
protected Definition(MappingToken definition)
{
for (var i = 0; i < definition.Count; )
for (var i = 0; i < definition.Count;)
{
var definitionKey = definition[i].Key.AssertString($"{TemplateConstants.Definition} key");
if (String.Equals(definitionKey.Value, TemplateConstants.Context, StringComparison.Ordinal))

View File

@@ -376,7 +376,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Schema
// string-definition-properties
mappingDefinition = new MappingDefinition();
mappingDefinition.Properties.Add(TemplateConstants.Constant, new PropertyValue(new StringToken(null, null, null, TemplateConstants.NonEmptyString)));
mappingDefinition.Properties.Add(TemplateConstants.IgnoreCase, new PropertyValue(new StringToken(null, null, null,TemplateConstants.Boolean)));
mappingDefinition.Properties.Add(TemplateConstants.IgnoreCase, new PropertyValue(new StringToken(null, null, null, TemplateConstants.Boolean)));
mappingDefinition.Properties.Add(TemplateConstants.RequireNonEmpty, new PropertyValue(new StringToken(null, null, null, TemplateConstants.Boolean)));
schema.Definitions.Add(TemplateConstants.StringDefinitionProperties, mappingDefinition);
@@ -490,4 +490,4 @@ namespace GitHub.DistributedTask.ObjectTemplating.Schema
private static readonly Regex s_definitionNameRegex = new Regex("^[a-zA-Z_][a-zA-Z0-9_-]*$", RegexOptions.Compiled);
private static TemplateSchema s_schema;
}
}
}

View File

@@ -271,7 +271,7 @@ namespace GitHub.DistributedTask.ObjectTemplating
List<String> nonDuplicates = new List<String>();
foreach (String key in hitCount.Keys)
{
if(hitCount[key] == 1)
if (hitCount[key] == 1)
{
nonDuplicates.Add(key);
}

View File

@@ -25,12 +25,12 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
public override TemplateToken Clone(Boolean omitSource)
{
return omitSource ? new BooleanToken(null, null, null, m_value) : new BooleanToken(FileId, Line, Column, m_value);
return omitSource ? new BooleanToken(null, null, null, m_value) : new BooleanToken(FileId, Line, Column, m_value);
}
public override String ToString()
{
return m_value ? "true" : "false";
return m_value ? "true" : "false";
}
Boolean IBoolean.GetBoolean()

View File

@@ -21,12 +21,12 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
public override TemplateToken Clone(Boolean omitSource)
{
return omitSource ? new NullToken(null, null, null) : new NullToken(FileId, Line, Column);
return omitSource ? new NullToken(null, null, null) : new NullToken(FileId, Line, Column);
}
public override String ToString()
{
return String.Empty;
return String.Empty;
}
}
}

View File

@@ -26,7 +26,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
public override TemplateToken Clone(Boolean omitSource)
{
return omitSource ? new NumberToken(null, null, null, m_value) : new NumberToken(FileId, Line, Column, m_value);
return omitSource ? new NumberToken(null, null, null, m_value) : new NumberToken(FileId, Line, Column, m_value);
}
public override String ToString()

View File

@@ -23,25 +23,25 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
public String Value
{
get
{
if (m_value == null)
{
m_value = String.Empty;
}
get
{
if (m_value == null)
{
m_value = String.Empty;
}
return m_value;
}
return m_value;
}
}
public override TemplateToken Clone(Boolean omitSource)
{
return omitSource ? new StringToken(null, null, null, m_value) : new StringToken(FileId, Line, Column, m_value);
return omitSource ? new StringToken(null, null, null, m_value) : new StringToken(FileId, Line, Column, m_value);
}
public override String ToString()
{
return m_value ?? String.Empty;
return m_value ?? String.Empty;
}
String IString.GetString()

View File

@@ -22,7 +22,7 @@ namespace GitHub.DistributedTask.Pipelines
[DataContract]
[KnownType(typeof(ContainerRegistryReference))]
[KnownType(typeof(RepositoryPathReference))]
[KnownType(typeof(ScriptReference))]
[KnownType(typeof(ScriptReference))]
[JsonConverter(typeof(ActionStepDefinitionReferenceConverter))]
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class ActionStepDefinitionReference

View File

@@ -13,8 +13,8 @@ namespace GitHub.DistributedTask.Pipelines.ContextData
}
public static PipelineContextData ToPipelineContextData(
this JToken value,
Int32 depth,
this JToken value,
Int32 depth,
Int32 maxDepth)
{
if (depth < maxDepth)

View File

@@ -11,7 +11,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
public const String BooleanStrategyContext = "boolean-strategy-context";
public const String CancelTimeoutMinutes = "cancel-timeout-minutes";
public const String Cancelled = "cancelled";
public const String Clean= "clean";
public const String Clean = "clean";
public const String Container = "container";
public const String ContinueOnError = "continue-on-error";
public const String Credentials = "credentials";

View File

@@ -569,4 +569,4 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
private readonly Parser m_parser;
private ParsingEvent m_current;
}
}
}

View File

@@ -42,7 +42,7 @@ namespace GitHub.DistributedTask.Pipelines
{
return s;
}
s = name.Expression;
if (!String.IsNullOrEmpty(s))
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
@@ -36,4 +36,4 @@ namespace GitHub.DistributedTask.Pipelines
};
}
}
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
using GitHub.Services.Common;

View File

@@ -153,8 +153,8 @@ namespace GitHub.DistributedTask.WebApi
{
this.ActionsEnvironment = actionsEnvironment;
this.ActionsStepsTelemetry = actionsStepsTelemetry;
}
}
public JobCompletedEvent(
Int64 requestId,
Guid jobId,

View File

@@ -1,4 +1,4 @@
using GitHub.Services.WebApi;
using GitHub.Services.WebApi;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Newtonsoft.Json;
namespace GitHub.DistributedTask.WebApi

View File

@@ -1,4 +1,4 @@
using GitHub.Services.WebApi;
using GitHub.Services.WebApi;
using System;
using System.Runtime.Serialization;
using System.ComponentModel;

View File

@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Runtime.Serialization;

View File

@@ -19,7 +19,7 @@ namespace GitHub.DistributedTask.WebApi
/// <param name="ownerName">The name of the owner for this session. This should typically be the agent machine</param>
/// <param name="agent">The target agent for the session</param>
public TaskAgentSession(
String ownerName,
String ownerName,
TaskAgentReference agent)
{
this.Agent = agent;

View File

@@ -1,4 +1,4 @@
using GitHub.Services.Common;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
using System;
using System.Runtime.Serialization;

View File

@@ -50,7 +50,7 @@ namespace GitHub.DistributedTask.WebApi
: base(baseUrl, pipeline, disposeHandler)
{
}
public Task AppendTimelineRecordFeedAsync(
Guid scopeIdentifier,
String planType,
@@ -91,7 +91,7 @@ namespace GitHub.DistributedTask.WebApi
userState,
cancellationToken);
}
public Task AppendTimelineRecordFeedAsync(
Guid scopeIdentifier,
String planType,

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

View File

@@ -38,7 +38,7 @@ namespace GitHub.DistributedTask.WebApi
[DataMember(EmitDefaultValue = false)]
public Guid StepId { get; set; }
[DataMember (EmitDefaultValue = false)]
[DataMember(EmitDefaultValue = false)]
public Int64? StartLine { get; private set; }
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
namespace GitHub.DistributedTask.WebApi
@@ -19,7 +19,7 @@ namespace GitHub.DistributedTask.WebApi
set;
}
[DataMember (EmitDefaultValue = false)]
[DataMember(EmitDefaultValue = false)]
public long? LineNumber
{
get;

View File

@@ -1,4 +1,4 @@
using System;
using System;
namespace GitHub.DistributedTask.WebApi
{

View File

@@ -1,4 +1,4 @@
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Runner.Worker")]
[assembly: InternalsVisibleTo("Test")]
[assembly: InternalsVisibleTo("Test")]

View File

@@ -15,7 +15,7 @@ namespace GitHub.Actions.Pipelines.WebApi
/// File Container ID
/// </summary>
[DataMember]
public long ContainerId
public long ContainerId
{
get;
set;

View File

@@ -42,5 +42,5 @@ namespace GitHub.Actions.Pipelines.WebApi
get;
set;
}
}
}
}

View File

@@ -11,4 +11,4 @@ namespace GitHub.Actions.Pipelines.WebApi
Unknown = 0,
Actions_Storage = 1
}
}
}

View File

@@ -17,7 +17,7 @@ namespace GitHub.Actions.Pipelines.WebApi
writer.WriteValue("actions_storage");
}
else
{
{
base.WriteJson(writer, enumValue, serializer);
}
}

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace GitHub.Actions.RunService.WebApi
{

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Sdk.RSWebApi.Contracts
{

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Sdk.RSWebApi.Contracts
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.DistributedTask.WebApi;

View File

@@ -1,4 +1,4 @@
using GitHub.DistributedTask.WebApi;
using GitHub.DistributedTask.WebApi;
namespace Sdk.RSWebApi.Contracts
{

View File

@@ -1,4 +1,4 @@
namespace Sdk.RSWebApi.Contracts
namespace Sdk.RSWebApi.Contracts
{
public static class RunIssueKeys
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
namespace GitHub.Actions.RunService.WebApi

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
namespace Sdk.RSWebApi.Contracts

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Threading.Tasks;

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;

View File

@@ -65,7 +65,7 @@ namespace GitHub.Services.WebApi
/// <summary>
/// Set to false if you need the item to appear in the TypeScript declare (d.ts) file for use by extensions.
/// </summary>
public bool OmitFromTypeScriptDeclareFile { get; set; }
public bool OmitFromTypeScriptDeclareFile { get; set; }
}
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;

View File

@@ -10,7 +10,7 @@ namespace GitHub.Services.WebApi
{
public const String TFSOnPremisesString = "87966EAA-CB2A-443F-BE3C-47BD3B5BF3CB";
public static readonly Guid TFSOnPremises = new Guid(TFSOnPremisesString);
}
}
/// <summary>
/// Enumeration of the options that can be passed in on Connect.

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

View File

@@ -20,7 +20,7 @@ namespace GitHub.Services.FileContainer
/// Project Id.
/// </summary>
[DataMember(IsRequired = false)]
public Guid ScopeIdentifier { get;[EditorBrowsable(EditorBrowsableState.Never)] set; }
public Guid ScopeIdentifier { get; [EditorBrowsable(EditorBrowsableState.Never)] set; }
/// <summary>
/// Uri of the artifact associated with the container.
@@ -103,10 +103,10 @@ namespace GitHub.Services.FileContainer
return false;
}
return this.ArtifactUri == other.ArtifactUri &&
return this.ArtifactUri == other.ArtifactUri &&
this.Description == other.Description &&
this.Id == other.Id &&
this.Name == other.Name &&
this.Id == other.Id &&
this.Name == other.Name &&
this.ScopeIdentifier == other.ScopeIdentifier;
}

View File

@@ -21,7 +21,7 @@ namespace GitHub.Services.FileContainer
/// Project Id.
/// </summary>
[DataMember(IsRequired = false)]
public Guid ScopeIdentifier { get;[EditorBrowsable(EditorBrowsableState.Never)] set; }
public Guid ScopeIdentifier { get; [EditorBrowsable(EditorBrowsableState.Never)] set; }
/// <summary>
/// Unique path that identifies the item.
@@ -33,7 +33,7 @@ namespace GitHub.Services.FileContainer
{
return m_path;
}
[EditorBrowsable(EditorBrowsableState.Never)]
[EditorBrowsable(EditorBrowsableState.Never)]
set
{
m_path = EnsurePathFormat(value);
@@ -127,7 +127,7 @@ namespace GitHub.Services.FileContainer
[EditorBrowsable(EditorBrowsableState.Never)]
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Ticket { get; set; }
public static string EnsurePathFormat(string path)
{
if (string.IsNullOrWhiteSpace(path))

View File

@@ -333,7 +333,7 @@ namespace GitHub.Services.Identity
string identityType = obj.IdentityType;
//until all service principals are in the system store, we treat them as Claims identities for hash code
if(obj.IsSystemServicePrincipalType())
if (obj.IsSystemServicePrincipalType())
{
identityType = IdentityConstants.ClaimsType;
}

View File

@@ -16,7 +16,7 @@ namespace GitHub.Services.Location
public AccessMapping() { }
public AccessMapping(String moniker, String displayName, String accessPoint, Guid serviceOwner = new Guid())
:this (moniker, displayName, accessPoint, serviceOwner, null)
: this(moniker, displayName, accessPoint, serviceOwner, null)
{
}

View File

@@ -361,7 +361,7 @@ namespace GitHub.Services.Location
default:
// Allow attributes such as xsi:type to fall through
break;
}
}
}
}

View File

@@ -139,10 +139,10 @@ namespace GitHub.Services.Location
/// The service which owns this definition e.g. TFS, ELS, etc.
/// </summary>
[DataMember]
public Guid ServiceOwner
{
get;
set;
public Guid ServiceOwner
{
get;
set;
}
/// <summary>
@@ -338,7 +338,7 @@ namespace GitHub.Services.Location
return null;
}
else
{
{
return MaxVersion.ToString(2);
}
}
@@ -376,7 +376,7 @@ namespace GitHub.Services.Location
return null;
}
else
{
{
return ReleasedVersion.ToString(2);
}
}
@@ -634,7 +634,7 @@ namespace GitHub.Services.Location
#region ISecuredObject
Guid ISecuredObject.NamespaceId => LocationSecurityConstants.NamespaceId;
int ISecuredObject.RequiredPermissions => LocationSecurityConstants.Read;
string ISecuredObject.GetToken()

View File

@@ -16,7 +16,7 @@ namespace GitHub.Services.WebApi.Patch
this.Operation = Operation.Add;
}
public AddPatchOperation(string path, object value): this()
public AddPatchOperation(string path, object value) : this()
{
this.Path = path;
this.Value = value;

View File

@@ -26,7 +26,7 @@ namespace GitHub.Services.WebApi.Patch
/// <summary>
/// The path to copy/move from, applies only to the Copy/Move operation.
/// </summary>
string From { get; }
string From { get; }
/// <summary>
/// The value to set with this patch operation. Only applies to

View File

@@ -16,7 +16,7 @@ namespace GitHub.Services.WebApi.Patch
this.Operation = Operation.Replace;
}
public ReplacePatchOperation(string path, object value): this()
public ReplacePatchOperation(string path, object value) : this()
{
this.Path = path;
this.Value = value;

View File

@@ -9,13 +9,13 @@ namespace GitHub.Services.WebApi.Patch
/// </summary>
/// <typeparam name="TModel">The model the patch operation applies to.</typeparam>
public class TestPatchOperation<TModel> : PatchOperation<TModel>
{
{
public TestPatchOperation()
{
this.Operation = Operation.Test;
}
public TestPatchOperation(string path, object value): this()
public TestPatchOperation(string path, object value) : this()
{
this.Path = path;
this.Value = value;

View File

@@ -78,7 +78,7 @@ namespace GitHub.Services.Profile
return false;
}
return CompareTo((AttributeDescriptor) obj) == 0;
return CompareTo((AttributeDescriptor)obj) == 0;
}
public override int GetHashCode()
@@ -93,7 +93,7 @@ namespace GitHub.Services.Profile
public override string ToString()
{
return string.Concat(ContainerName,";",AttributeName);
return string.Concat(ContainerName, ";", AttributeName);
}
}

View File

@@ -26,7 +26,8 @@ namespace GitHub.Services.Profile
/// The name of the container.
/// </summary>
[DataMember(IsRequired = true, EmitDefaultValue = false)]
public string ContainerName {
public string ContainerName
{
get
{
return m_containerName;

View File

@@ -173,7 +173,7 @@ namespace GitHub.Services.Profile
Profile newProfile = MemberwiseClone() as Profile;
// Since core attributes are cloned on read, we can get away with a shallow copy
newProfile.CoreAttributes = CoreAttributes != null ? CoreAttributes.ToDictionary(x => x.Key, x => (CoreProfileAttribute) x.Value.Clone()) : null;
newProfile.CoreAttributes = CoreAttributes != null ? CoreAttributes.ToDictionary(x => x.Key, x => (CoreProfileAttribute)x.Value.Clone()) : null;
newProfile.ApplicationContainer = ApplicationContainer != null ? (AttributesContainer)ApplicationContainer.Clone() : null;
return newProfile;

View File

@@ -6,11 +6,11 @@ namespace GitHub.Services.Profile
[Flags]
public enum CoreProfileAttributes
{
Minimal = 0x0000, // Does not contain email, avatar, display name, or marketing preferences
Email = 0x0001,
Avatar = 0x0002,
DisplayName = 0x0004,
Minimal = 0x0000, // Does not contain email, avatar, display name, or marketing preferences
Email = 0x0001,
Avatar = 0x0002,
DisplayName = 0x0004,
ContactWithOffers = 0x0008,
All = 0xFFFF,
All = 0xFFFF,
}
}

View File

@@ -25,7 +25,7 @@ namespace GitHub.Services.WebApi
//and come back as that from the service. There is a special TryGetValue that can be used to try to convert the type
//from string back to the type it is supposed to be.
/// <summary>
/// The class represents a property bag as a collection of key-value pairs. Values of all primitive types (any type with a `TypeCode != TypeCode.Object`)
/// except for `DBNull` are accepted. Values of type Byte[], Int32, Double, DateType and String preserve their type,

View File

@@ -139,7 +139,7 @@ namespace GitHub.Services.WebApi
}
}
}
XmlSchema IXmlSerializable.GetSchema()
{
return null;

View File

@@ -194,7 +194,7 @@ namespace GitHub.Services.FileContainer
base(message, ex)
{
}
}
}
[Serializable]
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
@@ -215,7 +215,7 @@ namespace GitHub.Services.FileContainer
base(message, ex)
{
}
}
}
[Serializable]
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
@@ -231,7 +231,7 @@ namespace GitHub.Services.FileContainer
base(message, ex)
{
}
}
}
[Serializable]
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
@@ -252,7 +252,7 @@ namespace GitHub.Services.FileContainer
base(message, ex)
{
}
}
}
[Serializable]
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]

View File

@@ -57,7 +57,7 @@ namespace GitHub.Services.WebApi
[Serializable]
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
[ExceptionMapping("0.0", "3.0", "VssApiResourceDuplicateIdException", "GitHub.Services.WebApi.VssApiResourceDuplicateIdException, GitHub.Services.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class VssApiResourceDuplicateIdException: VssApiRouteRegistrationException
public class VssApiResourceDuplicateIdException : VssApiRouteRegistrationException
{
public VssApiResourceDuplicateIdException(Guid locationId)
: base(WebApiResources.ApiResourceDuplicateIdMessage(locationId))

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
namespace GitHub.Services

View File

@@ -97,7 +97,7 @@ namespace GitHub.Services.FileContainer.Client
{
throw new ArgumentException(WebApiResources.ContainerIdMustBeGreaterThanZero(), "containerId");
}
List<KeyValuePair<String, String>> query = AppendItemQueryString(itemPath, scopeIdentifier, includeDownloadTickets, isShallow);
return SendAsync<List<FileContainerItem>>(HttpMethod.Get, FileContainerResourceIds.FileContainer, routeValues: new { containerId = containerId }, version: s_currentApiVersion, queryParameters: query, userState: userState, cancellationToken: cancellationToken);
}
@@ -445,7 +445,7 @@ namespace GitHub.Services.FileContainer.Client
int statusCode = (int)response?.StatusCode;
return statusCode >= 400 && statusCode <= 499;
}
protected override bool ShouldThrowError(HttpResponseMessage response)
{
return !response.IsSuccessStatusCode && !IsFastFailResponse(response);

View File

@@ -65,7 +65,7 @@ namespace GitHub.Services.WebApi
}
public static String ToString(
Object toSerialize,
Object toSerialize,
Boolean indent)
{
if (toSerialize == null)
@@ -144,9 +144,9 @@ namespace GitHub.Services.WebApi
{
// no map funcs, just clones
mapFuncs = mapFuncs ?? new Dictionary<JTokenType, Func<JToken, JToken>>();
Func<JToken, JToken> mapperFunc;
// process token
switch (token.Type)
{
@@ -189,7 +189,7 @@ namespace GitHub.Services.WebApi
}
return copy;
case JTokenType.String:
if (mapFuncs.TryGetValue(JTokenType.String, out mapperFunc))
{
@@ -197,7 +197,7 @@ namespace GitHub.Services.WebApi
}
return token;
case JTokenType.Boolean:
case JTokenType.Null:
case JTokenType.Guid:

View File

@@ -321,7 +321,7 @@ namespace GitHub.Services.WebApi.Jwt
this._header = JsonWebTokenUtilities.JsonDecode<JWTHeader>(fields[0]);
this._payload = JsonWebTokenUtilities.JsonDecode<JWTPayload>(fields[1]);
if(!string.IsNullOrEmpty(fields[2]))
if (!string.IsNullOrEmpty(fields[2]))
{
this._signature = fields[2].FromBase64StringNoPadding();
}
@@ -340,7 +340,7 @@ namespace GitHub.Services.WebApi.Jwt
protected T TryGetValueOrDefault<T>(string key)
{
object ret;
if(TryGetValue(key, out ret))
if (TryGetValue(key, out ret))
{
//we have to special case DateTime
if (typeof(T) == typeof(DateTime))
@@ -359,7 +359,7 @@ namespace GitHub.Services.WebApi.Jwt
protected System.DateTime ConvertDateTime(object obj)
{
if(obj is DateTime)
if (obj is DateTime)
{
return (DateTime)obj;
}
@@ -426,7 +426,7 @@ namespace GitHub.Services.WebApi.Jwt
}
set
{
if(string.IsNullOrEmpty(value))
if (string.IsNullOrEmpty(value))
{
this.Remove(JsonWebTokenHeaderParameters.X509CertificateThumbprint);
}

View File

@@ -85,8 +85,8 @@ namespace GitHub.Services.WebApi.Jwt
public string IdentityNameClaimType
{
get;
set;
get;
set;
}
}
}

View File

@@ -9,7 +9,7 @@ namespace GitHub.Services.WebApi.Jwt
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
long unixVal = reader.Value is string ? long.Parse((string) reader.Value) : (long)reader.Value;
long unixVal = reader.Value is string ? long.Parse((string)reader.Value) : (long)reader.Value;
return unixVal.FromUnixEpochTime();
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

View File

@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System;
using System.Linq;

View File

@@ -253,7 +253,7 @@ namespace GitHub.Services.WebApi.Location
/// </returns>
String LocationForCurrentConnection(
String serviceType,
Guid serviceIdentifier);
Guid serviceIdentifier);
/// <summary>
/// Returns the location for the ServiceDefintion that should be used based on
@@ -276,7 +276,7 @@ namespace GitHub.Services.WebApi.Location
/// used based on the current connection.
/// </returns>
String LocationForCurrentConnection(
ServiceDefinition serviceDefinition);
ServiceDefinition serviceDefinition);
/// <summary>
/// Returns the location for the ServiceDefinition that has the specified
@@ -299,7 +299,7 @@ namespace GitHub.Services.WebApi.Location
String LocationForAccessMapping(
String serviceType,
Guid serviceIdentifier,
AccessMapping accessMapping);
AccessMapping accessMapping);
/// <summary>
/// Returns the location for the ServiceDefinition for the provided
@@ -374,7 +374,7 @@ namespace GitHub.Services.WebApi.Location
/// The AccessMapping with the supplied moniker or null if one does not exist.
/// </returns>
AccessMapping GetAccessMapping(
String moniker);
String moniker);
// <summary>
// Removes an AccessMapping and all of the locations that are mapped

View File

@@ -25,7 +25,7 @@ namespace GitHub.Services.WebApi.Location
public LocationCacheManager(Guid serverGuid, Guid serviceOwner, Uri connectionBaseUrl)
{
m_cacheAvailable = (serverGuid.Equals(Guid.Empty)) ? false : true;
m_lastChangeId = -1;
m_cacheExpirationDate = DateTime.MinValue;
@@ -387,7 +387,7 @@ namespace GitHub.Services.WebApi.Location
{
String absoluteUriTrimmed = accessMapping.AccessPoint.TrimEnd('/');
String relativeDirectoryTrimmed = WebApplicationRelativeDirectory.TrimEnd('/');
if (VssStringComparer.ServerUrl.EndsWith(absoluteUriTrimmed, relativeDirectoryTrimmed))
{
accessMapping.AccessPoint = absoluteUriTrimmed.Substring(0, absoluteUriTrimmed.Length - relativeDirectoryTrimmed.Length);
@@ -437,7 +437,7 @@ namespace GitHub.Services.WebApi.Location
finally
{
Debug.Assert(m_lastChangeId == -1 || m_services.Count > 0);
m_accessLock.ExitWriteLock();
}
}

View File

@@ -103,7 +103,7 @@ namespace GitHub.Services.WebApi.Location
{
providerLookup = actualProvider;
}
}
}
if (!providerLookup.TryGetValue(locationAreaIdentifier, out locationData))
{

View File

@@ -93,7 +93,7 @@ namespace GitHub.Services.WebApi.Location
XmlNode parentServiceTypeNode = definitionNode.SelectSingleNode("./" + s_parentServiceType);
definition.ParentServiceType = (parentServiceTypeNode != null) ? parentServiceTypeNode.InnerText : null;
XmlNode parentIdentifierNode = definitionNode.SelectSingleNode("./" + s_parentIdentifier);
definition.ParentIdentifier = (parentIdentifierNode != null) ? XmlConvert.ToGuid(parentIdentifierNode.InnerText) : Guid.Empty;

Some files were not shown because too many files have changed in this diff Show More