Esempio n. 1
0
        public IEnumerable <Element> GetElements(Path packagePath, bool recursive = false)
        {
            if (_elementsByPath.ContainsKey(packagePath))
            {
                return(_elementsByPath[packagePath]);
            }
            var file = FileNames.GetElementsByPackage(_folder, packagePath);

            if (file.Exists())
            {
                var elementList = _jsonSerializer.Value.DeserializeFromFile <List <Element> >(file.AbsolutePath);
                return(_elementsByPath[packagePath] = elementList);
            }
            return(null);
        }
Esempio n. 2
0
        public IEnumerable <Element> GetElements(Path packagePath, bool recursive)
        {
            EA.Package package = GetPackage(packagePath);

            IEnumerable <Element> elements = null;

            if (recursive)
            {
                var p = FromEaPackage(package);
                elements = p.GetElementsRecursively();
            }
            else
            {
                elements = package.Elements
                           .Cast <EA.Element>()
                           .Select(CreateElement);
            }
            var file = FileNames.GetElementsByPackage(_folder, packagePath);

            _jsonSerializer.Value.SerializeToFile(elements, file.AbsolutePath);
            return(elements);
        }