mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
Reflection abstractions to reduce code duplication
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Octokit
|
||||
@@ -31,6 +32,17 @@ namespace Octokit
|
||||
return System.Net.WebUtility.UrlEncode(input);
|
||||
}
|
||||
|
||||
public static string ToBase64String(this string input)
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(input));
|
||||
}
|
||||
|
||||
public static string FromBase64String(this string encoded)
|
||||
{
|
||||
var decodedBytes = Convert.FromBase64String(encoded);
|
||||
return Encoding.UTF8.GetString(decodedBytes, 0, decodedBytes.Length);
|
||||
}
|
||||
|
||||
static readonly Regex _optionalQueryStringRegex = new Regex("\\{\\?([^}]+)\\}");
|
||||
public static Uri ExpandUriTemplate(this string template, object values)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user