Remove file-scoped namespaces to fix CI issues

Also fix a non matching filename
This commit is contained in:
Sergio Pedri 2022-05-11 13:52:51 +02:00
Родитель ac3587556a
Коммит ba85e32275
7 изменённых файлов: 93 добавлений и 87 удалений

Просмотреть файл

@ -6,51 +6,52 @@ using System;
#nullable enable
namespace Microsoft.Toolkit.Uwp.Notifications;
/// <summary>
/// A helper class that can be used to format <see cref="Enum"/> values.
/// </summary>
internal static class EnumFormatter
namespace Microsoft.Toolkit.Uwp.Notifications
{
/// <summary>
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
/// A helper class that can be used to format <see cref="Enum"/> values.
/// </summary>
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
public static string? ToPascalCaseString<T>(this T? value)
where T : unmanaged, Enum
internal static class EnumFormatter
{
if (value is null)
/// <summary>
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
/// </summary>
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
public static string? ToPascalCaseString<T>(this T? value)
where T : unmanaged, Enum
{
return null;
if (value is null)
{
return null;
}
return ToPascalCaseString(value.Value);
}
return ToPascalCaseString(value.Value);
}
/// <summary>
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
/// </summary>
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
public static string? ToPascalCaseString<T>(this T value)
where T : unmanaged, Enum
{
string? text = value.ToString();
if (text is null or { Length: 0 })
/// <summary>
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
/// </summary>
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
public static string? ToPascalCaseString<T>(this T value)
where T : unmanaged, Enum
{
return text;
}
string? text = value.ToString();
if (text is { Length: 1 })
{
return text.ToLowerInvariant();
}
if (text is null or { Length: 0 })
{
return text;
}
return $"{char.ToLowerInvariant(text[0])}{text.Substring(1)}";
if (text is { Length: 1 })
{
return text.ToLowerInvariant();
}
return $"{char.ToLowerInvariant(text[0])}{text.Substring(1)}";
}
}
}

Просмотреть файл

@ -6,15 +6,16 @@ using System.Collections.Generic;
#nullable enable
namespace Microsoft.Toolkit.Uwp.Notifications;
/// <summary>
/// An interface for a notification XML element with additional properties.
/// </summary>
internal interface IHaveXmlAdditionalProperties
namespace Microsoft.Toolkit.Uwp.Notifications
{
/// <summary>
/// Gets the mapping of additional properties.
/// An interface for a notification XML element with additional properties.
/// </summary>
IReadOnlyDictionary<string, string> AdditionalProperties { get; }
}
internal interface IHaveXmlAdditionalProperties
{
/// <summary>
/// Gets the mapping of additional properties.
/// </summary>
IReadOnlyDictionary<string, string> AdditionalProperties { get; }
}
}

Просмотреть файл

@ -6,15 +6,16 @@ using System.Collections.Generic;
#nullable enable
namespace Microsoft.Toolkit.Uwp.Notifications;
/// <summary>
/// An interface for a notification XML element with additional children.
/// </summary>
internal interface IHaveXmlChildren
namespace Microsoft.Toolkit.Uwp.Notifications
{
/// <summary>
/// Gets the children of the current element.
/// An interface for a notification XML element with additional children.
/// </summary>
IEnumerable<object> Children { get; }
internal interface IHaveXmlChildren
{
/// <summary>
/// Gets the children of the current element.
/// </summary>
IEnumerable<object> Children { get; }
}
}

Просмотреть файл

@ -1,16 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.Toolkit.Uwp.Notifications;
/// <summary>
/// An interface for a notification XML element with an explicit XML text content.
/// </summary>
internal interface IHaveXmlText
{
/// <summary>
/// Gets the text content of the current element.
/// </summary>
string Text { get; }
}

Просмотреть файл

@ -2,15 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.Toolkit.Uwp.Notifications;
/// <summary>
/// An interface for a notification XML element with a name.
/// </summary>
internal interface IHaveXmlName
namespace Microsoft.Toolkit.Uwp.Notifications
{
/// <summary>
/// Gets the name of the current element.
/// An interface for a notification XML element with a name.
/// </summary>
string Name { get; }
internal interface IHaveXmlName
{
/// <summary>
/// Gets the name of the current element.
/// </summary>
string Name { get; }
}
}

Просмотреть файл

@ -6,17 +6,18 @@ using System.Collections.Generic;
#nullable enable
namespace Microsoft.Toolkit.Uwp.Notifications;
/// <summary>
/// An interface for a notification XML element with named properties.
/// </summary>
internal interface IHaveXmlNamedProperties
namespace Microsoft.Toolkit.Uwp.Notifications
{
/// <summary>
/// Enumerates the available named properties for the element.
/// An interface for a notification XML element with named properties.
/// </summary>
/// <returns>A sequence of named properties for the element.</returns>
/// <remarks>The returned values must be valid XML values when <see cref="object.ToString"/> is called on them.</remarks>
IEnumerable<KeyValuePair<string, object?>> EnumerateNamedProperties();
internal interface IHaveXmlNamedProperties
{
/// <summary>
/// Enumerates the available named properties for the element.
/// </summary>
/// <returns>A sequence of named properties for the element.</returns>
/// <remarks>The returned values must be valid XML values when <see cref="object.ToString"/> is called on them.</remarks>
IEnumerable<KeyValuePair<string, object?>> EnumerateNamedProperties();
}
}

Просмотреть файл

@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.Toolkit.Uwp.Notifications
{
/// <summary>
/// An interface for a notification XML element with an explicit XML text content.
/// </summary>
internal interface IHaveXmlText
{
/// <summary>
/// Gets the text content of the current element.
/// </summary>
string Text { get; }
}
}