Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Forster <brendan@github.com>2015-05-10 14:02:57 +0300
committernulltoken <emeric.fermas@gmail.com>2015-05-15 20:31:46 +0300
commit32da01c5ff73d73f2865528521e39a8e740596d7 (patch)
tree03b7c5dd2353a9cc6482b81f36ba0ea7bfe081ba
parent40bbf1e496b512537aa8a7928a2e133f21e7351c (diff)
Drop optional parameters in BlobExtensions.cs
-rw-r--r--LibGit2Sharp/BlobExtensions.cs33
1 files 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
@@ -10,21 +10,44 @@ namespace LibGit2Sharp
public static class BlobExtensions
{
/// <summary>
+ /// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected from the byte order mark
+ /// </summary>
+ /// <param name="blob">The blob for which the content will be returned.</param>
+ /// <returns>Blob content as text.</returns>
+ public static string GetContentText(this Blob blob)
+ {
+ Ensure.ArgumentNotNull(blob, "blob");
+
+ return ReadToEnd(blob.GetContentStream(), null);
+ }
+
+ /// <summary>
/// Gets the blob content decoded with the specified encoding,
- /// or according to byte order marks, with UTF8 as fallback,
- /// if <paramref name="encoding"/> is null.
+ /// or according to byte order marks, or the specified encoding as a fallback
/// </summary>
/// <param name="blob">The blob for which the content will be returned.</param>
- /// <param name="encoding">The encoding of the text. (default: detected or UTF8)</param>
+ /// <param name="encoding">The encoding of the text to use, if it cannot be detected</param>
/// <returns>Blob content as text.</returns>
- 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);
}
/// <summary>
+ /// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected
+ /// </summary>
+ /// <param name="blob">The blob for which the content will be returned.</param>
+ /// <param name="filteringOptions">Parameter controlling content filtering behavior</param>
+ /// <returns>Blob content as text.</returns>
+ public static string GetContentText(this Blob blob, FilteringOptions filteringOptions)
+ {
+ return blob.GetContentText(filteringOptions, null);
+ }
+
+ /// <summary>
/// Gets the blob content as it would be checked out to the
/// working directory, decoded with the specified encoding,
/// or according to byte order marks, with UTF8 as fallback,
@@ -34,7 +57,7 @@ namespace LibGit2Sharp
/// <param name="filteringOptions">Parameter controlling content filtering behavior</param>
/// <param name="encoding">The encoding of the text. (default: detected or UTF8)</param>
/// <returns>Blob content as text.</returns>
- 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");