public TestThemeExtensionInfo(string name, IFeatureInfo baseTheme) { var dic1 = new Dictionary <string, string>() { { "name", name }, { "desciption", name }, { "type", "theme" }, { "basetheme", baseTheme.Id } }; var memConfigSrc1 = new MemoryConfigurationSource { InitialData = dic1 }; var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.Add(memConfigSrc1); Manifest = new ManifestInfo(configurationBuilder.Build(), "theme"); Features = new List <IFeatureInfo>() { { new FeatureInfo(name, name, 0, "", "", this, new string[] { baseTheme.Id }) } }; Id = name; }
private ManifestInfo GetManifestInfo(int skip, int take, ManifestInfo manifest) { ManifestInfo aggregateJobManifest = new ManifestInfo() { AssetID = manifest.AssetID, EmbedderNotificationQueue = manifest.EmbedderNotificationQueue, EnbebedCodes = new List <EnbebedCode>(), JobID = manifest.JobID, PreprocessorNotificationQueue = manifest.PreprocessorNotificationQueue, VideoInformation = new List <VideoInformation>() }; //Add aggregated video info nodes aggregateJobManifest.VideoInformation.AddRange(manifest.VideoInformation.Skip(skip).Take(take)); foreach (var emc in manifest.EnbebedCodes) { EnbebedCode jobemc = new EnbebedCode() { EmbebedCode = emc.EmbebedCode, MP4WatermarkedURL = new List <MP4WatermarkedURL>() }; foreach (var vi in aggregateJobManifest.VideoInformation) { MP4WatermarkedURL myMMP4WatermarkeInfo = emc.MP4WatermarkedURL.Where(x => x.FileName == vi.FileName).FirstOrDefault(); //add to the list jobemc.MP4WatermarkedURL.Add(myMMP4WatermarkeInfo); } aggregateJobManifest.EnbebedCodes.Add(jobemc); } return(aggregateJobManifest); }
public TestThemeExtensionInfo(string name) { var dic1 = new Dictionary <string, string>() { { "name", name }, { "desciption", name }, { "type", "theme" }, }; var memConfigSrc1 = new MemoryConfigurationSource { InitialData = dic1 }; var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.Add(memConfigSrc1); Manifest = new ManifestInfo(new ThemeAttribute()); var features = new List <IFeatureInfo>() { { new FeatureInfo(name, name, 0, String.Empty, String.Empty, this, Array.Empty <string>(), false, false) } }; Features = features; Id = name; }
private static async Task <ManifestInfo?> GetSubscriptionManifestAsync(Subscription subscription, ManifestFilterOptions filterOptions, HttpClient httpClient, ILoggerService loggerService, Action <ManifestOptions>?configureOptions) { // If the command is filtered with an OS type that does not match the OsType filter of the subscription, // then there are no images that need to be inspected. string osTypeRegexPattern = ManifestFilter.GetFilterRegexPattern(filterOptions.OsType); if (!string.IsNullOrEmpty(subscription.OsType) && !Regex.IsMatch(subscription.OsType, osTypeRegexPattern, RegexOptions.IgnoreCase)) { return(null); } string repoPath = await GitHelper.DownloadAndExtractGitRepoArchiveAsync(httpClient, subscription.Manifest, loggerService); try { TempManifestOptions manifestOptions = new(filterOptions) { Manifest = Path.Combine(repoPath, subscription.Manifest.Path), Variables = subscription.Manifest.Variables }; configureOptions?.Invoke(manifestOptions); return(ManifestInfo.Load(manifestOptions)); } finally { // The path to the repo is stored inside a zip extraction folder so be sure to delete that // zip extraction folder, not just the inner repo folder. Directory.Delete(new DirectoryInfo(repoPath).Parent !.FullName, true); } }
public TestModuleExtensionInfo(string name) { var dic1 = new Dictionary <string, string>() { { "name", name }, { "desciption", name }, { "type", "module" }, }; var memConfigSrc1 = new MemoryConfigurationSource { InitialData = dic1 }; var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.Add(memConfigSrc1); Manifest = new ManifestInfo(configurationBuilder.Build(), "module"); var features = new List <IFeatureInfo>() { { new FeatureInfo(name, name, 0, "", "", this, new string[0]) } }; Features = features; }
public void Load_Import_Variables() { string includeManifestPath = "manifest.variables.json"; string variableOneName = "variable1"; string variableOneValue = "value1"; string variableTwoName = "variable2"; string variableTwoValue = "value2"; string manifest = $@" {{ ""includes"": [ ""{includeManifestPath}"" ], ""variables"": {{ ""{variableOneName}"": ""{variableOneValue}"" }}, {s_repoJson} }}"; string includeManifest = $@" {{ ""variables"": {{ ""{variableTwoName}"": ""{variableTwoValue}"" }} }}"; ManifestInfo manifestInfo = LoadManifestInfo(manifest, includeManifestPath, includeManifest); Assert.Equal(2, manifestInfo.Model.Variables.Count); Assert.Equal(variableOneValue, manifestInfo.Model.Variables[variableOneName]); Assert.Equal(variableTwoValue, manifestInfo.Model.Variables[variableTwoName]); }
public virtual void LoadManifest() { if (Manifest is null) { Manifest = ManifestInfo.Load(Options); } }
private ManifestInfo GetManifest5Jobs(ManifestInfo manifestInfo, IAsset theAsset, IEnumerable <IAssetFile> mp4AssetFiles, string AssetLocatorPath) { SharedAccessBlobPermissions allAccess = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write | SharedAccessBlobPermissions.Add | SharedAccessBlobPermissions.Create; foreach (var file in mp4AssetFiles.OrderBy(f => f.ContentFileSize)) { //Create video Information (MMRK) data VideoInformation video = CreateVideoInformationK28JobNode(file.Name, theAsset, AssetLocatorPath); manifestInfo.VideoInformation.Add(video); //Create SAS URL for each watermakerd copy MP4 CloudBlobClient assetBlobClient = GetAssetCopyBlobClient(theAsset); foreach (var code in manifestInfo.EnbebedCodes) { var wmp4Name = System.Web.HttpUtility.UrlPathEncode(video.FileName); code.MP4WatermarkedURL.Add(new MP4WatermarkedURL() { FileName = video.FileName, WaterMarkedMp4 = GetBlobSasUri(assetBlobClient, "watermarked", $"{manifestInfo.JobID}/{theAsset.Id}/{code.EmbebedCode}/{wmp4Name}", allAccess, _SASTTL) }); } } return(manifestInfo); }
public static async Task <HttpResponseMessage> SubmiteWaterMarkJob([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req, TraceWriter log, ExecutionContext context) { IActionsProvider myActions = ActionProviderFactory.GetActionProvider(); dynamic BodyData = await req.Content.ReadAsAsync <object>(); ManifestInfo manifest = BodyData.ToObject <ManifestInfo>(); int K8SJobAggregation = int.Parse(System.Configuration.ConfigurationManager.AppSettings["K8SJobAggregation"]); int K8SJobAggregationOnlyEmb = int.Parse(System.Configuration.ConfigurationManager.AppSettings["K8SJobAggregationOnlyEmb"] ?? "1"); try { //Get JOBList to Send to K8S cluster List <ManifestInfo> jobList = myActions.GetK8SManifestInfo(K8SJobAggregation, K8SJobAggregationOnlyEmb, manifest); //Sumbite to K8S cluster int jobSubId = 1; foreach (var job in jobList) { var ret = await myActions.SubmiteJobK8S(job, jobSubId); log.Info($"{job.VideoInformation.FirstOrDefault().FileName} CODE {ret.Code.ToString()}"); jobSubId += 1; if (!ret.IsSuccessStatusCode) { log.Error($"K8S Summition Error {ret.Code.ToString()} {ret.Content}"); throw new Exception($"K8S Summition Error {ret.Code.ToString()} {ret.Content}"); } } return(req.CreateResponse(HttpStatusCode.OK, jobList, JsonMediaTypeFormatter.DefaultMediaType)); } catch (Exception X) { return(req.CreateResponse(HttpStatusCode.InternalServerError, X, JsonMediaTypeFormatter.DefaultMediaType)); } }
public StreamSelectionManager(ManifestInfo ManifestInfo) { MaximumConcurrentRequests = 1; Timeout = TimeSpan.FromSeconds(15); _manifestInfo = ManifestInfo; _manifestInfo.SelectStreamsCompleted += ManifestInfo_SelectStreamsCompleted; }
bool UserMatchesFilters(ManifestInfo info) { return(FieldMatchesFilterGroup(info.Level, checkBoxLevelAsInvoker, checkBoxRequireAdministrator, checkBoxhHighestAvailable) && FieldMatchesFilterGroup(info.autoElevate, checkBoxAutoElevateFalse, checkBoxAutoElevateTrue) && FieldMatchesFilterGroup(info.dpiAware, checkBoxDpiAwareFalse, checkBoxDpiAwareTrue) // there are other types like "Explorer", "per monitor", ... // Can be classified to "others" && FieldMatchesFilterGroup(info.uiAccess, checkBoxUiAccessFalse, checkBoxUiAccessTrue)); }
private static void WriteHeader(XmlWriter writer, ManifestInfo manifestInfo, bool compressManifest) { int minorVersion = compressManifest ? (manifestInfo.MinorVersion < 2 ? 2 : manifestInfo.MinorVersion) : manifestInfo.MinorVersion; writer.WriteAttributeString("MajorVersion", manifestInfo.MajorVersion.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString("MinorVersion", minorVersion.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString("Duration", manifestInfo.ManifestDuration.ToString(CultureInfo.InvariantCulture)); }
public static void PullBaseImages(ManifestInfo manifest, Options options) { Utilities.WriteHeading("PULLING LATEST BASE IMAGES"); foreach (string fromImage in manifest.GetExternalFromImages()) { ExecuteHelper.ExecuteWithRetry("docker", $"pull {fromImage}", options.IsDryRun); } }
public async Task <ManifestInfo> GetK8SJobManifestAsync(string AssetID, string JobID, List <string> codes) { string AssetLocatorPath = ""; string EmbedderNotificationQueue = await CreateSharedAccessPolicyAsync("embeddernotification", JobID); string PreprocessorNotificationQueue = await CreateSharedAccessPolicyAsync("preprocessorout", JobID); ManifestInfo myData = new ManifestInfo { JobID = JobID, AssetID = AssetID, EmbedderNotificationQueue = EmbedderNotificationQueue, PreprocessorNotificationQueue = PreprocessorNotificationQueue, //Video information VideoInformation = new List <VideoInformation>(), //Enbebedcodes EnbebedCodes = new List <EnbebedCode>() }; foreach (var code in codes) { myData.EnbebedCodes.Add(new EnbebedCode() { EmbebedCode = code, MP4WatermarkedURL = new List <MP4WatermarkedURL>() }); } //AMS IAsset currentAsset = null; try { currentAsset = _mediaContext.Assets.Where(a => a.Id == AssetID).FirstOrDefault(); } catch (Exception X) { throw new Exception($"AssetID {AssetID} not found. Error: {X.Message}"); } var AssetLocator = currentAsset.Locators.Where(l => l.Type == LocatorType.OnDemandOrigin).FirstOrDefault(); if (AssetLocator == null) { //Use Blob SAS URL AssetLocatorPath = ""; } else { AssetLocatorPath = AssetLocator.Path; } IEnumerable <IAssetFile> mp4AssetFiles = currentAsset.AssetFiles.ToList().Where(af => af.Name.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase)).OrderBy(f => f.ContentFileSize); myData = GetManifest5Jobs(myData, /*AssetID*/ currentAsset, mp4AssetFiles, AssetLocatorPath); return(myData); }
//比对本地和服务器数据记录下需要更新的资源 IEnumerator ICheckAllBundles() { //获取服务器的AssetBundleManifest信息 ManifestInfo serverInfo = new ManifestInfo(); yield return(StartCoroutine(serverInfo.Init(RecsPathCtrl.GetIns().GetPathManifest(false)))); yield return(StartCoroutine(serverInfo.GetBundlesInfo())); //获取本地的AssetBundleManifest信息 ManifestInfo LocalInfo = new ManifestInfo(); yield return(StartCoroutine(LocalInfo.Init("file://" + RecsPathCtrl.GetIns().GetPathManifest(true)))); yield return(StartCoroutine(LocalInfo.GetBundlesInfo())); StringBuilder sb = new StringBuilder(); //开始比对信息 foreach (var key in serverInfo.dicBundlesInfo.Keys) { #region 存在性检查 //不存在该资源(根据AssetBundleManifest的记录是否存在 如果误删部分文件 但是AssetBundleManifest信息还是之前的 就没有意义) if (!LocalInfo.dicBundlesInfo.ContainsKey(key)) { //记录进更新资源列表 sb.AppendLine(key); continue; } //检查文件是否存在 if (!File.Exists(RecsPathCtrl.GetIns().RecsRootPathLocal + key)) { //记录进更新资源列表 sb.AppendLine(key); continue; } #endregion #region 一致性检查 //资源HashID不一致 if (!LocalInfo.dicBundlesInfo[key].Equals(serverInfo.dicBundlesInfo[key])) { //记录进更新资源列表 sb.AppendLine(key); } #endregion } //将更新资源列表写入文件 FileTool.WriteStringToFileByFileStream(RecsPathCtrl.GetIns().GetPathUpdateInfoFile(true), sb.ToString(), () => Log.LogAndSave("将资源更新列表写入文件" + RecsPathCtrl.GetIns().GetPathUpdateInfoFile(true)), Encoding.UTF8, false); yield return(null); }
private ISet <IExtensionInfo> HarvestExtensions() { var searchOptions = _extensionExpanderOptions.Options; var extensionSet = new HashSet <IExtensionInfo>(); if (searchOptions.Count == 0) { return(extensionSet); } foreach (var searchOption in searchOptions) { foreach (var subDirectory in _hostingEnvironment .ContentRootFileProvider .GetDirectoryContents(searchOption.SearchPath) .Where(x => x.IsDirectory)) { var manifestConfiguration = _manifestOptions .ManifestConfigurations .FirstOrDefault(mc => { return(File.Exists(Path.Combine(subDirectory.PhysicalPath, mc.ManifestFileName))); } ); if (manifestConfiguration == null) { continue; } var manifestsubPath = Path.Combine(searchOption.SearchPath, subDirectory.Name); var manifestFilesubPath = Path.Combine(manifestsubPath, manifestConfiguration.ManifestFileName); IConfigurationBuilder configurationBuilder = _manifestProvider.GetManifestConfiguration(new ConfigurationBuilder(), manifestFilesubPath); if (!configurationBuilder.Sources.Any()) { continue; } var configurationRoot = configurationBuilder.Build(); var manifestInfo = new ManifestInfo(configurationRoot, manifestConfiguration.Type); // Manifest tells you what your loading, subpath is where you are loading it var extensionInfo = _extensionProvider .GetExtensionInfo(manifestInfo, manifestsubPath); extensionSet.Add(extensionInfo); } } return(extensionSet); }
public void Load_Include_Repos() { const string includeManifestPath1 = "manifest.custom1.json"; const string includeManifestPath2 = "manifest.custom2.json"; string manifest = $@" {{ ""includes"": [ ""{includeManifestPath1}"", ""{includeManifestPath2}"" ] }}"; string includeManifest1 = $@" {{ ""repos"": [ {CreateRepo("testRepo1", s_dockerfilePath, "testTag1")}, {CreateRepo("testRepo2", s_dockerfilePath)} ] }}"; string includeManifest2 = $@" {{ ""repos"": [ {CreateRepo("testRepo1", s_dockerfilePath, "testTag2")}, {CreateRepo("testRepo3", s_dockerfilePath)} ] }}"; using TempFolderContext tempFolderContext = TestHelper.UseTempFolder(); string manifestPath = Path.Combine(tempFolderContext.Path, "manifest.json"); File.WriteAllText(manifestPath, manifest); File.WriteAllText(Path.Combine(tempFolderContext.Path, includeManifestPath1), includeManifest1); File.WriteAllText(Path.Combine(tempFolderContext.Path, includeManifestPath2), includeManifest2); DockerfileHelper.CreateDockerfile(s_dockerfilePath, tempFolderContext); IManifestOptionsInfo manifestOptions = ManifestHelper.GetManifestOptions(manifestPath); ManifestInfo manifestInfo = ManifestInfo.Load(manifestOptions); Assert.Equal(3, manifestInfo.Model.Repos.Length); Assert.Equal("testRepo1", manifestInfo.Model.Repos[0].Name); Assert.Equal("testRepo2", manifestInfo.Model.Repos[1].Name); Assert.Equal("testRepo3", manifestInfo.Model.Repos[2].Name); Assert.Equal(2, manifestInfo.Model.Repos[0].Images.Length); Assert.Equal(1, manifestInfo.Model.Repos[1].Images.Length); Assert.Equal(1, manifestInfo.Model.Repos[2].Images.Length); }
//----------------------------------------------------------- // マニフェストのダウンロードと展開を行う ※共通処理 private IEnumerator LoadManifestAsync_Private(ManifestInfo manifestInfo, Request request, bool isAll) { if (isAll == false) { m_IsAnyManifestLoading = true; } // 実際のダウンロードと展開を行う bool isCompleted = false; string error = string.Empty; yield return(StartCoroutine(manifestInfo.LoadAsync(() => { isCompleted = true; }, (_) => { error = _; }, this))); if (isCompleted = false || string.IsNullOrEmpty(error) == false) { // 失敗 if (isAll == false) { m_IsAnyManifestLoading = false; } if (string.IsNullOrEmpty(error) == true) { error = "Could not load."; } request.Error = error; yield break; } //---------------------------------------------------------- // マニフェストリストのタイムスタンプを更新する(排他的にする) yield return(new WaitWhile(() => m_Busy == true)); m_Busy = true; AddOrUpdateManifestToSystemFile(manifestInfo.ManifestName, GetClientTime()); SaveSystemFile(); UpdateManifestHash(); m_Busy = false; if (isAll == false) { m_IsAnyManifestLoading = false; } //---------------------------------------------------------- request.IsDone = true; }
public static string Execute(IGitService gitService, ManifestInfo manifest, RepoInfo repo, string sourceRepoUrl, string sourceBranch = null) { McrTagsMetadataGenerator generator = new McrTagsMetadataGenerator() { _gitService = gitService, _manifest = manifest, _repo = repo, _sourceRepoUrl = sourceRepoUrl, _sourceBranch = sourceBranch, }; return(generator.Execute()); }
private Task ExecuteAsync(string image, IConsole console) { ImageName imageName = ImageName.Parse(image); return(CommandHelper.ExecuteCommandAsync(console, imageName.Registry, async() => { using DockerRegistryClient.DockerRegistryClient client = await CommandHelper.GetRegistryClientAsync(imageName.Registry); ManifestInfo manifestInfo = await client.Manifests.GetAsync(imageName.Repo, (imageName.Tag ?? imageName.Digest) !); string output = JsonConvert.SerializeObject(manifestInfo.Manifest, Formatting.Indented); console.Out.WriteLine(output); }));
/// <summary> /// Loads image info string content as a parsed model. /// </summary> /// <param name="imageInfoContent">The image info content to load.</param> /// <param name="manifest">Representation of the manifest model.</param> /// <param name="skipManifestValidation"> /// Whether to skip validation if no associated manifest model item was found for a given image info model item. /// </param> /// <param name="useFilteredManifest">Whether to use the filtered content of the manifest for lookups.</param> public static ImageArtifactDetails LoadFromContent(string imageInfoContent, ManifestInfo manifest, bool skipManifestValidation = false, bool useFilteredManifest = false) { ImageArtifactDetails imageArtifactDetails = JsonConvert.DeserializeObject <ImageArtifactDetails>(imageInfoContent); foreach (RepoData repoData in imageArtifactDetails.Repos) { RepoInfo manifestRepo = (useFilteredManifest ? manifest.FilteredRepos : manifest.AllRepos) .FirstOrDefault(repo => repo.Name == repoData.Repo); if (manifestRepo == null) { Console.WriteLine($"Image info repo not loaded: {repoData.Repo}"); continue; } foreach (ImageData imageData in repoData.Images) { imageData.ManifestRepo = manifestRepo; foreach (PlatformData platformData in imageData.Platforms) { foreach (ImageInfo manifestImage in (useFilteredManifest ? manifestRepo.FilteredImages : manifestRepo.AllImages)) { PlatformInfo matchingManifestPlatform = (useFilteredManifest ? manifestImage.FilteredPlatforms : manifestImage.AllPlatforms) .FirstOrDefault(platform => ArePlatformsEqual(platformData, imageData, platform, manifestImage)); if (matchingManifestPlatform != null) { if (imageData.ManifestImage is null) { imageData.ManifestImage = manifestImage; } platformData.PlatformInfo = matchingManifestPlatform; platformData.ImageInfo = manifestImage; break; } } } PlatformData representativePlatform = imageData.Platforms.FirstOrDefault(); if (!skipManifestValidation && imageData.ManifestImage == null && representativePlatform != null) { throw new InvalidOperationException( $"Unable to find matching platform in manifest for platform '{representativePlatform.GetIdentifier()}'."); } } } return(imageArtifactDetails); }
public async Task <K8SResult> SubmiteJobK8S(ManifestInfo manifest, int subId) { //Create Yamal Job definition string manifesttxt = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); string jobbase64 = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(manifesttxt), Base64FormattingOptions.None); string imageName = System.Configuration.ConfigurationManager.AppSettings["imageName"]; string jobtxt = GetJobYmal(manifest.JobID + "-" + subId.ToString(), jobbase64, imageName); HttpContent ymal = new StringContent(jobtxt, Encoding.UTF8, "application/yaml"); // Submite JOB IK8SClient k8sClient = K8SClientFactory.Create(); var rs = await k8sClient.SubmiteK8SJob(ymal); return(rs); }
public override Uri MapUri(Uri uri) { string uriString = System.Net.HttpUtility.UrlDecode(uri.ToString()); if (uriString.StartsWith("/Protocol")) { AsyncHelpers.RunSync(() => AccountManager.Restore()); var module = (string)IsolatedStorageSettings.ApplicationSettings["module"]; var index = uriString.IndexOf(ManifestInfo.GetProtocol()); return(new Uri("/Plugins/org.jboss.aerogear.cordova.oauth2/P.xaml?" + uriString.Substring(uriString.IndexOf('?', index) + 1) + "&module=" + module, UriKind.Relative)); } return(uri); }
public void LoadManifest() { Utilities.WriteHeading("READING MANIFEST"); string manifestJson = File.ReadAllText(Options.Manifest); Manifest manifestModel = JsonConvert.DeserializeObject <Manifest>(manifestJson); manifestModel.Validate(); Manifest = ManifestInfo.Create( manifestModel, Options.GetManifestFilter(), (Options as DockerRegistryOptions)?.RepoOwner); Console.WriteLine(JsonConvert.SerializeObject(Manifest, Formatting.Indented)); }
public static void PullBaseImages(this IDockerService dockerService, ManifestInfo manifest, bool isDryRun) { Logger.WriteHeading("PULLING LATEST BASE IMAGES"); IEnumerable <string> baseImages = manifest.GetExternalFromImages().ToArray(); if (baseImages.Any()) { foreach (string fromImage in baseImages) { dockerService.PullImage(fromImage, isDryRun); } } else { Logger.WriteMessage("No external base images to pull"); } }
public static void PullBaseImages(ManifestInfo manifest, Options options) { Logger.WriteHeading("PULLING LATEST BASE IMAGES"); IEnumerable <string> baseImages = manifest.GetExternalFromImages().ToArray(); if (baseImages.Any()) { foreach (string fromImage in baseImages) { ExecuteHelper.ExecuteWithRetry("docker", $"pull {fromImage}", options.IsDryRun); } } else { Logger.WriteMessage("No external base images to pull"); } }
private async Task <IEnumerable <string> > GetPathsToRebuildAsync(Subscription subscription) { // If the command is filtered with an OS type that does not match the OsType filter of the subscription, // then there are no images that need to be inspected. string osTypeRegexPattern = ManifestFilter.GetFilterRegexPattern(Options.FilterOptions.OsType); if (!string.IsNullOrEmpty(subscription.OsType) && !Regex.IsMatch(subscription.OsType, osTypeRegexPattern, RegexOptions.IgnoreCase)) { return(Enumerable.Empty <string>()); } _loggerService.WriteMessage($"Processing subscription: {subscription.Id}"); string repoPath = await GetGitRepoPath(subscription); TempManifestOptions manifestOptions = new TempManifestOptions(Options.FilterOptions) { Manifest = Path.Combine(repoPath, subscription.Manifest.Path) }; ManifestInfo manifest = ManifestInfo.Load(manifestOptions); ImageArtifactDetails imageArtifactDetails = await GetImageInfoForSubscriptionAsync(subscription, manifest); List <string> pathsToRebuild = new List <string>(); IEnumerable <PlatformInfo> allPlatforms = manifest.GetAllPlatforms().ToList(); foreach (RepoInfo repo in manifest.FilteredRepos) { IEnumerable <PlatformInfo> platforms = repo.FilteredImages .SelectMany(image => image.FilteredPlatforms) .Where(platform => !platform.IsInternalFromImage(platform.FinalStageFromImage)); RepoData repoData = imageArtifactDetails.Repos .FirstOrDefault(s => s.Repo == repo.Name); foreach (PlatformInfo platform in platforms) { pathsToRebuild.AddRange(GetPathsToRebuild(allPlatforms, platform, repoData)); } } return(pathsToRebuild.Distinct().ToList()); }
private static async Task Main() { using var client = new HttpClient(); Console.WriteLine("Getting manifest info..."); await using var infoStream = await client.GetStreamAsync("https://cdn.notofficer.de/323685.json"); // ++Fortnite+Release-13.20-CL-13777676-Windows example var manifestInfo = new ManifestInfo(infoStream); Console.WriteLine("Downloading manifest..."); var manifestData = await manifestInfo.DownloadManifestDataAsync(); Console.WriteLine("Parsing manifest..."); var manfiest = new Manifest(manifestData, new ManifestOptions { ChunkBaseUri = new Uri("http://epicgames-download1.akamaized.net/Builds/Fortnite/CloudDir/ChunksV3/", UriKind.Absolute), //required for downloading (fortnite) ChunkCacheDirectory = Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "FortniteChunks")) // optional }); Console.WriteLine($"Manifest parsed in: {manfiest.ParseTime.TotalMilliseconds:0}ms"); var testPak = manfiest.FileManifests.Find(x => x.Name == "FortniteGame/Content/Paks/pakchunk1006-WindowsClient.pak"); await using var pakStream = testPak.GetStream(); using var sha1 = SHA1.Create(); Console.WriteLine("Downloading 24 MB pak & computing hash..."); var hash = sha1.ComputeHash(pakStream); var hashString = BitConverter.ToString(hash).Replace("-", null); Console.WriteLine("Result: {0} ({1} / {2})", testPak.Hash == hashString ? "match" : "different", hashString, testPak.Hash); Console.WriteLine(); Console.WriteLine("Running benchmark..."); var time = new TimeSpan(); const int runs = 50; for (var i = 0; i < runs; i++) { var m = new Manifest(manifestData); time += m.ParseTime; } var avg = time / runs; Console.WriteLine($"Parsed {runs} Manifests in: {time.TotalMilliseconds:0}ms ({avg.TotalMilliseconds:0}ms avg)"); }
public void LoadManifest() { Logger.WriteHeading("READING MANIFEST"); string manifestJson = File.ReadAllText(Options.Manifest); Manifest manifestModel = JsonConvert.DeserializeObject <Manifest>(manifestJson); manifestModel.Validate(); Manifest = ManifestInfo.Create( manifestModel, Options.GetManifestFilter(), Options); if (Options.IsVerbose) { Logger.WriteMessage(JsonConvert.SerializeObject(Manifest, Formatting.Indented)); } }
private ManifestInfo GetManifest5Jobs(ManifestInfo manifestInfo, string AssetID, IEnumerable <IAssetFile> mp4AssetFiles, string AssetLocatorPath) { foreach (var file in mp4AssetFiles.OrderBy(f => f.ContentFileSize)) { VideoInformation video = CreateVideoInformationK28JobNode(file.Name, AssetID, AssetLocatorPath); manifestInfo.VideoInformation.Add(video); //Watermarked foreach (var code in manifestInfo.EnbebedCodes) { var wmp4Name = System.Web.HttpUtility.UrlPathEncode(video.FileName); code.MP4WatermarkedURL.Add(new MP4WatermarkedURL() { FileName = video.FileName, WaterMarkedMp4 = GetBlobSasUri("watermarked", $"{AssetID}/{code.EmbebedCode}/{wmp4Name}") }); } } return(manifestInfo); }