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);
}
}