-
Notifications
You must be signed in to change notification settings - Fork 5
/
Extensions.cs
26 lines (23 loc) · 929 Bytes
/
Extensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Microsoft.TeamFoundation.Framework.Server;
using System;
namespace GitPushFilter
{
public static class Extensions
{
public static bool SameAs(this string lhs, string rhs)
{
return lhs == "*" || rhs == "*" || string.Compare(lhs, rhs, true) == 0;
}
public static string DisplayHash(this byte[] b, int numDigits = 5)
{
return String.Join(String.Empty,
Array.ConvertAll(b, x => x.ToString("x2")))
.Substring(0, numDigits);
}
public static string GetCollectionUri(this TeamFoundationRequestContext requestContext)
{
TeamFoundationLocationService service = requestContext.GetService<TeamFoundationLocationService>();
return service.GetHostLocation(requestContext, service.GetPublicAccessMapping(requestContext, service.CurrentServiceOwner));
}
}
}