@@ -39,6 +39,7 @@ public class Package
3939 public Package ( )
4040 {
4141 this . Tags = [ ] ;
42+ this . Executors = [ ] ;
4243 this . Creation = DateTime . Now ;
4344 this . Platform = Utility . Platform ;
4445 this . Architecture = Utility . Architecture ;
@@ -52,6 +53,7 @@ public Package(string name, string edition, Version version, string[] tags = nul
5253 this . Edition = edition ;
5354 this . Version = version ;
5455 this . Tags = tags ?? [ ] ;
56+ this . Executors = [ ] ;
5557 this . Creation = DateTime . Now ;
5658 this . Platform = Utility . Platform ;
5759 this . Architecture = Utility . Architecture ;
@@ -65,6 +67,7 @@ public Package(string name, string edition, Version version, Platform platform,
6567 this . Edition = edition ;
6668 this . Version = version ;
6769 this . Tags = tags ?? [ ] ;
70+ this . Executors = [ ] ;
6871 this . Creation = DateTime . Now ;
6972 this . Platform = platform ;
7073 this . Architecture = architecture ;
@@ -102,6 +105,10 @@ public Package(string name, string edition, Version version, Platform platform,
102105 /// <summary>获取或设置描述信息。</summary>
103106 public string Description { get ; set ; }
104107
108+ /// <summary>获取执行器集合。</summary>
109+ [ System . Text . Json . Serialization . JsonObjectCreationHandling ( System . Text . Json . Serialization . JsonObjectCreationHandling . Populate ) ]
110+ public ICollection < Executor > Executors { get ; }
111+
105112 /// <summary>获取包的扩展属性集。</summary>
106113 [ System . Text . Json . Serialization . JsonExtensionData ]
107114 [ System . Text . Json . Serialization . JsonObjectCreationHandling ( System . Text . Json . Serialization . JsonObjectCreationHandling . Populate ) ]
@@ -113,4 +120,18 @@ public override string ToString() => string.IsNullOrEmpty(this.Edition) ?
113120 $ "{ this . Name } @{ this . Version } ({ this . GetRuntimeIdentifier ( ) } )":
114121 $ "{ this . Name } |{ this . Edition } @{ this . Version } ({ this . GetRuntimeIdentifier ( ) } )";
115122 #endregion
123+
124+ #region 嵌套结构
125+ public struct Executor ( string @event , string command )
126+ {
127+ #region 公共字段
128+ public string Event = @event ;
129+ public string Command = command ;
130+ #endregion
131+
132+ #region 重写方法
133+ public readonly override string ToString ( ) => $ "[{ this . Event } ]{ this . Command } ";
134+ #endregion
135+ }
136+ #endregion
116137}
0 commit comments