Refactored package own dep

This commit is contained in:
Gilles Lazures 2026-01-30 03:36:39 +01:00
parent 28f18b9971
commit eb5d29af89
3 changed files with 22 additions and 13 deletions

View File

@ -7,18 +7,21 @@
<Nullable>enable</Nullable>
<AssemblyName>LentiaLauncher</AssemblyName>
<ApplicationIcon>./src/resources/icon.ico</ApplicationIcon>
<PublishTrimmed>true</PublishTrimmed>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
<Target Name="PackRenderer" BeforeTargets="BeforeBuild;BeforeRun">
<Target Name="PackRenderer" BeforeTargets="DispatchToInnerBuild;BeforeBuild">
<PropertyGroup>
<RendererSrc>$(ProjectDir)wwwroot</RendererSrc>
<RendererOut>$(OutputPath)root.dat</RendererOut>
<XorKey>66</XorKey>
<BrikPackagerDll>$([System.IO.Path]::Combine('$(PkgBrikPackager)', 'lib', 'net8.0', 'BrikPackager.dll'))</BrikPackagerDll>
<InputPath>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', 'wwwroot'))</InputPath>
<OutputPathFile>$([System.IO.Path]::Combine('$(TargetDir)', 'root.dat'))</OutputPathFile>
</PropertyGroup>
<Message Importance="high" Text="[Lentia] Packaging renderer..." />
<Exec Command="dotnet run --project ../AzuresPackager/AzuresPackager.csproj --action pack --input &quot;$(RendererSrc)&quot; --output &quot;$(RendererOut)&quot; --key $(XorKey)" />
<Message Importance="high" Text="[Lentia] Renderer packed in : $(RendererOut)" />
<Message Importance="high" Text="[] Packaging renderer (Cross-Platform)..." />
<Exec Command="dotnet &quot;$(BrikPackagerDll)&quot; --action pack --input &quot;$(InputPath)&quot; --output &quot;$(OutputPathFile)&quot; --key 66" />
<Message Importance="high" Text="[] Renderer packed at: $(OutputPathFile)" />
</Target>
<ItemGroup>
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>
<ItemGroup>
<Compile Remove="wwwroot\**" />
<None Update="wwwroot\**">
@ -26,7 +29,7 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AzuresPackager" Version="0.0.2" />
<PackageReference Include="BrikPackager" Version="0.0.1" GeneratePathProperty="true" />
<PackageReference Include="Photino.NET" Version="4.0.16" />
<PackageReference Include="System.Management" Version="10.0.2" />
</ItemGroup>

6
Roots.xml Normal file
View File

@ -0,0 +1,6 @@
<linker>
<assembly fullname="LentiaLauncher">
<type fullname="Lentia.Core.*" preserve="all" />
<type fullname="Lentia.Utils.*" preserve="all" />
</assembly>
</linker>

View File

@ -1,4 +1,4 @@
using AzuresPackager;
using BrikPackager;
using Lentia.Core.Auth.OAuth2;
using Lentia.Core.Constants;
using Lentia.Core.Game;
@ -26,8 +26,8 @@ class Program {
}
public static PhotinoWindow CreateLoginWindow() {
AzuresPackage azp = new AzuresPackage(Path.Combine(__dirname, "root.dat"), 66);
List<string> entries = azp.ListEntries();
BrikPackage bpkg = new BrikPackage(Path.Combine(__dirname, "root.dat"), 66);
List<string> entries = bpkg.ListEntries();
var window = new PhotinoWindow()
.SetUseOsDefaultLocation(false)
.SetUseOsDefaultSize(false)
@ -38,7 +38,7 @@ class Program {
if (uri.Host == "internal") {
string internalPath = uri.AbsolutePath;
contentType = MimeHelper.GetMimeType(uri.AbsolutePath);
byte[] fileData = azp.GetFileBytes(internalPath.TrimStart('/'));
byte[] fileData = bpkg.GetFileBytes(internalPath.TrimStart('/'));
return fileData != null ? new MemoryStream(fileData) : null;
}
contentType = null!;