Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion src/UnifiedUpdatePlatform.Media.Creator/FileLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,40 @@ internal static (bool Succeeded, string BaseESD) LocateFilesForSetupMediaCreatio
string UUPPath,
string LanguageCode,
IEnumerable<CompDB> CompositionDatabases,
ProgressCallback? progressCallback = null)
ProgressCallback? progressCallback = null,
string edition = null)
{
progressCallback?.Invoke(Common.Messaging.Common.ProcessPhase.ReadingMetadata, true, 0, "Looking up Composition Database in order to find a Base ESD image appropriate for building windows setup files.");

if (edition != null)
{
CompDB? compDB = GetEditionCompDBForLanguage(CompositionDatabases, edition, LanguageCode);

if (compDB != null)
{
foreach (Package feature in compDB.Features.Feature[0].Packages.Package)
{
Package pkg = compDB.Packages.Package.First(x => x.ID == feature.ID);

string file = pkg.GetCommonlyUsedIncorrectFileName();

if (feature.PackageType == "MetadataESD")
{
if (!File.Exists(Path.Combine(UUPPath, file)))
{
file = pkg.Payload.PayloadItem[0].Path.Replace('\\', Path.DirectorySeparatorChar);
if (!File.Exists(Path.Combine(UUPPath, file)))
{
break;
}
}

return (true, Path.Combine(UUPPath, file));
}
}
}
}

HashSet<CompDB> filteredCompositionDatabases = CompositionDatabases.GetEditionCompDBsForLanguage(LanguageCode);
if (filteredCompositionDatabases.Count > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ public static bool CreateSetupMedia(
Common.Messaging.Common.CompressionType CompressionType,
IEnumerable<CompDB> CompositionDatabases,
TempManager tempManager,
ProgressCallback progressCallback = null)
ProgressCallback progressCallback = null,
string edition = null)
{
bool result = true;
string BaseESD = null;

(result, BaseESD) = FileLocator.LocateFilesForSetupMediaCreation(UUPPath, LanguageCode, CompositionDatabases, progressCallback);
(result, BaseESD) = FileLocator.LocateFilesForSetupMediaCreation(UUPPath, LanguageCode, CompositionDatabases, progressCallback, edition: edition);
if (!result)
{
goto exit;
Expand Down
2 changes: 1 addition & 1 deletion src/UnifiedUpdatePlatform.Media.Creator/MediaCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public static void CreateISOMedia(
//
// Build installer
//
result = SetupMediaCreator.CreateSetupMedia(UUPPath, LanguageCode, MediaRootPath, WinREWIMFilePath, CompressionType, CompositionDatabases, tempManager, progressCallback);
result = SetupMediaCreator.CreateSetupMedia(UUPPath, LanguageCode, MediaRootPath, WinREWIMFilePath, CompressionType, CompositionDatabases, tempManager, progressCallback: progressCallback, edition: Edition);
if (!result)
{
error = "An error occurred while creating setup media.";
Expand Down