Changed the ResourceHandler constructor overload taking a stream to a method FromStream instead to make it more consistent with existing methods.

This commit is contained in:
MantisCore
2014-12-27 12:22:16 +01:00
parent eabfcff3fe
commit 1cc6ab2f5e
+21 -25
View File
@@ -62,31 +62,6 @@ namespace CefSharp
MimeType = mimeType;
}
/// <summary>
/// Initializes a new instance of the <see cref="ResourceHandler"/> class.
/// </summary>
/// <param name="stream">A stream of the resource.</param>
public ResourceHandler(Stream stream)
{
StatusCode = 200;
StatusText = "OK";
MimeType = "text/html";
Stream = stream;
}
/// <summary>
/// Initializes a new instance of the <see cref="ResourceHandler"/> class.
/// </summary>
/// <param name="stream">A stream of the resource.</param>
/// <param name="mimeType">Type of MIME.</param>
public ResourceHandler(Stream stream, string mimeType)
{
StatusCode = 200;
StatusText = "OK";
MimeType = mimeType;
Stream = stream;
}
/// <summary>
/// Gets the resource from the file.
/// </summary>
@@ -144,6 +119,27 @@ namespace CefSharp
return new ResourceHandler { Stream = GetStream(text, encoding, includePreamble) };
}
/// <summary>
/// Gets the resource from a stream.
/// </summary>
/// <param name="stream">A stream of the resource.</param>
/// <returns></returns>
public static ResourceHandler FromStream(Stream stream)
{
return new ResourceHandler() { Stream = stream };
}
/// <summary>
/// Gets the resource from a stream.
/// </summary>
/// <param name="stream">A stream of the resource.</param>
/// <param name="mimeType">Type of MIME.</param>
/// <returns></returns>
public static ResourceHandler FromStream(Stream stream, string mimeType)
{
return new ResourceHandler(mimeType) { Stream = stream };
}
private static MemoryStream GetStream(string text, Encoding encoding, bool includePreamble)
{
if (includePreamble)