Skip to content

Commit

Permalink
fix bug && add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kitUIN committed Jul 30, 2024
1 parent 0932018 commit c70058a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
15 changes: 9 additions & 6 deletions ShadowViewer.Analyzer/Generators/DIGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,20 @@ public void Execute(GeneratorExecutionContext context)
List<string> constructor = new();
var di = new List<Di>
{
new("ICallableService","Caller","caller"),
new("ISqlSugarClient","Db","db"),
new("CompressService","Compressor","compressService"),
new("PluginLoader","PluginService","pluginService"),
new("ILogger","Logger","logger"),
new("ResponderService","ResponderService","responderService"),
new("PluginLoader","PluginService","pluginService","插件服务"),
new("ICallableService","Caller","caller","触发器服务"),
new("ISqlSugarClient","Db","db","数据库服务"),
new("CompressService","Compressor","compressService","解压缩服务"),
new("ILogger","Logger","logger","日志服务"),
new("ResponderService","ResponderService","responderService","响应器服务"),
};
for (var i = 0; i < di.Count; i++)
{
if (!b[i]) continue;
p += $@"
/// <summary>
/// {di[i].Comment}
/// </summary>
public {di[i].ClassTypeName} {di[i].ClassName} {{ get; }}";
init += $@"
{di[i].ClassName} = {di[i].ConstructorName};";
Expand Down
14 changes: 10 additions & 4 deletions ShadowViewer.Analyzer/Model/Di.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,31 @@ public class Di
/// <param name="classTypeName"></param>
/// <param name="className"></param>
/// <param name="constructorName"></param>
public Di(string classTypeName, string className, string constructorName)
/// <param name="comment"></param>
public Di(string classTypeName, string className, string constructorName,string comment = "")
{
ClassTypeName = classTypeName;
ClassName = className;
ConstructorName = constructorName;
Comment = comment;
}

/// <summary>
///
/// 类类型名
/// </summary>
public string ClassTypeName { get; }
/// <summary>
///
/// 类名
/// </summary>
public string ClassName { get; }
/// <summary>
///
/// 构造函数名称
/// </summary>
public string ConstructorName { get;}
/// <summary>
/// 注释
/// </summary>
public string Comment { get;}

}
}
4 changes: 2 additions & 2 deletions ShadowViewer.Analyzer/ShadowViewer.Analyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<Version>1.2.1.1</Version>
<Version>1.2.5.1</Version>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<PackageId>ShadowViewer.Analyzer</PackageId>
<Authors>kitUIN</Authors>
Expand All @@ -17,7 +17,7 @@
<PluginLang>zh-CN</PluginLang>
<Copyright>Copyright 2023</Copyright>
<PackageTags>kitUIN;wasdk;ShadowViewer;winui</PackageTags>
<PackageOutputPath>.\..\NugetPackages</PackageOutputPath>
<PackageOutputPath>..\..\..\NugetPackages</PackageOutputPath>
<NoWarn>MSB3277</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down

0 comments on commit c70058a

Please sign in to comment.