private static async Task BuildUpdateXml(UpdateData update, MachineType MachineType) { string buildstr = ""; IEnumerable <string> languages = null; var compDBs = await update.GetCompDBsAsync(); await Task.WhenAll( Task.Run(async() => buildstr = await update.GetBuildStringAsync()), Task.Run(async() => languages = await update.GetAvailableLanguagesAsync())); buildstr = buildstr ?? ""; CompDBXmlClass.Package editionPackPkg = compDBs.GetEditionPackFromCompDBs(); string editionPkg = await update.DownloadFileFromDigestAsync(editionPackPkg.Payload.PayloadItem.PayloadHash); var plans = await Task.WhenAll(languages.Select(x => update.GetTargetedPlanAsync(x, editionPkg))); UpdateScan scan = new UpdateScan() { Architecture = MachineType, BuildString = buildstr, Description = update.Xml.LocalizedProperties.Description, Title = update.Xml.LocalizedProperties.Title, Targets = plans, UpdateData = update }; File.WriteAllText("updatetest.xml", scan.Serialize()); }
public static async Task <EditionPlanningWithLanguage> GetTargetedPlanAsync(this UpdateData update, string LanguageCode) { var compDBs = await update.GetCompDBsAsync(); CompDBXmlClass.Package editionPackPkg = compDBs.GetEditionPackFromCompDBs(); string editionPkg = await update.DownloadFileFromDigestAsync(editionPackPkg.Payload.PayloadItem.PayloadHash); return(await update.GetTargetedPlanAsync(LanguageCode, editionPkg)); }
private static async Task ProcessUpdateAsync(UpdateData update, string pOutputFolder, MachineType MachineType, string Language = "", string Edition = "", bool WriteMetadata = true) { HashSet <CompDBXmlClass.PayloadItem> payloadItems = new HashSet <CompDBXmlClass.PayloadItem>(); HashSet <CompDBXmlClass.PayloadItem> bannedPayloadItems = new HashSet <CompDBXmlClass.PayloadItem>(); HashSet <CompDBXmlClass.CompDB> specificCompDBs = new HashSet <CompDBXmlClass.CompDB>(); string buildstr = ""; IEnumerable <string> languages = null; int returnCode = 0; IEnumerable <CExtendedUpdateInfoXml.File> filesToDownload = null; bool getSpecific = !string.IsNullOrEmpty(Language) && !string.IsNullOrEmpty(Edition); bool getSpecificLanguage = !string.IsNullOrEmpty(Language) && string.IsNullOrEmpty(Edition); Logging.Log("Gathering update metadata..."); var compDBs = await update.GetCompDBsAsync(); await Task.WhenAll( Task.Run(async() => buildstr = await update.GetBuildStringAsync()), Task.Run(async() => languages = await update.GetAvailableLanguagesAsync())); buildstr = buildstr ?? ""; CompDBXmlClass.Package editionPackPkg = compDBs.GetEditionPackFromCompDBs(); if (editionPackPkg != null) { string editionPkg = await update.DownloadFileFromDigestAsync(editionPackPkg.Payload.PayloadItem.PayloadHash); var plans = await Task.WhenAll(languages.Select(x => update.GetTargetedPlanAsync(x, editionPkg))); foreach (var plan in plans) { Logging.Log(""); Logging.Log("Editions available for language: " + plan.LanguageCode); plan.EditionTargets.PrintAvailablePlan(); } } string name = $"{buildstr.Replace(" ", ".").Replace("(", "").Replace(")", "")}_{MachineType.ToString().ToLower()}fre_{update.Xml.UpdateIdentity.UpdateID.Split("-")[^1]}";