generated from azures04/Photino-Boilerplate
Added prod loading deployment
This commit is contained in:
parent
e9958306d1
commit
98b6cd681f
@ -8,6 +8,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PublishTrimmed>false</PublishTrimmed>
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
<ApplicationIcon>src/resources/build/icon.ico</ApplicationIcon>
|
<ApplicationIcon>src/resources/build/icon.ico</ApplicationIcon>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||||
|
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="PackRenderer" BeforeTargets="DispatchToInnerBuild;BeforeBuild">
|
<Target Name="PackRenderer" BeforeTargets="DispatchToInnerBuild;BeforeBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -20,9 +24,13 @@
|
|||||||
<Message Importance="high" Text="[] Renderer packed at: $(OutputPathFile)" />
|
<Message Importance="high" Text="[] Renderer packed at: $(OutputPathFile)" />
|
||||||
</Target>
|
</Target>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="src\resources\build\**">
|
<Content Include="$(TargetDir)root.dat">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<Pack>true</Pack>
|
||||||
</None>
|
<PublishState>Included</PublishState>
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
<ExcludeFromSingleFile>false</ExcludeFromSingleFile>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BrikPackager" Version="0.0.1" GeneratePathProperty="true" />
|
<PackageReference Include="BrikPackager" Version="0.0.1" GeneratePathProperty="true" />
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class Constants {
|
|||||||
public static readonly string Os = OsHelper.getOperatingSystem();
|
public static readonly string Os = OsHelper.getOperatingSystem();
|
||||||
public static readonly string Arch = OsHelper.getArchitecture();
|
public static readonly string Arch = OsHelper.getArchitecture();
|
||||||
|
|
||||||
public static readonly string Env = "DEV";
|
public static readonly string Env = "PROD";
|
||||||
|
|
||||||
public static readonly string BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
public static readonly string BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
public static readonly string CurrentWorkingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
|
public static readonly string CurrentWorkingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
|
||||||
|
|||||||
@ -4,9 +4,7 @@ using System.Text.Json;
|
|||||||
using BrikInstaller.Utils;
|
using BrikInstaller.Utils;
|
||||||
using BrikInstaller.Schemas;
|
using BrikInstaller.Schemas;
|
||||||
using BrikInstaller.Services;
|
using BrikInstaller.Services;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using System.Reflection.Metadata;
|
|
||||||
|
|
||||||
namespace BrikInstaller;
|
namespace BrikInstaller;
|
||||||
|
|
||||||
@ -16,11 +14,15 @@ class Program{
|
|||||||
CreateMainWindow().WaitForClose();
|
CreateMainWindow().WaitForClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhotinoWindow CreateMainWindow() {
|
public static PhotinoWindow CreateMainWindow() {
|
||||||
BrikPackage bpkg = new BrikPackage(Path.Combine(Constants.CurrentWorkingDirectory, "root.dat"), 66);
|
var BrikPackagePath = Path.Combine(Constants.BaseDirectory, "root.dat");
|
||||||
|
if (Constants.Env == "PROD") {
|
||||||
|
BrikPackagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "root.dat");
|
||||||
|
}
|
||||||
|
BrikPackage bpkg = new BrikPackage(BrikPackagePath, 66);
|
||||||
List<string> entries = bpkg.ListEntries();
|
List<string> entries = bpkg.ListEntries();
|
||||||
foreach (string entry in entries) {
|
foreach (string entry in entries) {
|
||||||
Console.WriteLine($"[File] > entry");
|
Console.WriteLine($"[File] > {entry}");
|
||||||
}
|
}
|
||||||
var window = new PhotinoWindow()
|
var window = new PhotinoWindow()
|
||||||
.SetTitle("Brik Installer")
|
.SetTitle("Brik Installer")
|
||||||
@ -52,7 +54,7 @@ class Program{
|
|||||||
window.Center();
|
window.Center();
|
||||||
};
|
};
|
||||||
|
|
||||||
LoadPage(window, "index.html");
|
LoadPage(window, "index.html");
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +144,6 @@ class Program{
|
|||||||
HttpMethod httpMethod = HttpMethod.Get;
|
HttpMethod httpMethod = HttpMethod.Get;
|
||||||
var response = await HttpHelper.FetchAsync(Constants.URLs.Endpoints.Configuration(Constants.ProductMetadata.Name, Constants.Os, Constants.Arch), httpMethod);
|
var response = await HttpHelper.FetchAsync(Constants.URLs.Endpoints.Configuration(Constants.ProductMetadata.Name, Constants.Os, Constants.Arch), httpMethod);
|
||||||
var productConfig = await response.Content.ReadFromJsonAsync<ProductConfig>(Constants._jsonOptions);
|
var productConfig = await response.Content.ReadFromJsonAsync<ProductConfig>(Constants._jsonOptions);
|
||||||
Console.WriteLine(productConfig!.Executable);
|
|
||||||
InstallationFinish installationFinish = jsonPayload.Deserialize<InstallationFinish>(Constants._jsonOptions)!;
|
InstallationFinish installationFinish = jsonPayload.Deserialize<InstallationFinish>(Constants._jsonOptions)!;
|
||||||
if (installationFinish.CreateShortcut) {
|
if (installationFinish.CreateShortcut) {
|
||||||
ShortcutService.CreateShortcut(Constants.ProductMetadata.Name, Path.Combine(Constants.ProductMetadata.InstallPath, productConfig.Executable!));
|
ShortcutService.CreateShortcut(Constants.ProductMetadata.Name, Path.Combine(Constants.ProductMetadata.InstallPath, productConfig.Executable!));
|
||||||
@ -164,7 +165,6 @@ class Program{
|
|||||||
HttpMethod httpMethod = HttpMethod.Get;
|
HttpMethod httpMethod = HttpMethod.Get;
|
||||||
var response = await HttpHelper.FetchAsync(Constants.URLs.Endpoints.Metadata(), httpMethod);
|
var response = await HttpHelper.FetchAsync(Constants.URLs.Endpoints.Metadata(), httpMethod);
|
||||||
string content = await response.Content.ReadAsStringAsync();
|
string content = await response.Content.ReadAsStringAsync();
|
||||||
Console.WriteLine(content);
|
|
||||||
responsePayload = new { success = true, content = content.ToString() };
|
responsePayload = new { success = true, content = content.ToString() };
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
responsePayload = new { success = false };
|
responsePayload = new { success = false };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user