mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 03:32:37 +00:00
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using System.Collections.Specialized;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace CefSharp
|
|
{
|
|
public class ResourceHandler
|
|
{
|
|
public string MimeType { get; set; }
|
|
public Stream Stream { get; set; }
|
|
public int StatusCode { get; set; }
|
|
public string StatusText { get; set; }
|
|
public NameValueCollection Headers { get; set; }
|
|
|
|
public ResourceHandler()
|
|
{
|
|
StatusCode = 200;
|
|
StatusText = "OK";
|
|
MimeType = "text/html";
|
|
}
|
|
|
|
public static ResourceHandler FromFileName(string fileName)
|
|
{
|
|
return new ResourceHandler { Stream = File.OpenRead(fileName) };
|
|
}
|
|
|
|
public static ResourceHandler FromString(string text)
|
|
{
|
|
return new ResourceHandler { Stream = new MemoryStream(Encoding.UTF8.GetBytes(text)) };
|
|
}
|
|
}
|
|
}
|