示例#1
0
        static IFigmaDocumentContainer GetFigmaDialogFromResponse(FigmaResponse figmaResponse, string viewName = null, string nodeName = null)
        {
            var resultNodes = new List <FigmaNode> ();

            FigmaNode[] figmaNodes = figmaResponse.document.children;

            if (!string.IsNullOrEmpty(nodeName))
            {
                figmaNodes.Recursively(nodeName, resultNodes);
                var figmaFrame = (FigmaFrameEntity)resultNodes.FirstOrDefault();
                if (figmaFrame == null)
                {
                    return(null);
                }
                figmaNodes = figmaFrame.children;
                resultNodes.Clear();
            }

            if (string.IsNullOrEmpty(viewName))
            {
                return(figmaNodes.FirstOrDefault() as IFigmaDocumentContainer);
            }

            figmaNodes.Recursively(viewName, resultNodes);
            if (resultNodes.Count == 0)
            {
                return(null);
            }

            return(resultNodes.FirstOrDefault() as IFigmaDocumentContainer);
        }
示例#2
0
        public static void SetFigmaResponseFromContent(FigmaResponse figmaResponse, string filePath)
        {
            var data = JsonConvert.SerializeObject(figmaResponse);

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            File.WriteAllText(filePath, data);
        }
示例#3
0
 public void SetFigmaResponseFromContent(FigmaResponse figmaResponse, string filePath) =>
 FigmaApiHelper.SetFigmaResponseFromContent(figmaResponse, filePath);
示例#4
0
 public FigmaFrameEntityResponse(FigmaResponse figmaResponse, int page)
 {
     Page          = page;
     FigmaResponse = figmaResponse;
 }