NuGet.UriUtility.GetPath C# (CSharp) Method

GetPath() static private method

Converts a uri to a path. Only used for local paths.
static private GetPath ( Uri uri ) : string
uri System.Uri
return string
        internal static string GetPath(Uri uri)
        {
            string path = uri.OriginalString;
            if (path.StartsWith("/", StringComparison.Ordinal))
            {
                path = path.Substring(1);
            }

            // Bug 483: We need the unescaped uri string to ensure that all characters are valid for a path.
            // Change the direction of the slashes to match the filesystem.
            return Uri.UnescapeDataString(path.Replace('/', Path.DirectorySeparatorChar));
        }

Usage Example

Exemplo n.º 1
0
        internal static bool IsPackageFile(PackagePart part)
        {
            string path      = UriUtility.GetPath(part.Uri);
            string directory = Path.GetDirectoryName(path);

            return(!Enumerable.Any <string>(ExcludePaths, p => directory.StartsWith(p, StringComparison.OrdinalIgnoreCase)) && !PackageHelper.IsManifest(path));
        }
All Usage Examples Of NuGet.UriUtility::GetPath