Skip to content

Commit 7a44b42

Browse files
committed
add inno setup
1 parent 5a92354 commit 7a44b42

31 files changed

+964
-109
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,6 @@ launchSettings.json
356356

357357
# Compiled Shaders
358358
*.cso
359+
360+
# Inno Setup
361+
publish/

Inno/CodeDependencies.iss

+771
Large diffs are not rendered by default.

Inno/dependencies/netcorecheck.exe

116 KB
Binary file not shown.
143 KB
Binary file not shown.

Inno/setup.iss

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
; Script generated by the Inno Setup Script Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+
#define MyAppName "PixelGraph"
5+
#define MyAppVersion "1.10.9"
6+
#define MyAppPublisher "Joshua Miller"
7+
#define MyAppURL "https://github.com/Null-MC/PixelGraph"
8+
#define MyAppExeName "PixelGraph.exe"
9+
10+
#define public Dependency_Path_NetCoreCheck "dependencies\"
11+
12+
#include "CodeDependencies.iss"
13+
14+
15+
[Setup]
16+
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
17+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
18+
AppId={{6987408B-3447-4272-8104-8CA8BB9FF520}
19+
AppName={#MyAppName}
20+
AppVersion={#MyAppVersion}
21+
;AppVerName={#MyAppName} {#MyAppVersion}
22+
AppPublisher={#MyAppPublisher}
23+
AppPublisherURL={#MyAppURL}
24+
AppSupportURL={#MyAppURL}
25+
AppUpdatesURL={#MyAppURL}
26+
DefaultDirName={autopf}\{#MyAppName}
27+
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
28+
; on anything but x64 and Windows 11 on Arm.
29+
ArchitecturesAllowed=x64compatible
30+
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
31+
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
32+
; meaning it should use the native 64-bit Program Files directory and
33+
; the 64-bit view of the registry.
34+
ArchitecturesInstallIn64BitMode=x64compatible
35+
DisableProgramGroupPage=yes
36+
InfoBeforeFile=D:\PixelGraph\PixelGraph.UI\Resources\EULA.rtf
37+
; Remove the following line to run in administrative install mode (install for all users.)
38+
PrivilegesRequired=lowest
39+
PrivilegesRequiredOverridesAllowed=dialog
40+
OutputDir=D:\PixelGraph\publish
41+
OutputBaseFilename=PixelGraph-{#MyAppVersion}
42+
Compression=lzma
43+
SolidCompression=yes
44+
WizardStyle=modern
45+
46+
[Languages]
47+
Name: "english"; MessagesFile: "compiler:Default.isl"
48+
49+
[Tasks]
50+
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
51+
52+
[Files]
53+
Source: "D:\PixelGraph\PixelGraph.UI\bin\x64\Release\net6.0-windows\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
54+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
55+
56+
[Icons]
57+
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
58+
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
59+
60+
[Run]
61+
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
62+
63+
[Code]
64+
function InitializeSetup: Boolean;
65+
begin
66+
67+
#ifdef Dependency_Path_NetCoreCheck
68+
//Dependency_AddNetCore31Desktop;
69+
//Dependency_AddDotNet50Desktop;
70+
Dependency_AddDotNet60Desktop;
71+
//Dependency_AddDotNet70Desktop;
72+
//Dependency_AddDotNet80Desktop;
73+
#endif
74+
75+
Result := True;
76+
end;

PixelGraph.CLI/CommandLine/AppCommandLine.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.CommandLine;
2-
using System.Threading.Tasks;
32

43
namespace PixelGraph.CLI.CommandLine;
54

PixelGraph.CLI/CommandLine/PublishCommand.cs

+30-20
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using PixelGraph.Common.Projects;
99
using Serilog;
1010
using System.CommandLine;
11-
using System.CommandLine.Invocation;
1211
using System.Diagnostics;
1312

1413
namespace PixelGraph.CLI.CommandLine;
@@ -31,38 +30,49 @@ public PublishCommand(
3130
this.lifetime = lifetime;
3231
this.logger = logger;
3332

34-
Command = new Command("publish", "Publishes the specified profile.") {
35-
Handler = CommandHandler.Create<FileInfo, string, DirectoryInfo, FileInfo, bool, int>(RunAsync),
36-
};
37-
38-
Command.AddOption(new Option<FileInfo>(
33+
var optProjectFile = new Option<FileInfo>(
3934
new [] {"-p", "--project-file"}, () => new FileInfo("project.yml"),
40-
"The filename of the project to publish."));
35+
"The filename of the project to publish.");
4136

42-
Command.AddOption(new Option<string>(
37+
var optProfileName = new Option<string>(
4338
new [] {"-n", "--profile-name"},
44-
"The name of the publish-profile within the project to publish."));
39+
"The name of the publish-profile within the project to publish.");
4540

46-
Command.AddOption(new Option<DirectoryInfo>(
41+
var optDestination = new Option<DirectoryInfo>(
4742
new[] { "-o", "--output" },
48-
"The target directory to publish the resource pack to."));
43+
"The target directory to publish the resource pack to.");
4944

50-
Command.AddOption(new Option<string>(
45+
var optZip = new Option<FileInfo?>(
5146
new [] {"-z", "--zip"},
52-
"Generates a compressed ZIP archive of the published contents."));
47+
"Generates a compressed ZIP archive of the published contents.");
5348

54-
Command.AddOption(new Option<bool>(
49+
var optClean = new Option<bool>(
5550
new [] {"-c", "--clean"}, () => false,
56-
"Generates a compressed ZIP archive of the published contents."));
51+
"Generates a compressed ZIP archive of the published contents.");
5752

58-
Command.AddOption(new Option<int>(
53+
var optConcurrency = new Option<int>(
5954
new [] {"--concurrency"}, ConcurrencyHelper.GetDefaultValue,
60-
"Sets the level of concurrency for importing/publishing files. Default value is half of the system processor count."));
55+
"Sets the level of concurrency for importing/publishing files. Default value is half of the system processor count.");
56+
57+
Command = new Command("publish", "Publishes the specified profile.") {
58+
optProjectFile,
59+
optProfileName,
60+
optDestination,
61+
optZip,
62+
optClean,
63+
optConcurrency,
64+
};
65+
66+
Command.SetHandler(RunAsync, optProjectFile, optProfileName, optDestination, optZip, optClean, optConcurrency);
6167
}
6268

63-
private async Task<int> RunAsync(FileInfo projectFile, string profileName, DirectoryInfo destination, FileInfo? zip, bool clean, int concurrency)
69+
private async Task<int> RunAsync(FileInfo projectFile, string profileName, DirectoryInfo? destination, FileInfo? zip, bool clean, int concurrency)
6470
{
65-
var destPath = zip?.FullName ?? destination.FullName;
71+
var destPath = zip?.FullName ?? destination?.FullName;
72+
if (destPath == null) throw new ApplicationException("Publish output location is undefined!");
73+
74+
var sourcePath = projectFile.DirectoryName;
75+
if (sourcePath == null) throw new ApplicationException("Source directory is undefined!");
6676

6777
try {
6878
if (projectFile.Exists != true)
@@ -103,7 +113,7 @@ private async Task<int> RunAsync(FileInfo projectFile, string profileName, Direc
103113
executor.CleanDestination = clean;
104114
executor.AsArchive = zip != null;
105115

106-
await executor.ExecuteAsync(projectFile.DirectoryName, destPath, lifetime.Token);
116+
await executor.ExecuteAsync(sourcePath, destPath, lifetime.Token);
107117

108118
return 0;
109119
}

PixelGraph.CLI/PixelGraph.CLI.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
<ItemGroup>
2323
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
24-
<PackageReference Include="Serilog" Version="3.1.1" />
24+
<PackageReference Include="Serilog" Version="4.0.1" />
2525
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
26-
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
27-
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
26+
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
27+
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
2828
</ItemGroup>
2929

3030
<ItemGroup>

PixelGraph.Common/Extensions/YamlStringEnumConverter.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public bool Accepts(Type type)
1313
return type.IsEnum || (Nullable.GetUnderlyingType(type)?.IsEnum ?? false);
1414
}
1515

16-
public object ReadYaml(IParser parser, Type type)
16+
public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer)
1717
{
1818
var parsedEnum = parser.Consume<Scalar>();
1919

@@ -22,13 +22,13 @@ public object ReadYaml(IParser parser, Type type)
2222

2323
var serializableValues = ScanAssembly(t).ToDictionary(pa => pa.Key, pa => pa.Value);
2424

25-
if (!serializableValues.ContainsKey(parsedEnum.Value))
25+
if (!serializableValues.TryGetValue(parsedEnum.Value, out var value))
2626
throw new YamlException(parsedEnum.Start, parsedEnum.End, $"Value '{parsedEnum.Value}' not found in enum '{t.Name}'");
2727

28-
return Enum.Parse(t, serializableValues[parsedEnum.Value].Name);
28+
return Enum.Parse(t, value.Name);
2929
}
3030

31-
public void WriteYaml(IEmitter emitter, object? value, Type type)
31+
public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer)
3232
{
3333
var nullType = Nullable.GetUnderlyingType(type);
3434
var t = nullType ?? type;

PixelGraph.Common/IO/Importing/ResourcePackImporter.cs

+7-22
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ public interface IResourcePackImporter
1717
Task ImportAsync(CancellationToken token = default);
1818
}
1919

20-
public class ResourcePackImporter : IResourcePackImporter
20+
public class ResourcePackImporter(IServiceProvider provider) : IResourcePackImporter
2121
{
22-
private readonly ILogger<ResourcePackImporter> logger;
23-
private readonly IInputReader reader;
24-
private readonly IOutputWriter writer;
25-
private readonly IMaterialImporter importer;
26-
//private readonly IMaterialWriter matWriter;
22+
private readonly ILogger<ResourcePackImporter> logger = provider.GetRequiredService<ILogger<ResourcePackImporter>>();
23+
private readonly IInputReader reader = provider.GetRequiredService<IInputReader>();
24+
private readonly IOutputWriter writer = provider.GetRequiredService<IOutputWriter>();
25+
private readonly IMaterialImporter importer = provider.GetRequiredService<IMaterialImporter>();
2726

2827
public bool AsGlobal {get; set;}
2928
public bool CopyUntracked {get; set;}
@@ -34,20 +33,6 @@ public class ResourcePackImporter : IResourcePackImporter
3433
public int FailureCount {get; set;}
3534

3635

37-
//static ResourcePackImporter()
38-
//{
39-
// ctmPropertySerializer = new ObjectPropertyFileSerializer<CtmProperties>();
40-
//}
41-
42-
public ResourcePackImporter(IServiceProvider provider)
43-
{
44-
reader = provider.GetRequiredService<IInputReader>();
45-
writer = provider.GetRequiredService<IOutputWriter>();
46-
importer = provider.GetRequiredService<IMaterialImporter>();
47-
//matWriter = provider.GetRequiredService<IMaterialWriter>();
48-
logger = provider.GetRequiredService<ILogger<ResourcePackImporter>>();
49-
}
50-
5136
public async Task ImportAsync(CancellationToken token = default)
5237
{
5338
FailureCount = 0;
@@ -212,8 +197,8 @@ private async Task<MaterialProperties> ImportMaterialAsync(string localPath, str
212197

213198
private async Task CopyFileAsync(string file, CancellationToken token)
214199
{
215-
await using var sourceStream = reader.Open(file);
216-
if (sourceStream == null) throw new ApplicationException($"Failed to open file '{file}'!");
200+
await using var sourceStream = reader.Open(file)
201+
?? throw new ApplicationException($"Failed to open file '{file}'!");
217202

218203
await writer.OpenWriteAsync(file, async destStream => {
219204
await sourceStream.CopyToAsync(destStream, token);

PixelGraph.Common/IO/Serialization/CustomGraphVisitor.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@
55

66
namespace PixelGraph.Common.IO.Serialization;
77

8-
public class CustomGraphVisitor : ChainedObjectGraphVisitor
8+
public class CustomGraphVisitor(IObjectGraphVisitor<IEmitter> nextVisitor) : ChainedObjectGraphVisitor(nextVisitor)
99
{
10-
public CustomGraphVisitor(IObjectGraphVisitor<IEmitter> nextVisitor) : base(nextVisitor) {}
11-
1210
private static object? GetDefault(Type type)
1311
{
1412
return type.IsValueType ? Activator.CreateInstance(type) : null;
1513
}
1614

17-
public override bool EnterMapping(IObjectDescriptor key, IObjectDescriptor value, IEmitter context)
15+
public override bool EnterMapping(IObjectDescriptor key, IObjectDescriptor value, IEmitter context, ObjectSerializer serializer)
1816
{
1917
return !Equals(value.Value, GetDefault(value.Type))
20-
&& base.EnterMapping(key, value, context);
18+
&& base.EnterMapping(key, value, context, serializer);
2119
}
2220

23-
public override bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor value, IEmitter context)
21+
public override bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor value, IEmitter context, ObjectSerializer serializer)
2422
{
2523
if (value.Value is IHaveData dataObj) return dataObj.HasAnyData();
2624

2725
var defaultValueAttribute = key.GetCustomAttribute<DefaultValueAttribute>();
2826
var defaultValue = defaultValueAttribute?.Value;
2927

3028
return !Equals(value.Value, defaultValue)
31-
&& base.EnterMapping(key, value, context);
29+
&& base.EnterMapping(key, value, context, serializer);
3230
}
3331
}

PixelGraph.Common/PixelGraph.Common.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
6262
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
6363
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
64-
<PackageReference Include="Serilog" Version="3.1.1" />
64+
<PackageReference Include="Serilog" Version="4.0.1" />
6565
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
66-
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
67-
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" />
68-
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.2" />
66+
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
67+
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
68+
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
6969
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
70-
<PackageReference Include="YamlDotNet" Version="15.1.2" />
70+
<PackageReference Include="YamlDotNet" Version="16.1.0" />
7171
</ItemGroup>
7272

7373
<ItemGroup>

PixelGraph.Common/Textures/TextureBuilder.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ private bool TryBuildMapping(PackEncodingChannel outputChannel, bool createEmpty
243243
mapping.OutputApplyOcclusion = true;
244244
}
245245

246-
var inputChannel = InputChannels?.FirstOrDefault(i => EncodingChannel.Is(i.ID, outputChannel.ID))
247-
?? throw new ApplicationException("Input channel is undefined!");
246+
var inputChannel = InputChannels?.FirstOrDefault(i => EncodingChannel.Is(i.ID, outputChannel.ID));
247+
//?? throw new ApplicationException("Input channel is undefined!");
248+
if (inputChannel == null) return false;
248249

249250
if (context.Material.TryGetChannelValue(outputChannel.ID, out var value)) {
250251
mapping.InputValue = (float)value;

PixelGraph.Rendering/Models/BlockMeshGeometry3D.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ namespace PixelGraph.Rendering.Models;
55

66
public class BlockMeshGeometry3D : MeshGeometry3D
77
{
8-
private Vector2Collection textureCoordinateMins = [];
9-
private Vector2Collection textureCoordinateMaxs = [];
8+
private Vector2Collection? textureCoordinateMins = [];
9+
private Vector2Collection? textureCoordinateMaxs = [];
1010

1111
[DataMember]
12-
public Vector2Collection TextureCoordinateMins {
12+
public Vector2Collection? TextureCoordinateMins {
1313
get => textureCoordinateMins;
1414
set => Set(ref textureCoordinateMins, value);
1515
}
1616

1717
[DataMember]
18-
public Vector2Collection TextureCoordinateMaxs {
18+
public Vector2Collection? TextureCoordinateMaxs {
1919
get => textureCoordinateMaxs;
2020
set => Set(ref textureCoordinateMaxs, value);
2121
}
@@ -35,11 +35,11 @@ protected override void OnClearAllGeometryData()
3535
{
3636
base.OnClearAllGeometryData();
3737

38-
TextureCoordinateMins.Clear();
39-
TextureCoordinateMins.TrimExcess();
38+
TextureCoordinateMins?.Clear();
39+
TextureCoordinateMins?.TrimExcess();
4040

41-
TextureCoordinateMaxs.Clear();
42-
TextureCoordinateMaxs.TrimExcess();
41+
TextureCoordinateMaxs?.Clear();
42+
TextureCoordinateMaxs?.TrimExcess();
4343
}
4444

4545
//public void Freeze()

0 commit comments

Comments
 (0)