Пример #1
0
        public string GetWebUrl(IVirtualFileItem item)
        {
            item.ThrowIfNull("item");

            if (item.FileSystem != this)
            {
                return item.FileSystem.GetWebUrl(item);
            }

            if (!string.IsNullOrEmpty(this.RootWebUrl))
            {
                UrlBuilder builder = new UrlBuilder(this.RootWebUrl);

                var relativePath = item.RelativePath;
                var rootFolderPath = this.rootFolderName + "/";
                if (relativePath.StartsWith(rootFolderPath, StringComparison.OrdinalIgnoreCase) || relativePath.StartsWith("/" + rootFolderPath, StringComparison.OrdinalIgnoreCase))
                {
                    relativePath = relativePath.ReplaceFirst(rootFolderPath, string.Empty);
                }

                builder.AppendUrl(relativePath);

                return builder.ToString();
            }

            return string.Empty;
        }