Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

[Generator(LanguageNames.CSharp)]
public sealed class ConfigGenerator : IIncrementalGenerator
Expand Down Expand Up @@ -103,8 +103,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
if (symbol == null) return null;

var compilation = ctx.SemanticModel.Compilation;
var attrDefItem = compilation.GetTypeByMetadataName("PCL.Core.App.Configuration.ConfigItemAttribute`1");
var attrDefAny = compilation.GetTypeByMetadataName("PCL.Core.App.Configuration.AnyConfigItemAttribute`1");
var attrDefItem = compilation.GetTypeByMetadataName("PCL.CE.Core.App.Configuration.ConfigItemAttribute`1");
var attrDefAny = compilation.GetTypeByMetadataName("PCL.CE.Core.App.Configuration.AnyConfigItemAttribute`1");
if (attrDefItem == null && attrDefAny == null) return null;

AttributeData? picked = null;
Expand Down Expand Up @@ -183,7 +183,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
if (symbol == null) return null;

var compilation = ctx.SemanticModel.Compilation;
var attrDef = compilation.GetTypeByMetadataName("PCL.Core.App.Configuration.ConfigGroupAttribute");
var attrDef = compilation.GetTypeByMetadataName("PCL.CE.Core.App.Configuration.ConfigGroupAttribute");
if (attrDef == null) return null;

var attr = symbol.GetAttributes().FirstOrDefault(a =>
Expand Down Expand Up @@ -225,7 +225,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)

