예제 #1
0
 public AssetCatalog(string path, string authorId)
 {
     if (Path.GetExtension(path) != ".xcassets")
     {
         throw new Exception("Asset catalogs must have xcassets extension");
     }
     m_Root = new AssetFolder(path, null, authorId);
 }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }