Example #1
0
        public static string MapPath(string virtualPath)
        {
            virtualPath = RemovePathInvalidChar(virtualPath);
            string retVal;

            if (!string.IsNullOrEmpty(virtualPath))
            {
                if (virtualPath.StartsWith("~"))
                {
                    virtualPath = virtualPath.Substring(1);
                }
                virtualPath = PageUtils.Combine("~", virtualPath);
            }
            else
            {
                virtualPath = "~/";
            }
            if (HttpContext.Current != null)
            {
                retVal = HttpContext.Current.Server.MapPath(virtualPath);
            }
            else
            {
                var rootPath = WebConfigUtils.PhysicalApplicationPath;

                virtualPath = !string.IsNullOrEmpty(virtualPath) ? virtualPath.Substring(2) : string.Empty;
                retVal      = Combine(rootPath, virtualPath);
            }

            if (retVal == null)
            {
                retVal = string.Empty;
            }
            return(retVal.Replace("/", "\\"));
        }
Example #2
0
        public static string GetUrl(string apiUrl, string relatedUrl)
        {
            if (string.IsNullOrEmpty(apiUrl))
            {
                apiUrl = "/api";
            }
            apiUrl = apiUrl.Trim().ToLower();

            if (apiUrl == "/api")
            {
                apiUrl = "/";
            }
            else if (apiUrl.EndsWith("/api"))
            {
                apiUrl = apiUrl.Substring(0, apiUrl.LastIndexOf("/api", StringComparison.Ordinal));
            }
            else if (apiUrl.EndsWith("/api/"))
            {
                apiUrl = apiUrl.Substring(0, apiUrl.LastIndexOf("/api/", StringComparison.Ordinal));
            }
            if (string.IsNullOrEmpty(apiUrl))
            {
                apiUrl = "/";
            }
            return(PageUtils.Combine(apiUrl, "sitefiles/assets", relatedUrl));
        }
Example #3
0
        private DirectoryTreeItem()
        {
            var treeDirectoryUrl = SiteServerAssets.GetIconUrl("tree");

            iconFolderUrl       = PageUtils.Combine(treeDirectoryUrl, "folder.gif");
            iconOpenedFolderUrl = PageUtils.Combine(treeDirectoryUrl, "openedfolder.gif");
            iconEmptyUrl        = PageUtils.Combine(treeDirectoryUrl, "empty.gif");
            iconMinusUrl        = PageUtils.Combine(treeDirectoryUrl, "minus.png");
            iconPlusUrl         = PageUtils.Combine(treeDirectoryUrl, "plus.png");
        }
Example #4
0
 public static string GetUrl(string relatedUrl)
 {
     return(PageUtils.Combine(PageUtils.GetAdminUrl(DirectoryName), relatedUrl));
 }
Example #5
0
 public static string GetIconUrl(string iconName)
 {
     return(GetUrl(PageUtils.Combine(DirectoryIcons, iconName)));
 }