Exemplo n.º 1
0
        public static IAsset FindAsset(this IAssetsFolder folder, ILocation path)
        {
            if (!path.IsFile())
            {
                throw new BaseUserMessageException("Location is not a file");
            }

            var fileName = path.FileName;

            var curFolder = folder.FindFolder(path);

            var asset = curFolder.Assets.FirstOrDefault(a => string.Equals(a.FileName, fileName));

            if (asset == null)
            {
                throw new AssetNotFoundException(curFolder, fileName);
            }

            return(asset);
        }
Exemplo n.º 2
0
        private IAssetsFolder FindSnippetFolder(ISite site, IPage page, ref string snipLoc)
        {
            IAssetsFolder snippetsBaseFolder = null;

            if (snipLoc.StartsWith(SNIPPETS_FOLDER_PATH))
            {
                if (m_SnippetsFolder == null)
                {
                    throw new PluginUserMessageException("Snippets folder is not set");
                }

                snipLoc            = snipLoc.TrimStart(SNIPPETS_FOLDER_PATH);
                snippetsBaseFolder = m_SnippetsFolder;
            }
            else
            {
                snippetsBaseFolder = AssetsHelper.GetBaseFolder(site, page, PluginLocation.FromPath(snipLoc));
            }

            return(snippetsBaseFolder.FindFolder(PluginLocation.FromPath(snipLoc)));
        }