Nuke.Unreal
Build Unreal apps in Style.
Loading...
Searching...
No Matches
LauncherInstalled.cs
1using System.Collections.Generic;
2using System.Linq;
3using Nuke.Common.IO;
4using Nuke.Common.Utilities;
5
6namespace Nuke.Unreal;
7
8/// <summary>
9/// Represents an item in the LauncherInstalled file.
10/// </summary>
11public record class LauncherInstalledItem(
12 string InstallLocation,
13 string NamespaceId,
14 string ItemId,
15 string ArtifactId,
16 string AppVersion,
17 string AppName
18);
19
20/// <summary>
21/// Represents the whole LauncherInstalled file
22/// </summary>
23public record class LauncherInstalledList(List<LauncherInstalledItem> InstallationList)
24{
25 /// <summary>
26 /// Fetch Unreal installations from this list
27 /// </summary>
28 public IEnumerable<UnrealInstance> GetInstances() => InstallationList
29 .Where(i => i.ArtifactId.StartsWith("UE_"))
30 .Select(i => new UnrealInstance(i.ArtifactId.Replace("UE_", ""), (AbsolutePath)i.InstallLocation))
31 ;
32
33 /// <summary>
34 /// Fetch Unreal installations from a LauncherInstalled.dat file
35 /// </summary>
36 /// <param name="datFile">Can be not existing, in which case an empty enumerable is returned</param>
37 public static IEnumerable<UnrealInstance> FromFile(AbsolutePath datFile) => datFile.ExistingFile()
39 ?.GetInstances()
40 ?? []
41 ;
42}
A collection of utilities around basic functions regarding the environment of the Engine we're workin...
Definition Unreal.cs:24
static readonly JsonSerializerSettings JsonReadSettings
Common JsonSerializerSettings for Unreal conventions of JSON format.
Definition Unreal.cs:69
record class UnrealInstance(string Name, AbsolutePath Path)
Group an Unreal association with its actual path.
record class LauncherInstalledList(List< LauncherInstalledItem > InstallationList)
Represents the whole LauncherInstalled file.
record class LauncherInstalledItem(string InstallLocation, string NamespaceId, string ItemId, string ArtifactId, string AppVersion, string AppName)
Represents an item in the LauncherInstalled file.