Beispiel #1
0
        public Package GetElementsByPackage(Path path)
        {
            File file = FileNames.GetPackage(_folder, path);

            if (file.Exists())
            {
                Package package;
                try
                {
                    package = _jsonSerializer.Value.DeserializeFromFile <Package>(file.AbsolutePath);
                }
                catch (JsonReaderException jre)
                {
                    return(null);
                }
                return(package);
            }
            return(null);
        }
Beispiel #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);
        }
Beispiel #3
0
        public bool IsValidPackagePath(Path packagePath, IFolder imageFolder)
        {
            File file = FileNames.GetPackage(_folder, packagePath);

            return(file.Exists());
        }