mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
TEngine 6
This commit is contained in:
13
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/.gitignore
generated
vendored
Normal file
13
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/.idea.SourceGenerator.iml
|
||||
/contentModel.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
1
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/.name
generated
Normal file
1
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
SourceGenerator
|
253
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/CopilotChatHistory.xml
generated
Normal file
253
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/CopilotChatHistory.xml
generated
Normal file
File diff suppressed because one or more lines are too long
4
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/encodings.xml
generated
Normal file
4
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
8
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/indexLayout.xml
generated
Normal file
8
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
6
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/vcs.xml
generated
Normal file
6
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@@ -0,0 +1,568 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.CodeAnalysis.Diagnostics;
|
||||
using Microsoft.CodeAnalysis.FlowAnalysis;
|
||||
using Exception = System.Exception;
|
||||
|
||||
namespace Analyzer
|
||||
{
|
||||
public static class AnalyzerHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取语法树节点的子节点中第一个指定类型节点
|
||||
/// </summary>
|
||||
/// <param name="syntaxNode">语法树节点</param>
|
||||
/// <typeparam name="T">指定语法节点类型</typeparam>
|
||||
/// <returns>第一个指定类型节点</returns>
|
||||
public static T? GetFirstChild<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||
{
|
||||
foreach (SyntaxNode? childNode in syntaxNode.ChildNodes())
|
||||
{
|
||||
if (childNode.GetType() == typeof(T))
|
||||
{
|
||||
return childNode as T;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SyntaxNode? GetFirstChild(this SyntaxNode syntaxNode)
|
||||
{
|
||||
var childNodes = syntaxNode.ChildNodes();
|
||||
if (childNodes.Count() > 0)
|
||||
{
|
||||
return childNodes.First();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取语法树节点的子节点中最后一个指定类型节点
|
||||
/// </summary>
|
||||
/// <param name="syntaxNode">语法树节点</param>
|
||||
/// <typeparam name="T">指定语法节点类型</typeparam>
|
||||
/// <returns>最后一个指定类型节点</returns>
|
||||
public static T? GetLastChild<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||
{
|
||||
foreach (SyntaxNode? childNode in syntaxNode.ChildNodes().Reverse())
|
||||
{
|
||||
if (childNode.GetType() == typeof(T))
|
||||
{
|
||||
return childNode as T;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取语法节点所属的ClassDeclarationSyntax
|
||||
/// </summary>
|
||||
public static ClassDeclarationSyntax? GetParentClassDeclaration(this SyntaxNode syntaxNode)
|
||||
{
|
||||
SyntaxNode? parentNode = syntaxNode.Parent;
|
||||
while (parentNode != null)
|
||||
{
|
||||
if (parentNode is ClassDeclarationSyntax classDeclarationSyntax)
|
||||
{
|
||||
return classDeclarationSyntax;
|
||||
}
|
||||
|
||||
parentNode = parentNode.Parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// INamedTypeSymbol 是否有指定的Attribute
|
||||
/// </summary>
|
||||
public static bool HasAttribute(this ITypeSymbol typeSymbol, string AttributeName)
|
||||
{
|
||||
foreach (AttributeData? attributeData in typeSymbol.GetAttributes())
|
||||
{
|
||||
if (attributeData.AttributeClass?.ToString() == AttributeName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool HasAttributeInTypeAndBaseTyes(this ITypeSymbol typeSymbol, string AttributeName)
|
||||
{
|
||||
if (typeSymbol.HasAttribute(AttributeName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var baseType in typeSymbol.BaseTypes())
|
||||
{
|
||||
if (baseType.HasAttribute(AttributeName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IEnumerable<ITypeSymbol> BaseTypes(this ITypeSymbol typeSymbol)
|
||||
{
|
||||
ITypeSymbol? baseType = typeSymbol.BaseType;
|
||||
while (baseType != null)
|
||||
{
|
||||
yield return baseType;
|
||||
baseType = baseType.BaseType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// INamedTypeSymbol 是否有指定的基类Attribute
|
||||
/// </summary>
|
||||
public static bool HasBaseAttribute(this INamedTypeSymbol namedTypeSymbol, string AttributeName)
|
||||
{
|
||||
foreach (AttributeData? attributeData in namedTypeSymbol.GetAttributes())
|
||||
{
|
||||
INamedTypeSymbol? attributeType = attributeData.AttributeClass?.BaseType;
|
||||
while (attributeType != null)
|
||||
{
|
||||
if (attributeType.ToString() == AttributeName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
attributeType = attributeType.BaseType;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// INamedTypeSymbol 获取指定类型的第一个Attribute
|
||||
/// </summary>
|
||||
public static AttributeData? GetFirstAttribute(this INamedTypeSymbol namedTypeSymbol, string AttributeName)
|
||||
{
|
||||
foreach (AttributeData? attributeData in namedTypeSymbol.GetAttributes())
|
||||
{
|
||||
if (attributeData.AttributeClass?.ToString() == AttributeName)
|
||||
{
|
||||
return attributeData;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// INamedTypeSymbol 是否含有指定接口
|
||||
/// </summary>
|
||||
public static bool HasInterface(this INamedTypeSymbol namedTypeSymbol, string InterfaceName)
|
||||
{
|
||||
foreach (INamedTypeSymbol? iInterface in namedTypeSymbol.AllInterfaces)
|
||||
{
|
||||
if (iInterface.IsInterface(InterfaceName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 某个接口symbol 是否是指定的接口
|
||||
/// </summary>
|
||||
public static bool IsInterface(this INamedTypeSymbol namedTypeSymbol, string InterfaceName)
|
||||
{
|
||||
return $"{namedTypeSymbol.GetNameSpace()}.{namedTypeSymbol.Name}" == InterfaceName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断指定的程序集是否需要分析
|
||||
/// </summary>
|
||||
public static bool IsAssemblyNeedAnalyze(string? assemblyName, params string[] analyzeAssemblyNames)
|
||||
{
|
||||
if (assemblyName == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (string analyzeAssemblyName in analyzeAssemblyNames)
|
||||
{
|
||||
if (assemblyName == analyzeAssemblyName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取 成员访问语法节点的父级类型
|
||||
/// </summary>
|
||||
public static ITypeSymbol? GetMemberAccessSyntaxParentType(this MemberAccessExpressionSyntax memberAccessExpressionSyntax,
|
||||
SemanticModel semanticModel)
|
||||
{
|
||||
SyntaxNode? firstChildSyntaxNode = memberAccessExpressionSyntax.GetFirstChild();
|
||||
if (firstChildSyntaxNode == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ISymbol? firstChildSymbol = semanticModel.GetSymbolInfo(firstChildSyntaxNode).Symbol;
|
||||
if (firstChildSymbol == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (firstChildSymbol is ILocalSymbol localSymbol)
|
||||
{
|
||||
return localSymbol.Type;
|
||||
}
|
||||
|
||||
if (firstChildSymbol is IParameterSymbol parameterSymbol)
|
||||
{
|
||||
return parameterSymbol.Type;
|
||||
}
|
||||
|
||||
if (firstChildSymbol is IPropertySymbol propertySymbol)
|
||||
{
|
||||
return propertySymbol.Type;
|
||||
}
|
||||
|
||||
if (firstChildSymbol is IMethodSymbol methodSymbol)
|
||||
{
|
||||
return methodSymbol.ReturnType;
|
||||
}
|
||||
|
||||
if (firstChildSymbol is IFieldSymbol fieldSymbol)
|
||||
{
|
||||
return fieldSymbol.Type;
|
||||
}
|
||||
|
||||
if (firstChildSymbol is IEventSymbol eventSymbol)
|
||||
{
|
||||
return eventSymbol.Type;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最近的指定类型祖先节点
|
||||
/// </summary>
|
||||
public static T? GetNeareastAncestor<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||
{
|
||||
foreach (var ancestorNode in syntaxNode.Ancestors())
|
||||
{
|
||||
if (ancestorNode is T Tancestor)
|
||||
{
|
||||
return Tancestor;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断函数是否是否含有指定类型的参数
|
||||
/// </summary>
|
||||
public static bool HasParameterType(this IMethodSymbol methodSymbol, string parameterType, out IParameterSymbol? cencelTokenSymbol)
|
||||
{
|
||||
foreach (var parameterSymbol in methodSymbol.Parameters)
|
||||
{
|
||||
if (parameterSymbol.Type.ToString() == parameterType)
|
||||
{
|
||||
cencelTokenSymbol = parameterSymbol;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
cencelTokenSymbol = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有指定类型的子节点
|
||||
/// </summary>
|
||||
public static IEnumerable<T> DescendantNodes<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||
{
|
||||
foreach (var descendantNode in syntaxNode.DescendantNodes())
|
||||
{
|
||||
if (descendantNode is T node)
|
||||
{
|
||||
yield return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取与该语法节点同层级的上一个节点
|
||||
/// </summary>
|
||||
public static SyntaxNode? PreviousNode(this SyntaxNode syntaxNode)
|
||||
{
|
||||
if (syntaxNode.Parent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
foreach (var childNode in syntaxNode.Parent.ChildNodes())
|
||||
{
|
||||
if (childNode == syntaxNode)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return syntaxNode.Parent.ChildNodes().ElementAt(index - 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取与该语法节点同层级的下一个节点
|
||||
/// </summary>
|
||||
public static SyntaxNode? NextNode(this SyntaxNode syntaxNode)
|
||||
{
|
||||
if (syntaxNode.Parent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
|
||||
foreach (var childNode in syntaxNode.Parent.ChildNodes())
|
||||
{
|
||||
if (childNode == syntaxNode)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == syntaxNode.Parent.ChildNodes().Count() - 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return syntaxNode.Parent.ChildNodes().ElementAt(index + 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取await表达式所在的控制流block
|
||||
/// </summary>
|
||||
public static BasicBlock? GetAwaitStatementControlFlowBlock(StatementSyntax statementSyntax, AwaitExpressionSyntax awaitExpressionSyntax, SemanticModel semanticModel)
|
||||
{
|
||||
// 跳过 return 表达式
|
||||
if (statementSyntax.IsKind(SyntaxKind.ReturnStatement))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var methodSyntax = statementSyntax.GetNeareastAncestor<MethodDeclarationSyntax>();
|
||||
if (methodSyntax == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// 构建表达式所在函数的控制流图
|
||||
var controlFlowGraph = ControlFlowGraph.Create(methodSyntax, semanticModel);
|
||||
|
||||
if (controlFlowGraph == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (statementSyntax is LocalDeclarationStatementSyntax)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
BasicBlock? block = controlFlowGraph.Blocks.FirstOrDefault(x => x.Operations.Any(y => y.Syntax.Contains(statementSyntax)));
|
||||
return block;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断类是否为partial类
|
||||
/// </summary>
|
||||
public static bool IsPartial(this ClassDeclarationSyntax classDeclaration)
|
||||
{
|
||||
foreach (var modifier in classDeclaration.Modifiers)
|
||||
{
|
||||
if (modifier.IsKind(SyntaxKind.PartialKeyword))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string? GetNameSpace(this INamedTypeSymbol namedTypeSymbol)
|
||||
{
|
||||
INamespaceSymbol? namespaceSymbol = namedTypeSymbol.ContainingNamespace;
|
||||
string? namespaceName = namespaceSymbol?.Name;
|
||||
while (namespaceSymbol?.ContainingNamespace != null)
|
||||
{
|
||||
namespaceSymbol = namespaceSymbol.ContainingNamespace;
|
||||
if (string.IsNullOrEmpty(namespaceSymbol.Name))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
namespaceName = $"{namespaceSymbol.Name}.{namespaceName}";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(namespaceName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return namespaceName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据语义模型的文件路径 判断是否需要分析
|
||||
/// </summary>
|
||||
public static bool IsSemanticModelNeedAnalyze(SemanticModel semanticModel, params string[] filePaths)
|
||||
{
|
||||
foreach (var filePath in filePaths)
|
||||
{
|
||||
if (semanticModel.SyntaxTree.FilePath.Contains(filePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型symbol是否有指定名字 指定参数的方法
|
||||
/// </summary>
|
||||
public static bool HasMethodWithParams(this INamedTypeSymbol namedTypeSymbol, string methodName, params ITypeSymbol[] typeSymbols)
|
||||
{
|
||||
foreach (var member in namedTypeSymbol.GetMembers())
|
||||
{
|
||||
if (member is not IMethodSymbol methodSymbol)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (methodSymbol.Name != methodName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeSymbols.Length != methodSymbol.Parameters.Length)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeSymbols.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isEqual = true;
|
||||
|
||||
for (int i = 0; i < typeSymbols.Length; i++)
|
||||
{
|
||||
if (typeSymbols[i].ToString() != methodSymbol.Parameters[i].Type.ToString())
|
||||
{
|
||||
isEqual = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEqual)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型symbol是否有指定名字 指定参数的方法
|
||||
/// </summary>
|
||||
public static bool HasMethodWithParams(this INamedTypeSymbol namedTypeSymbol, string methodName, params string[] typeSymbols)
|
||||
{
|
||||
foreach (var member in namedTypeSymbol.GetMembers())
|
||||
{
|
||||
if (member is not IMethodSymbol methodSymbol)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (methodSymbol.Name != methodName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeSymbols.Length != methodSymbol.Parameters.Length)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeSymbols.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isEqual = true;
|
||||
|
||||
for (int i = 0; i < typeSymbols.Length; i++)
|
||||
{
|
||||
if (typeSymbols[i] != methodSymbol.Parameters[i].Type.ToString())
|
||||
{
|
||||
isEqual = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEqual)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 方法symbol 是否有指定的attribute
|
||||
/// </summary>
|
||||
public static bool HasAttribute(this IMethodSymbol methodSymbol, string AttributeName)
|
||||
{
|
||||
foreach (AttributeData? attributeData in methodSymbol.GetAttributes())
|
||||
{
|
||||
if (attributeData?.AttributeClass?.ToString() == AttributeName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
41
Tools/GameEventSourceGenerator/SourceGenerator.sln
Normal file
41
Tools/GameEventSourceGenerator/SourceGenerator.sln
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.002.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGenerator", "SourceGenerator\SourceGenerator.csproj", "{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FCBB04E4-2793-4CF8-9278-E932D3B254AC}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@@ -0,0 +1,7 @@
|
||||
public class Definition
|
||||
{
|
||||
public const string FrameworkNameSpace = "TEngine";
|
||||
public const string NameSpace = "GameLogic";
|
||||
public const string EventInterface = "EventInterface";
|
||||
public const string StringToHash = "RuntimeId.ToRuntimeId";
|
||||
}
|
@@ -0,0 +1,192 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Analyzer;
|
||||
|
||||
[Generator]
|
||||
public class EventInterfaceGenerator : ISourceGenerator
|
||||
{
|
||||
public void Initialize(GeneratorInitializationContext context)
|
||||
{
|
||||
// 可以在这里进行初始化
|
||||
}
|
||||
|
||||
public void Execute(GeneratorExecutionContext context)
|
||||
{
|
||||
// 获取当前语法树
|
||||
var syntaxTrees = context.Compilation.SyntaxTrees;
|
||||
|
||||
List<string> classNameList = new List<string>();
|
||||
|
||||
foreach (var tree in syntaxTrees)
|
||||
{
|
||||
var root = tree.GetRoot();
|
||||
var interfaces = root.DescendantNodes()
|
||||
.OfType<InterfaceDeclarationSyntax>()
|
||||
.Where(i => i.AttributeLists.Count > 0 &&
|
||||
i.AttributeLists
|
||||
.Any(a => a.Attributes
|
||||
.Any(attr => attr.Name.ToString() == $"{Definition.EventInterface}")));
|
||||
|
||||
foreach (var interfaceNode in interfaces)
|
||||
{
|
||||
var interfaceName = interfaceNode.Identifier.ToString();
|
||||
var fullName = interfaceNode.SyntaxTree.GetRoot()
|
||||
.DescendantNodes()
|
||||
.OfType<NamespaceDeclarationSyntax>()
|
||||
.Select(ns => ns.Name.ToString())
|
||||
.Concat(new[] { interfaceName })
|
||||
.Aggregate((a, b) => a + "." + b);
|
||||
var eventClassName = $"{interfaceName}_Event";
|
||||
var eventClassCode = GenerateEventClass(interfaceName, eventClassName, interfaceNode);
|
||||
|
||||
context.AddSource($"{eventClassName}.g.cs", eventClassCode);
|
||||
|
||||
// 生成实现类
|
||||
var implementationClassCode = GenerateImplementationClass(fullName, interfaceName, interfaceNode,context);
|
||||
context.AddSource($"{interfaceName}_Gen.g.cs", implementationClassCode);
|
||||
|
||||
|
||||
classNameList.Add($"{interfaceName}_Gen");
|
||||
}
|
||||
}
|
||||
|
||||
string uniqueFileName = $"GameEventHelper.g.cs";
|
||||
context.AddSource(uniqueFileName, GenerateGameEventHelper(classNameList));
|
||||
}
|
||||
|
||||
private string GenerateGameEventHelper(List<string> classNameList)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||
sb.AppendLine($"// <auto-generated>");
|
||||
sb.AppendLine($"// This code was generated by autoBindTool.");
|
||||
sb.AppendLine($"// Changes to this file may cause incorrect behavior and will be lost if");
|
||||
sb.AppendLine($"// the code is regenerated.");
|
||||
sb.AppendLine($"// </auto-generated>");
|
||||
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"using UnityEngine;");
|
||||
sb.AppendLine($"using UnityEngine.UI;");
|
||||
sb.AppendLine($"using {Definition.FrameworkNameSpace};");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"namespace {Definition.NameSpace}");
|
||||
sb.AppendLine($"{{");
|
||||
sb.AppendLine($" public static class GameEventHelper");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine($" public static void Init()");
|
||||
sb.AppendLine(" {");
|
||||
|
||||
foreach (var className in classNameList)
|
||||
{
|
||||
sb.AppendLine($" var m_{className} = new {className}(GameEvent.EventMgr.GetDispatcher());");
|
||||
}
|
||||
|
||||
sb.AppendLine(" }");
|
||||
|
||||
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine("}");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private string GenerateEventClass(string interfaceName, string className, InterfaceDeclarationSyntax interfaceNode)
|
||||
{
|
||||
var methods = interfaceNode.Members.OfType<MethodDeclarationSyntax>();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||
sb.AppendLine($"// <auto-generated>");
|
||||
sb.AppendLine($"// This code was generated by autoBindTool.");
|
||||
sb.AppendLine($"// Changes to this file may cause incorrect behavior and will be lost if");
|
||||
sb.AppendLine($"// the code is regenerated.");
|
||||
sb.AppendLine($"// </auto-generated>");
|
||||
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"using UnityEngine;");
|
||||
sb.AppendLine($"using UnityEngine.UI;");
|
||||
sb.AppendLine($"using {Definition.FrameworkNameSpace};");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"namespace {Definition.NameSpace}");
|
||||
sb.AppendLine("{");
|
||||
sb.AppendLine($" public partial class {className}");
|
||||
sb.AppendLine(" {");
|
||||
|
||||
foreach (var method in methods)
|
||||
{
|
||||
var methodName = method.Identifier.ToString();
|
||||
var parameters = string.Join(", ", method.ParameterList.Parameters.Select(p => $"{p.Type} {p.Identifier}"));
|
||||
sb.AppendLine($" public static readonly int {methodName} = {Definition.StringToHash}(\"{className}.{methodName}\");");
|
||||
}
|
||||
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine("}");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private string GenerateImplementationClass(string interfaceFullName, string interfaceName, InterfaceDeclarationSyntax interfaceNode,GeneratorExecutionContext context)
|
||||
{
|
||||
var semanticModel = context.Compilation.GetSemanticModel(interfaceNode.SyntaxTree);
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||
sb.AppendLine($"// <auto-generated>");
|
||||
sb.AppendLine($"// This code was generated by autoBindTool.");
|
||||
sb.AppendLine($"// Changes to this file may cause incorrect behavior and will be lost if");
|
||||
sb.AppendLine($"// the code is regenerated.");
|
||||
sb.AppendLine($"// </auto-generated>");
|
||||
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"using UnityEngine;");
|
||||
sb.AppendLine($"using UnityEngine.UI;");
|
||||
sb.AppendLine($"using {Definition.FrameworkNameSpace};");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"namespace {Definition.NameSpace}");
|
||||
sb.AppendLine($"{{");
|
||||
sb.AppendLine($" public partial class {interfaceName}_Gen : {interfaceName}");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" private EventDispatcher _dispatcher;");
|
||||
sb.AppendLine($" public {interfaceName}_Gen(EventDispatcher dispatcher)");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine(" _dispatcher = dispatcher;");
|
||||
sb.AppendLine($" GameEvent.EventMgr.RegWrapInterface(\"{interfaceFullName}\", this);");
|
||||
sb.AppendLine(" }");
|
||||
|
||||
foreach (var method in interfaceNode.Members.OfType<MethodDeclarationSyntax>())
|
||||
{
|
||||
var methodName = method.Identifier.ToString();
|
||||
var parameters = GenerateParameters(method, semanticModel);
|
||||
|
||||
sb.AppendLine($" public void {methodName}({parameters})");
|
||||
sb.AppendLine(" {");
|
||||
if (method.ParameterList.Parameters.Count > 0)
|
||||
{
|
||||
var paramNames = string.Join(", ", method.ParameterList.Parameters.Select(p => p.Identifier.ToString()));
|
||||
sb.AppendLine($" _dispatcher.Send({interfaceName}_Event.{methodName}, {paramNames});");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine($" _dispatcher.Send({interfaceName}_Event.{methodName});");
|
||||
}
|
||||
sb.AppendLine(" }");
|
||||
}
|
||||
|
||||
sb.AppendLine(" }");
|
||||
sb.AppendLine("}");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private string GenerateParameters(MethodDeclarationSyntax method, SemanticModel semanticModel)
|
||||
{
|
||||
return string.Join(", ", method.ParameterList.Parameters.Select(p =>
|
||||
{
|
||||
var typeSymbol = semanticModel.GetTypeInfo(p.Type).Type;
|
||||
return typeSymbol != null
|
||||
? $"{typeSymbol.ToDisplayString()} {p.Identifier}"
|
||||
: $"{p.Type} {p.Identifier}";
|
||||
}));
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>12</LangVersion>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<DevelopmentDependency>true</DevelopmentDependency>
|
||||
<IncludeSymbols>false</IncludeSymbols>
|
||||
<NoWarn>1701;1702;RS2008</NoWarn>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="../Analyzer/Extension/*.cs">
|
||||
<Link>Extension\%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- <Target Name="PostBuild" AfterTargets="PostBuildEvent">-->
|
||||
<!-- <Copy SourceFiles="$(TargetDir)/$(TargetName).dll" DestinationFolder="$(ProjectDir)/../../Unity/Assets/Plugins/" ContinueOnError="false" />-->
|
||||
<!-- </Target>-->
|
||||
|
||||
</Project>
|
@@ -0,0 +1,236 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETStandard,Version=v2.0/",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETStandard,Version=v2.0": {},
|
||||
".NETStandard,Version=v2.0/": {
|
||||
"SourceGenerator/1.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.3.3",
|
||||
"Microsoft.CodeAnalysis.CSharp": "3.9.0",
|
||||
"NETStandard.Library": "2.0.3"
|
||||
},
|
||||
"runtime": {
|
||||
"SourceGenerator.dll": {}
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Analyzers/3.3.3": {},
|
||||
"Microsoft.CodeAnalysis.Common/3.9.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": "3.3.3",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Memory": "4.5.4",
|
||||
"System.Reflection.Metadata": "5.0.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "5.0.0",
|
||||
"System.Text.Encoding.CodePages": "4.5.1",
|
||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.CodeAnalysis.dll": {
|
||||
"assemblyVersion": "3.9.0.0",
|
||||
"fileVersion": "3.900.21.12420"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp/3.9.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Common": "3.9.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.dll": {
|
||||
"assemblyVersion": "3.9.0.0",
|
||||
"fileVersion": "3.900.21.12420"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/1.1.0": {},
|
||||
"NETStandard.Library/2.0.3": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0"
|
||||
}
|
||||
},
|
||||
"System.Buffers/4.5.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Buffers.dll": {
|
||||
"assemblyVersion": "4.0.3.0",
|
||||
"fileVersion": "4.6.28619.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.4"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Collections.Immutable.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Memory/4.5.4": {
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.5.1",
|
||||
"System.Numerics.Vectors": "4.4.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Memory.dll": {
|
||||
"assemblyVersion": "4.0.1.1",
|
||||
"fileVersion": "4.6.28619.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Numerics.Vectors/4.4.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Numerics.Vectors.dll": {
|
||||
"assemblyVersion": "4.1.3.0",
|
||||
"fileVersion": "4.6.25519.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reflection.Metadata/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Collections.Immutable": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Reflection.Metadata.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding.CodePages/4.5.1": {
|
||||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Text.Encoding.CodePages.dll": {
|
||||
"assemblyVersion": "4.1.1.0",
|
||||
"fileVersion": "4.6.27129.4"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Threading.Tasks.Extensions/4.5.4": {
|
||||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": {
|
||||
"assemblyVersion": "4.2.0.1",
|
||||
"fileVersion": "4.6.28619.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"SourceGenerator/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Analyzers/3.3.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-j/rOZtLMVJjrfLRlAMckJLPW/1rze9MT1yfWqSIbUPGRu1m1P0fuo9PmqapwsmePfGB5PJrudQLvmUOAMF0DqQ==",
|
||||
"path": "microsoft.codeanalysis.analyzers/3.3.3",
|
||||
"hashPath": "microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.Common/3.9.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-HiWjF7PNIEngmFg2Xk8cZ/83lRIRkk9v+5ibbY5B7VvjNGdClGAMuWtZER9F5rGRR41VbJLco9ah73jFTh4vPw==",
|
||||
"path": "microsoft.codeanalysis.common/3.9.0",
|
||||
"hashPath": "microsoft.codeanalysis.common.3.9.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp/3.9.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-NTsiK3fnoZGemy4dBHrILwg9rL+jDnOJ7aixFu4EOWM1r6MZMrNCIhT2tO4AmIMdfICLPwj910uZRRLpbMnqHg==",
|
||||
"path": "microsoft.codeanalysis.csharp/3.9.0",
|
||||
"hashPath": "microsoft.codeanalysis.csharp.3.9.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/1.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
|
||||
"path": "microsoft.netcore.platforms/1.1.0",
|
||||
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
|
||||
},
|
||||
"NETStandard.Library/2.0.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
|
||||
"path": "netstandard.library/2.0.3",
|
||||
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
|
||||
},
|
||||
"System.Buffers/4.5.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==",
|
||||
"path": "system.buffers/4.5.1",
|
||||
"hashPath": "system.buffers.4.5.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Memory/4.5.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==",
|
||||
"path": "system.memory/4.5.4",
|
||||
"hashPath": "system.memory.4.5.4.nupkg.sha512"
|
||||
},
|
||||
"System.Numerics.Vectors/4.4.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==",
|
||||
"path": "system.numerics.vectors/4.4.0",
|
||||
"hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reflection.Metadata/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==",
|
||||
"path": "system.reflection.metadata/5.0.0",
|
||||
"hashPath": "system.reflection.metadata.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==",
|
||||
"path": "system.runtime.compilerservices.unsafe/5.0.0",
|
||||
"hashPath": "system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Encoding.CodePages/4.5.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==",
|
||||
"path": "system.text.encoding.codepages/4.5.1",
|
||||
"hashPath": "system.text.encoding.codepages.4.5.1.nupkg.sha512"
|
||||
},
|
||||
"System.Threading.Tasks.Extensions/4.5.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
|
||||
"path": "system.threading.tasks.extensions/4.5.4",
|
||||
"hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
|
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SourceGenerator")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b7d75c0f6f518a5f2ca0ed9304411302709f8dbe")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("SourceGenerator")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("SourceGenerator")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
@@ -0,0 +1 @@
|
||||
1f4b8d9919850399efa15c732e9aadbc83f7ae6889745a83831d20da225de402
|
@@ -0,0 +1,12 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = netstandard2.0
|
||||
build_property.TargetPlatformMinVersion = 7.0
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = SourceGenerator
|
||||
build_property.ProjectDir = E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
ff752c9a870df6aafb4669266bbcfd2f80f90bfd76a1bae882d02d67457c3ec4
|
@@ -0,0 +1,32 @@
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.deps.json
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.dll
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.pdb
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.AssemblyReference.cache
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.GeneratedMSBuildEditorConfig.editorconfig
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfoInputs.cache
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfo.cs
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.CoreCompileInputs.cache
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.sourcelink.json
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.dll
|
||||
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.pdb
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.AssemblyReference.cache
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.GeneratedMSBuildEditorConfig.editorconfig
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfoInputs.cache
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfo.cs
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.dll
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.pdb
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.deps.json
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.dll
|
||||
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.pdb
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.deps.json
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.dll
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.pdb
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.AssemblyReference.cache
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.GeneratedMSBuildEditorConfig.editorconfig
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfoInputs.cache
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfo.cs
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.CoreCompileInputs.cache
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.sourcelink.json
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.dll
|
||||
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.pdb
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"documents":{"E:\\WorkSpace\\ZGame\\*":"https://raw.githubusercontent.com/Alex-Rachel/ZGame/b7d75c0f6f518a5f2ca0ed9304411302709f8dbe/*"}}
|
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj",
|
||||
"projectName": "SourceGenerator",
|
||||
"projectPath": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj",
|
||||
"packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\",
|
||||
"outputPath": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"netstandard2.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.0": {
|
||||
"targetAlias": "netstandard2.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.0": {
|
||||
"targetAlias": "netstandard2.0",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeAnalysis.Analyzers": {
|
||||
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[3.3.3, )"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp": {
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[3.9.0, )"
|
||||
},
|
||||
"NETStandard.Library": {
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[2.0.3, )",
|
||||
"autoReferenced": true
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.300\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Admin\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Admin\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Admin\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.3</PkgMicrosoft_CodeAnalysis_Analyzers>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "YK6sSPNENOs=",
|
||||
"success": true,
|
||||
"projectFilePath": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.3.3\\microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.codeanalysis.common\\3.9.0\\microsoft.codeanalysis.common.3.9.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.codeanalysis.csharp\\3.9.0\\microsoft.codeanalysis.csharp.3.9.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\netstandard.library\\2.0.3\\netstandard.library.2.0.3.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.buffers\\4.5.1\\system.buffers.4.5.1.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.collections.immutable\\5.0.0\\system.collections.immutable.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.numerics.vectors\\4.4.0\\system.numerics.vectors.4.4.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.reflection.metadata\\5.0.0\\system.reflection.metadata.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\5.0.0\\system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.text.encoding.codepages\\4.5.1\\system.text.encoding.codepages.4.5.1.nupkg.sha512",
|
||||
"C:\\Users\\Admin\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
@@ -0,0 +1 @@
|
||||
"restore":{"projectUniqueName":"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj","projectName":"SourceGenerator","projectPath":"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj","outputPath":"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["netstandard2.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"netstandard2.0":{"targetAlias":"netstandard2.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"netstandard2.0":{"targetAlias":"netstandard2.0","dependencies":{"Microsoft.CodeAnalysis.Analyzers":{"include":"Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive","suppressParent":"All","target":"Package","version":"[3.3.3, )"},"Microsoft.CodeAnalysis.CSharp":{"suppressParent":"All","target":"Package","version":"[3.9.0, )"},"NETStandard.Library":{"suppressParent":"All","target":"Package","version":"[2.0.3, )","autoReferenced":true}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.300\\RuntimeIdentifierGraph.json"}}
|
@@ -0,0 +1 @@
|
||||
17413576752312703
|
@@ -0,0 +1 @@
|
||||
17413576752312703
|
Reference in New Issue
Block a user