XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.XApp

【DLL】XApp开发支持

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.XApp

支持预先编译的程序集

490e5ae
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

3 个文件 +21 -7
Modified XFEExtension.NetCore.XApp/XAppExtensions.cs +9 -1
@@ -1,4 +1,6 @@
1 namespace XFEExtension.NetCore.XApp.Extensions;
1 using System.Reflection;
2
3 namespace XFEExtension.NetCore.XApp.Extensions;
2 4
3 5 /// <summary>
4 6 /// XApp拓展
@@ -11,4 +13,10 @@ public static class XAppExtensions
11 13 /// <param name="xApp">XApp应用</param>
12 14 /// <returns></returns>
13 15 public static async Task<CompilateResult> GetMainPage(this Core.XApp xApp) => await XAppLoader.GetMainPage(xApp);
16 /// <summary>
17 /// 获取主页面
18 /// </summary>
19 /// <param name="xAppAssembly">XApp应用</param>
20 /// <returns></returns>
21 public static async Task<CompilateResult> GetMainPage(this Assembly xAppAssembly) => await XAppLoader.GetMainPage(xAppAssembly, []);
14 22 }
Modified XFEExtension.NetCore.XApp/XAppLoader.cs +11 -5
@@ -17,9 +17,16 @@ public static class XAppLoader
17 17 /// </summary>
18 18 /// <param name="xApp">XApp对象</param>
19 19 /// <returns>编译结果信息</returns>
20 public static async Task<CompilateResult> GetMainPage(Core.XApp xApp)
20 public static async Task<CompilateResult> GetMainPage(Core.XApp xApp) => await GetMainPage(LoadAssemblyFromXApp(xApp, out var diagnostic), diagnostic);
21 /// <summary>
22 /// 获取主页面
23 /// </summary>
24 /// <param name="xAppAssembly">XApp程序集</param>
25 /// <param name="diagnostics">诊断信息</param>
26 /// <returns>编译结果信息</returns>
27 public static async Task<CompilateResult> GetMainPage(Assembly? xAppAssembly, ImmutableArray<Diagnostic> diagnostics)
21 28 {
22 var mainMethod = LoadAssemblyFromXApp(xApp, out var diagnostic)?.EntryPoint;
29 var mainMethod = xAppAssembly?.EntryPoint;
23 30 if (mainMethod is not null)
24 31 {
25 32 if (mainMethod?.ReturnType == typeof(Task))
@@ -27,11 +34,11 @@ public static class XAppLoader
27 34 else
28 35 mainMethod?.Invoke(null, [Array.Empty<string>()]);
29 36 var pageIsNotNull = XAppBuilder.CurrentXAppMainPage is not null;
30 return new CompilateResult(pageIsNotNull, XAppBuilder.CurrentXAppMainPage, diagnostic);
37 return new CompilateResult(pageIsNotNull, XAppBuilder.CurrentXAppMainPage, diagnostics);
31 38 }
32 39 else
33 40 {
34 return new CompilateResult(false, null, diagnostic);
41 return new CompilateResult(false, null, diagnostics);
35 42 }
36 43 }
37 44 /// <summary>
@@ -91,7 +98,6 @@ public static class XAppLoader
91 98 MetadataReference.CreateFromFile(Assembly.Load("System.ObjectModel").Location),
92 99 MetadataReference.CreateFromFile(Assembly.Load("System.Text.Encoding.Extensions").Location),
93 100 MetadataReference.CreateFromFile(Assembly.Load("System.Collections.Immutable").Location),
94 MetadataReference.CreateFromFile(Assembly.Load("System").Location),
95 101 MetadataReference.CreateFromFile(Assembly.Load("Microsoft.Maui").Location),
96 102 MetadataReference.CreateFromFile(Assembly.Load("Microsoft.Maui.Controls").Location),
97 103 MetadataReference.CreateFromFile(Assembly.Load("Microsoft.Maui.Controls.Xaml").Location),
Modified XFEExtension.NetCore.XApp/XFEExtension.NetCore.XApp.csproj +1 -1
@@ -17,7 +17,7 @@
17 17 <PackageTags>XApp;XFE</PackageTags>
18 18 <PackageReleaseNotes>添加API文档,诊断信息现可被获取</PackageReleaseNotes>
19 19 <PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
20 <Version>1.1.0</Version>
20 <Version>1.1.1</Version>
21 21 <GenerateDocumentationFile>True</GenerateDocumentationFile>
22 22 </PropertyGroup>
23 23