private List GetScreenList()

in Tools/Core/Microsoft.PowerApps.Tools.AppChangeManager/ChangeManager.cs [280:318]


        private List<Entity> GetScreenList(string filePath, string[] controlTypes)
        {
            if (controlTypes == null)
            {
                throw new Exception("Invalid Input parameter, ControlTypes can't be null");
            }

            var fileName = GetFileName(filePath);
            var extension = Path.GetExtension(filePath);
            var guid = new Guid();
            var tempPath = $"{Path.GetTempPath()}{ fileName}_{guid}";

            Utility.ExtactApp(filePath, tempPath);

            var controls = Directory.GetFiles(Path.Combine(tempPath, "Controls"));

            JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings()
            {
                Error = (se, ev) => {
                    ev.ErrorContext.Handled = true;
                }
            };

            var entities = new List<Entity>();

            foreach (var control in controls)
            {
                var controlData = File.ReadAllText(control);
                var entityData = JsonConvert.DeserializeObject<EntityData>(controlData, jsonSerializerSettings);
                var entity = entityData.TopParent;
                entities.Add(entity);
            }

            var screenList = entities?
                .Where(e => controlTypes.Contains(e.Template?.Name))
                .Select(r => r);

            return screenList?.ToList();
        }