move localization annotations

This commit is contained in:
Lightczx
2023-11-20 17:25:03 +08:00
parent 07b3e98ac0
commit 1f412b289a
5 changed files with 18 additions and 42 deletions

View File

@@ -145,5 +145,23 @@ internal sealed class AttributeGenerator : IIncrementalGenerator
}
""";
context.AddSource("Snap.Hutao.Core.DependencyInjection.Annotation.Attributes.g.cs", coreDependencyInjectionAnnotations);
string resourceLocalization = """
namespace Snap.Hutao.Resource.Localization;
[AttributeUsage(AttributeTargets.Enum)]
internal sealed class LocalizationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Field)]
internal sealed class LocalizationKeyAttribute : Attribute
{
public LocalizationKeyAttribute(string key)
{
}
}
""";
context.AddSource("Snap.Hutao.Resource.Localization.Attributes.g.cs", resourceLocalization);
}
}

View File

@@ -4,7 +4,6 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.Xaml.Interactivity;
using Snap.Hutao.Core;
namespace Snap.Hutao.Control.Behavior;

View File

@@ -17,9 +17,6 @@ namespace Snap.Hutao.Control;
[SuppressMessage("", "CA1001")]
internal class ScopedPage : Page
{
// Allow GC to Collect the IServiceScope
private static readonly WeakReference<IServiceScope> PreviousScopeReference = new(default!);
private readonly RoutedEventHandler unloadEventHandler;
private readonly CancellationTokenSource viewCancellationTokenSource = new();
private readonly IServiceScope currentScope;

View File

@@ -1,12 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
namespace Snap.Hutao.Resource.Localization;
/// <summary>
/// 指示此枚举支持本地化
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
internal sealed class LocalizationAttribute : Attribute
{
}

View File

@@ -1,26 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
namespace Snap.Hutao.Resource.Localization;
/// <summary>
/// 本地化键
/// </summary>
[HighQuality]
[AttributeUsage(AttributeTargets.Field)]
internal sealed class LocalizationKeyAttribute : Attribute
{
/// <summary>
/// 指定本地化键
/// </summary>
/// <param name="key">键</param>
public LocalizationKeyAttribute(string key)
{
Key = key;
}
/// <summary>
/// 键
/// </summary>
public string Key { get; }
}