From 32da01c5ff73d73f2865528521e39a8e740596d7 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 10 May 2015 13:02:57 +0200 Subject: Drop optional parameters in BlobExtensions.cs --- LibGit2Sharp/BlobExtensions.cs | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/LibGit2Sharp/BlobExtensions.cs b/LibGit2Sharp/BlobExtensions.cs index 0b38c32f..7dade3ce 100644 --- a/LibGit2Sharp/BlobExtensions.cs +++ b/LibGit2Sharp/BlobExtensions.cs @@ -9,21 +9,44 @@ namespace LibGit2Sharp /// public static class BlobExtensions { + /// + /// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected from the byte order mark + /// + /// The blob for which the content will be returned. + /// Blob content as text. + public static string GetContentText(this Blob blob) + { + Ensure.ArgumentNotNull(blob, "blob"); + + return ReadToEnd(blob.GetContentStream(), null); + } + /// /// Gets the blob content decoded with the specified encoding, - /// or according to byte order marks, with UTF8 as fallback, - /// if is null. + /// or according to byte order marks, or the specified encoding as a fallback /// /// The blob for which the content will be returned. - /// The encoding of the text. (default: detected or UTF8) + /// The encoding of the text to use, if it cannot be detected /// Blob content as text. - public static string GetContentText(this Blob blob, Encoding encoding = null) + public static string GetContentText(this Blob blob, Encoding encoding) { Ensure.ArgumentNotNull(blob, "blob"); + Ensure.ArgumentNotNull(encoding, "encoding"); return ReadToEnd(blob.GetContentStream(), encoding); } + /// + /// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected + /// + /// The blob for which the content will be returned. + /// Parameter controlling content filtering behavior + /// Blob content as text. + public static string GetContentText(this Blob blob, FilteringOptions filteringOptions) + { + return blob.GetContentText(filteringOptions, null); + } + /// /// Gets the blob content as it would be checked out to the /// working directory, decoded with the specified encoding, @@ -34,7 +57,7 @@ namespace LibGit2Sharp /// Parameter controlling content filtering behavior /// The encoding of the text. (default: detected or UTF8) /// Blob content as text. - public static string GetContentText(this Blob blob, FilteringOptions filteringOptions, Encoding encoding = null) + public static string GetContentText(this Blob blob, FilteringOptions filteringOptions, Encoding encoding) { Ensure.ArgumentNotNull(blob, "blob"); Ensure.ArgumentNotNull(filteringOptions, "filteringOptions"); -- cgit v1.2.3