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

XFEExtension.NetCore.XApp.Core

【DLL】XApp开发核心支持

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

XFEstudio/XFEExtension.NetCore.XApp.Core

添加Json构造函数

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

代码差异

8 个文件 +86 -18
Added XFEExtension.NetCore.XApp.Core.Test/Program.cs +48 -0
@@ -0,0 +1,48 @@
1 using XFEExtension.NetCore.StringExtension;
2 using XFEExtension.NetCore.XApp.Core;
3
4 internal class Program
5 {
6 [SMTest]
7 private static void MainTest()
8 {
9 var app = CreateXApp();
10 app.X();
11 var appString = app.Package();
12 var unApp = XApp.UnPackage(appString);
13 unApp.X();
14 }
15 static XApp CreateXApp()
16 {
17 var appInfo = new XAppInformation(string.Empty, "be98276c-48d6-451d-8a0a-a311d782d9d6", "第一个小程序", new Version(1, 0, 0), "这是第一个小程序", "XFE工作室室长", "4174240069", string.Empty, string.Empty, string.Empty, string.Empty);
18 var codeFile = XAppCode.FromCode(XAppFileType.XFCS, "MainPage.cs", """"
19 namespace XFEstudio;
20
21 public partial class MainPage : ContentPage
22 {
23 public MainPage()
24 {
25 this.LoadFromXaml("""
26 <?xml version="1.0" encoding="utf-8" ?>
27 <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
28 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
29 x:Class="XFEstudio.MainPage"
30 Title="我的第一个小程序">
31 <StackLayout>
32 <Label Text="这是一个小程序" FontSize="18"/>
33 <Label Text="这是一个小程序" FontSize="12"/>
34 <Label Text="这是一个小程序" FontSize="6"/>
35 </StackLayout>
36 </ContentPage>
37 """);
38 }
39 }
40 """");
41 var xApp = new XApp
42 {
43 AppInformation = appInfo
44 };
45 xApp.AppFiles.Add(codeFile);
46 return xApp;
47 }
48 }
Added XFEExtension.NetCore.XApp.Core.Test/XFEExtension.NetCore.XApp.Core.Test.csproj +18 -0
@@ -0,0 +1,18 @@
1 <Project Sdk="Microsoft.NET.Sdk">
2
3 <PropertyGroup>
4 <OutputType>Exe</OutputType>
5 <TargetFramework>net8.0</TargetFramework>
6 <ImplicitUsings>enable</ImplicitUsings>
7 <Nullable>enable</Nullable>
8 </PropertyGroup>
9
10 <ItemGroup>
11 <PackageReference Include="XFEExtension.NetCore.XUnit" Version="2.0.3" />
12 </ItemGroup>
13
14 <ItemGroup>
15 <ProjectReference Include="..\XFEExtension.NetCore.XApp.Core\XFEExtension.NetCore.XApp.Core.csproj" />
16 </ItemGroup>
17
18 </Project>
Modified XFEExtension.NetCore.XApp.Core.sln +9 -1
@@ -1,16 +1,24 @@
1 
2 1 Microsoft Visual Studio Solution File, Format Version 12.00
3 2 # Visual Studio Version 17
4 3 VisualStudioVersion = 17.9.34728.123
5 4 MinimumVisualStudioVersion = 10.0.40219.1
6 5 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XFEExtension.NetCore.XApp.Core", "XFEExtension.NetCore.XApp.Core\XFEExtension.NetCore.XApp.Core.csproj", "{C4A15B7C-2FFD-423F-9A8D-8F918F367B07}"
7 6 EndProject
7 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFEExtension.NetCore.XApp.Core.Test", "XFEExtension.NetCore.XApp.Core.Test\XFEExtension.NetCore.XApp.Core.Test.csproj", "{0C2C3C75-2047-4EC4-A56C-A529552452B5}"
8 ProjectSection(ProjectDependencies) = postProject
9 {C4A15B7C-2FFD-423F-9A8D-8F918F367B07} = {C4A15B7C-2FFD-423F-9A8D-8F918F367B07}
10 EndProjectSection
11 EndProject
8 12 Global
9 13 GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 14 Debug|Any CPU = Debug|Any CPU
11 15 Release|Any CPU = Release|Any CPU
12 16 EndGlobalSection
13 17 GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 {0C2C3C75-2047-4EC4-A56C-A529552452B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 {0C2C3C75-2047-4EC4-A56C-A529552452B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 {0C2C3C75-2047-4EC4-A56C-A529552452B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 {0C2C3C75-2047-4EC4-A56C-A529552452B5}.Release|Any CPU.Build.0 = Release|Any CPU
14 22 {C4A15B7C-2FFD-423F-9A8D-8F918F367B07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 23 {C4A15B7C-2FFD-423F-9A8D-8F918F367B07}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 24 {C4A15B7C-2FFD-423F-9A8D-8F918F367B07}.Release|Any CPU.ActiveCfg = Release|Any CPU
Modified XFEExtension.NetCore.XApp.Core/XAppCodeImpl.cs +2 -4
@@ -1,11 +1,9 @@
1 using System.Diagnostics.CodeAnalysis;
1 using System.Text.Json.Serialization;
2 2
3 3 namespace XFEExtension.NetCore.XApp.Core;
4 4
5 5 internal class XAppCodeImpl : XAppCode
6 6 {
7 [SetsRequiredMembers]
7 [JsonConstructor]
8 8 internal XAppCodeImpl(XAppFileType fileType, string fileName, string? code) : base(fileType, fileName, code) { }
9 [SetsRequiredMembers]
10 internal XAppCodeImpl() : this(default, default!, default) { }
11 9 }
Modified XFEExtension.NetCore.XApp.Core/XAppFile.cs +3 -3
@@ -11,13 +11,13 @@ public abstract class XAppFile(XAppFileType fileType, string fileName, string? f
11 11 /// <summary>
12 12 /// 文件类型
13 13 /// </summary>
14 public required XAppFileType FileType { get; set; } = fileType;
14 public XAppFileType FileType { get; set; } = fileType;
15 15 /// <summary>
16 16 /// 文件名
17 17 /// </summary>
18 public required string FileName { get; set; } = fileName;
18 public string FileName { get; set; } = fileName;
19 19 /// <summary>
20 20 /// 文件内容
21 21 /// </summary>
22 public required string? FileContent { get; set; } = fileContent;
22 public string? FileContent { get; set; } = fileContent;
23 23 }
Modified XFEExtension.NetCore.XApp.Core/XAppImageImpl.cs +2 -4
@@ -1,11 +1,9 @@
1 using System.Diagnostics.CodeAnalysis;
1 using System.Text.Json.Serialization;
2 2
3 3 namespace XFEExtension.NetCore.XApp.Core;
4 4
5 5 internal class XAppImageImpl : XAppImage
6 6 {
7 [SetsRequiredMembers]
7 [JsonConstructor]
8 8 internal XAppImageImpl(XAppFileType fileType, string fileName, string imageBase64String, ImageType imageType) : base(fileType, fileName, imageBase64String, imageType) { }
9 [SetsRequiredMembers]
10 internal XAppImageImpl() : this(default, default!, default!, default) { }
11 9 }
Modified XFEExtension.NetCore.XApp.Core/XAppResourceImpl.cs +2 -4
@@ -1,11 +1,9 @@
1 using System.Diagnostics.CodeAnalysis;
1 using System.Text.Json.Serialization;
2 2
3 3 namespace XFEExtension.NetCore.XApp.Core;
4 4
5 5 internal class XAppResourceImpl : XAppResource
6 6 {
7 [SetsRequiredMembers]
7 [JsonConstructor]
8 8 internal XAppResourceImpl(XAppFileType fileType, string fileName, string? resourceBase64String, string? resourceType) : base(fileType, fileName, resourceBase64String, resourceType) { }
9 [SetsRequiredMembers]
10 internal XAppResourceImpl() : this(default, default!, default, default) { }
11 9 }
Modified XFEExtension.NetCore.XApp.Core/XFEExtension.NetCore.XApp.Core.csproj +2 -2
@@ -14,11 +14,11 @@
14 14 <PackageReadmeFile>README.md</PackageReadmeFile>
15 15 <RepositoryUrl>https://github.com/XFEstudio/XFEExtension.NetCore.XApp.Core</RepositoryUrl>
16 16 <PackageTags>XFE;XApp</PackageTags>
17 <PackageReleaseNotes>增加无参构造函数</PackageReleaseNotes>
17 <PackageReleaseNotes>添加Json构造函数</PackageReleaseNotes>
18 18 <PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
19 19 <Authors>XFEstudio</Authors>
20 20 <Company>寰宇朽力网络科技有限公司</Company>
21 <Version>1.0.5</Version>
21 <Version>1.0.6</Version>
22 22 </PropertyGroup>
23 23
24 24 <ItemGroup>