Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# If there are abnormal line endings in any file, run "git add --renormalize <file_name>",
# review the changes, and commit them to fix the line endings.
* text=auto
452 changes: 226 additions & 226 deletions NOTICE

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ConfigurationClient CreateClient(string endpoint)
string connectionString = _connectionStrings.FirstOrDefault(cs => ConnectionStringUtils.Parse(cs, ConnectionStringUtils.EndpointSection) == endpoint);

//
// falback to the first connection string
// fallback to the first connection string
if (connectionString == null)
{
string id = ConnectionStringUtils.Parse(_connectionStrings.First(), ConnectionStringUtils.IdSection);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
using DnsClient.Protocol;
using System;
using DnsClient.Protocol;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Extensions
{
internal static class ListExtensions
{
public static List<T> Shuffle<T>(this List<T> values)
{
var rdm = new Random();
int count = values.Count;
for (int i = count - 1; i > 0; i--)
{
int swapIndex = rdm.Next(i + 1);
if (swapIndex != i)
{
T value = values[swapIndex];
values[swapIndex] = values[i];
values[i] = value;
}
}
return values;
}
public static List<SrvRecord> SortSrvRecords(this List<SrvRecord> srvRecords)
{
srvRecords.Sort((a, b) =>
{
if (a.Priority != b.Priority)
return a.Priority.CompareTo(b.Priority);
if (a.Weight != b.Weight)
return b.Weight.CompareTo(a.Weight);
return 0;
});
return srvRecords;
}
public static List<T> Shuffle<T>(this List<T> values)
{
var rdm = new Random();
int count = values.Count;

for (int i = count - 1; i > 0; i--)
{
int swapIndex = rdm.Next(i + 1);

if (swapIndex != i)
{
T value = values[swapIndex];
values[swapIndex] = values[i];
values[i] = value;
}
}

return values;
}

public static List<SrvRecord> SortSrvRecords(this List<SrvRecord> srvRecords)
{
srvRecords.Sort((a, b) =>
{
if (a.Priority != b.Priority)
return a.Priority.CompareTo(b.Priority);

if (a.Weight != b.Weight)
return b.Weight.CompareTo(a.Weight);

return 0;
});

return srvRecords;
}

public static void AppendUnique<T>(this List<T> items, T item)
{
if (item == null)
{
throw new ArgumentNullException(nameof(item));
if (item == null)
{
throw new ArgumentNullException(nameof(item));
}

T existingItem = items.FirstOrDefault(s => Equals(s, item));
Expand All @@ -63,6 +63,6 @@ public static void AppendUnique<T>(this List<T> items, T item)

// Append to the end, keeping precedence.
items.Add(item);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
using System;
using System.IO;
using System.Linq;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public static string BuildFeatureFlagsUnchangedMessage(string endpoint)
}

public static string BuildFeatureFlagsUpdatedMessage()
{
{
return LoggingConstants.RefreshFeatureFlagsUpdated;
}

public static string BuildSelectedKeyValueCollectionsUnchangedMessage(string endpoint)
{
return $"{LoggingConstants.RefreshSelectedKeyValueCollectionsUnchanged} Endpoint:'{endpoint?.TrimEnd('/')}'";
public static string BuildSelectedKeyValueCollectionsUnchangedMessage(string endpoint)
{
return $"{LoggingConstants.RefreshSelectedKeyValueCollectionsUnchanged} Endpoint:'{endpoint?.TrimEnd('/')}'";
}

public static string BuildSelectedKeyValuesAndFeatureFlagsUpdatedMessage()
Expand Down Expand Up @@ -91,12 +91,12 @@ public static string BuildLastEndpointFailedMessage(string endpoint)
}

public static string BuildFallbackClientLookupFailMessage(string exceptionMessage)
{
{
return $"{LoggingConstants.FallbackClientLookupError}\n{exceptionMessage}";
}
public static string BuildRefreshFailedDueToFormattingErrorMessage(string exceptionMessage)
{
return $"{LoggingConstants.RefreshFailedDueToFormattingError}\n{exceptionMessage}";
}
public static string BuildRefreshFailedDueToFormattingErrorMessage(string exceptionMessage)
{
return $"{LoggingConstants.RefreshFailedDueToFormattingError}\n{exceptionMessage}";
}
}
}