public AssetCatalog(string path, string authorId)
 {
     if (Path.GetExtension(path) != ".xcassets")
     {
         throw new Exception("Asset catalogs must have xcassets extension");
     }
     this.m_Root = new AssetFolder(path, null, authorId);
 }
Example #2
0
        public AssetFolder OpenNamespacedFolder(string relativeBasePath, string namespacePath)
        {
            AssetFolder assetFolder = this.OpenFolder(relativeBasePath);

            foreach (string name in PBXPath.Split(namespacePath))
            {
                assetFolder = assetFolder.OpenFolder(name);
                assetFolder.providesNamespace = true;
            }
            return(assetFolder);
        }
        public AssetFolder OpenNamespacedFolder(string relativeBasePath, string namespacePath)
        {
            AssetFolder folder = this.OpenFolder(relativeBasePath);

            string[] strArray = PBXPath.Split(namespacePath);
            foreach (string str in strArray)
            {
                folder = folder.OpenFolder(str);
                folder.providesNamespace = true;
            }
            return(folder);
        }
        private AssetFolder OpenFolderForResource(string relativePath)
        {
            List <string> list = PBXPath.Split(relativePath).ToList <string>();

            list.RemoveAt(list.Count - 1);
            AssetFolder root = this.root;

            foreach (string str in list)
            {
                root = root.OpenFolder(str);
            }
            return(root);
        }
Example #5
0
        private AssetFolder OpenFolderForResource(string relativePath)
        {
            List <string> list = Enumerable.ToList <string>((IEnumerable <string>)PBXPath.Split(relativePath));

            list.RemoveAt(list.Count - 1);
            AssetFolder assetFolder = this.root;

            foreach (string name in list)
            {
                assetFolder = assetFolder.OpenFolder(name);
            }
            return(assetFolder);
        }
Example #6
0
        AssetFolder OpenFolderForResource(string relativePath)
        {
            var pathItems = PBX.Utils.SplitPath(relativePath).ToList();

            // remove path filename
            pathItems.RemoveAt(pathItems.Count - 1);

            AssetFolder folder = root;

            foreach (var pathItem in pathItems)
            {
                folder = folder.OpenFolder(pathItem);
            }
            return(folder);
        }
Example #7
0
        public AssetFolder OpenFolder(string name)
        {
            AssetCatalogItem child = this.GetChild(name);

            if (child != null)
            {
                if (child is AssetFolder)
                {
                    return(child as AssetFolder);
                }
                throw new Exception("The given path is already occupied with an asset");
            }
            AssetFolder assetFolder = new AssetFolder(this.m_Path, name, this.authorId);

            this.m_Items.Add((AssetCatalogItem)assetFolder);
            return(assetFolder);
        }
Example #8
0
        public AssetFolder OpenFolder(string name)
        {
            AssetCatalogItem child = this.GetChild(name);

            if (child != null)
            {
                if (!(child is AssetFolder))
                {
                    throw new Exception("The given path is already occupied with an asset");
                }
                return(child as AssetFolder);
            }
            AssetFolder item = new AssetFolder(base.m_Path, name, base.authorId);

            this.m_Items.Add(item);
            return(item);
        }
Example #9
0
        // Checks if a folder with given name exists and returns it if it does.
        // Otherwise, creates a new folder.
        public AssetFolder OpenFolder(string name)
        {
            var item = GetChild(name);

            if (item != null)
            {
                if (item is AssetFolder)
                {
                    return(item as AssetFolder);
                }
                throw new Exception("The given path is already occupied with an asset");
            }

            var folder = new AssetFolder(m_Path, name, authorId);

            m_Items.Add(folder);
            return(folder);
        }
Example #10
0
        public AssetFolder OpenFolder(string relativePath)
        {
            if (relativePath == null)
            {
                return(this.root);
            }
            string[] strArray = PBXPath.Split(relativePath);
            if (strArray.Length == 0)
            {
                return(this.root);
            }
            AssetFolder root = this.root;

            foreach (string str in strArray)
            {
                root = root.OpenFolder(str);
            }
            return(root);
        }
Example #11
0
        public AssetFolder OpenFolder(string relativePath)
        {
            if (relativePath == null)
            {
                return(this.root);
            }
            string[] strArray = PBXPath.Split(relativePath);
            if (strArray.Length == 0)
            {
                return(this.root);
            }
            AssetFolder assetFolder = this.root;

            foreach (string name in strArray)
            {
                assetFolder = assetFolder.OpenFolder(name);
            }
            return(assetFolder);
        }
Example #12
0
        // Checks if a folder with given path exists and returns it if it does.
        // Otherwise, creates a new folder. Parent folders are created if needed.
        public AssetFolder OpenFolder(string relativePath)
        {
            if (relativePath == null)
            {
                return(root);
            }
            var pathItems = PBX.Utils.SplitPath(relativePath);

            if (pathItems.Length == 0)
            {
                return(root);
            }
            AssetFolder folder = root;

            foreach (var pathItem in pathItems)
            {
                folder = folder.OpenFolder(pathItem);
            }
            return(folder);
        }