mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 19:54:53 +00:00
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:
+21
-25
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user