// 精确匹配 [RegisterConfigEvent]
var compilation = ctx.SemanticModel.Compilation;
var attrDef = compilation.GetTypeByMetadataName("PCL.Core.App.Configuration.RegisterConfigEventAttribute");
var attrDef = compilation.GetTypeByMetadataName("PCL.CE.Core.App.Configuration.RegisterConfigEventAttribute");
if (attrDef is null) return null;
var hasAttr = symbol.GetAttributes().Any(a =>
a.AttributeClass is not null &&
Expand All @@ -249,7 +249,7 @@ a.AttributeClass is not null &&

// 绕过 [ConfigGroup]
var compilation = ctx.SemanticModel.Compilation;
var attrDef = compilation.GetTypeByMetadataName("PCL.Core.App.Configuration.ConfigGroupAttribute");
var attrDef = compilation.GetTypeByMetadataName("PCL.CE.Core.App.Configuration.ConfigGroupAttribute");
if (attrDef is not null)
{
var hasAttr = symbol.GetAttributes().Any(a =>
Expand Down Expand Up @@ -350,7 +350,7 @@ private static string _GenerateAdditionalSource(ConfigTree tree)
sb.AppendLine();
sb.AppendLine("using System.Collections.Generic;");
sb.AppendLine("using System.Linq;");
sb.AppendLine("using PCL.Core.App.Configuration;");
sb.AppendLine("using PCL.CE.Core.App.Configuration;");
sb.AppendLine();
sb.AppendLine("#nullable enable");
sb.AppendLine();
Expand Down Expand Up @@ -409,7 +409,7 @@ string ResolveSource(ItemModel item) =>
sb.AppendLine("// <auto-generated />");
sb.AppendLine("// 此文件由 Source Generator 自动生成,请勿手动修改");
sb.AppendLine();
sb.AppendLine("namespace PCL.Core.App.Configuration;");
sb.AppendLine("namespace PCL.CE.Core.App.Configuration;");
sb.AppendLine();
sb.AppendLine("public sealed partial class ConfigService");
sb.AppendLine("{");
Expand Down Expand Up @@ -686,7 +686,7 @@ private static void _EmitGroupInto(
public static string _RenderSourceCode(SemanticModel sm, ExpressionSyntax expr)
{
var sym = sm.GetSymbolInfo(expr).Symbol;
if (sym is IFieldSymbol fs && fs.ContainingType?.ToDisplayString() == "PCL.Core.App.Configuration.ConfigSource")
if (sym is IFieldSymbol fs && fs.ContainingType?.ToDisplayString() == "PCL.CE.Core.App.Configuration.ConfigSource")
{
return "ConfigSource." + fs.Name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

public readonly record struct CollectorInfo(
INamedTypeSymbol CollectorAttrSymbol,
Expand Down Expand Up @@ -184,7 +184,7 @@ private static void _GenerateDependencyGroup(SourceProductionContext spc, Immuta
sb.AppendLine("using System.Collections.Generic;");
sb.AppendLine("using System.Collections.Immutable;");
sb.AppendLine();
sb.AppendLine("namespace PCL.Core.App.IoC;");
sb.AppendLine("namespace PCL.CE.Core.App.IoC;");
sb.AppendLine();
sb.AppendLine("#nullable enable");
sb.AppendLine();
Expand Down Expand Up @@ -301,7 +301,7 @@ private static void _GenerateDependencyInjectionMethods(SourceProductionContext
var targetMethodName = targetMethod.Name;
var isStatic = targetMethod.IsStatic;
var isAwaitable = targetMethod.IsAwaitable();
sb.Append(indentStr).AppendLine("[global::System.CodeDom.Compiler.GeneratedCode(\"PCL.Core.SourceGenerators.DependencyCollectorGenerator\", \"1.0.0.0\")]");
sb.Append(indentStr).AppendLine("[global::System.CodeDom.Compiler.GeneratedCode(\"PCL.CE.SourceGenerators.DependencyCollectorGenerator\", \"1.0.0.0\")]");
sb.Append(indentStr).AppendLine("[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]");
var idCode = match.Info.Identifier.SnakeIdToPascal();
sb.Append(indentStr).Append("private ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;

namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

[Generator(LanguageNames.CSharp)]
public class EnvironmentInteropGenerator : IIncrementalGenerator
Expand Down Expand Up @@ -46,7 +46,7 @@ private static void _Execute(SourceProductionContext context, IEnumerable<(strin
sb.AppendLine();
sb.AppendLine("#nullable enable");
sb.AppendLine();
sb.AppendLine("namespace PCL.Core.Utils.OS;");
sb.AppendLine("namespace PCL.CE.Core.Utils.OS;");
sb.AppendLine();
sb.AppendLine("partial class EnvironmentInterop");
sb.AppendLine("{");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

[Generator(LanguageNames.CSharp)]
public class LifecycleScopeGenerator : IIncrementalGenerator
Expand Down Expand Up @@ -129,7 +129,7 @@ private static void _CollectSources(SourceProductionContext spc, ImmutableArray<
var paraArray = method.Parameters;
var skip = 0;
var hasCommandModelArg = paraArray.Length > 0
&& paraArray[0].Type.GetSimplifiedTypeName() == "PCL.Core.App.Cli.CommandLine";
&& paraArray[0].Type.GetSimplifiedTypeName() == "PCL.CE.Core.App.Cli.CommandLine";
if (hasCommandModelArg) skip++;
var hasIsCallbackArgIndex = hasCommandModelArg ? 1 : 0;
var hasIsCallbackArg = paraArray.Length > hasIsCallbackArgIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

[Generator(LanguageNames.CSharp)]
public class LifecycleServiceTypesGenerator : IIncrementalGenerator
Expand Down Expand Up @@ -208,7 +208,7 @@ private static void _Execute(SourceProductionContext context, List<string> valid
sb.AppendLine();
sb.AppendLine("using System;");
sb.AppendLine();
sb.AppendLine("namespace PCL.Core.App.IoC;");
sb.AppendLine("namespace PCL.CE.Core.App.IoC;");
sb.AppendLine();
sb.AppendLine("/// <summary>");
sb.AppendLine("/// 包含所有使用 LifecycleService 注解的类型,按 StartState 分类并按 Priority 降序排序");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

public static class SharedConstants
{
public const string AppNamespace = "PCL.Core.App";
public const string AppNamespace = "PCL.CE.Core.App";
public const string IocNamespace = $"{AppNamespace}.IoC";
public const string DependencyCollectorAttribute = $"{IocNamespace}.DependencyCollectorAttribute";
public const string DependencyInjectionPointAttribute = $"{IocNamespace}.DependencyInjectionPointAttribute";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace PCL.Core.SourceGenerators;
namespace PCL.CE.SourceGenerators;

public static class SharedExtensions
{
Expand Down Expand Up @@ -226,11 +226,11 @@ public static bool IsAwaitable(this IMethodSymbol method)

public static string CorrectConfigTypeName(this string typeName, out string? fullTypeName)
{
var isArgConfig = typeName.StartsWith("PCL.Core.App.Configuration.ArgConfig<");
var isArgConfig = typeName.StartsWith("PCL.CE.Core.App.Configuration.ArgConfig<");
if (isArgConfig)
{
fullTypeName = typeName;
typeName = typeName.Substring(37, typeName.Length - 38);
typeName = typeName.Substring(40, typeName.Length - 41);
}
else fullTypeName = null;
return typeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Text.Json;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.App.Cli;
using PCL.CE.Core.App.Cli;

namespace PCL.Core.Test.App;
namespace PCL.CE.Test.App;

[TestClass]
public sealed class CommandLineTest
Expand Down
4 changes: 2 additions & 2 deletions PCL.Core.Test/BaseXTest.cs → PCL.CE.Test/BaseXTest.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Utils.Exts;
using PCL.CE.Core.Utils.Exts;

namespace PCL.Core.Test;
namespace PCL.CE.Test;

[TestClass]
public class BaseXTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.UI.Effects;
using PCL.CE.Core.UI.Effects;

namespace PCL.Core.Test;
namespace PCL.CE.Test;

[TestClass]
public class BlurTest
Expand Down Expand Up @@ -288,7 +288,7 @@ public static class PerformanceTestExamples
/// </summary>
public static void RunAllTests()
{
Console.WriteLine("PCL.Core BlurEffect 性能优化测试套件\n");
Console.WriteLine("PCL.CE.Core BlurEffect 性能优化测试套件\n");

// 快速对比测试
BlurPerformanceTest.QuickPerformanceComparison();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.IO;
using PCL.CE.Core.IO;

namespace PCL.Core.Test;
namespace PCL.CE.Test;

[TestClass]
public class ByteHelperTest
Expand Down
4 changes: 2 additions & 2 deletions PCL.Core.Test/DiffTest.cs → PCL.CE.Test/DiffTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Utils.Diff;
using PCL.CE.Core.Utils.Diff;

namespace PCL.Core.Test;
namespace PCL.CE.Test;

[TestClass]
public class DiffTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Dynamic;
using System.Text.Json;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Utils;
using PCL.CE.Core.Utils;

namespace PCL.Core.Test
namespace PCL.CE.Test
{
[TestClass]
public class DynamicJsonTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Utils.Codecs;
using PCL.CE.Core.Utils.Codecs;

namespace PCL.Core.Test;
namespace PCL.CE.Test;
[TestClass]
public class EncodingDetectorTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Security.Cryptography;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PCL.Core.Test.Encryption;
namespace PCL.CE.Test.Encryption;

[TestClass]
public class AesGcmTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Security.Cryptography;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PCL.Core.Test.Encryption;
namespace PCL.CE.Test.Encryption;

[TestClass]
public class ChaCha20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Security.Cryptography;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PCL.Core.Test.Encryption;
namespace PCL.CE.Test.Encryption;

[TestClass]
public class ChaCha20Poly1305
Expand Down
8 changes: 4 additions & 4 deletions PCL.Core.Test/JavaTest.cs → PCL.CE.Test/JavaTest.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Minecraft;
using PCL.Core.Minecraft.Java.Parser;
using PCL.Core.Minecraft.Java.Scanner;
using PCL.CE.Core.Minecraft;
using PCL.CE.Core.Minecraft.Java.Parser;
using PCL.CE.Core.Minecraft.Java.Scanner;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace PCL.Core.Test
namespace PCL.CE.Test
{
[TestClass]
public class JavaTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Link.Scaffolding;
using PCL.CE.Core.Link.Scaffolding;
using System;

namespace PCL.Core.Test;
namespace PCL.CE.Test;

[TestClass]
public class LobbyCodeGenerateTest
Expand Down
4 changes: 2 additions & 2 deletions PCL.Core.Test/LoggerTest.cs → PCL.CE.Test/LoggerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PCL.Core.Logging;
using PCL.CE.Core.Logging;

namespace PCL.Core.Test;
namespace PCL.CE.Test;

[TestClass]
public class LoggerTest
Expand Down
Loading