//Generates all the resources from the current .figmafile internal static void GenerateOutputResourceFiles(NodeProvider provider, string fileId, string resourcesDirectoryPath) { var figmaImageIds = new List <IImageNodeRequest>(); foreach (var mainNode in provider.Response.document.children) { figmaImageIds.AddRange(provider.SearchImageNodes(mainNode) .Select(s => provider.CreateEmptyImageNodeRequest(s))); } //var mainNode = figmaResponse.document.children.FirstOrDefault (); if (figmaImageIds.Count > 0) { if (!Directory.Exists(resourcesDirectoryPath)) { Directory.CreateDirectory(resourcesDirectoryPath); } var downloadImages = figmaImageIds.ToArray(); //2 scales foreach (var scale in new int[] { 1, 2 }) { AppContext.Api.ProcessDownloadImages(fileId, downloadImages, scale: scale); } provider.SaveResourceFiles(resourcesDirectoryPath, ImageFormat, downloadImages); } }