1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-16 06:31:42 +02:00
Files
.github
.idea
bld
lib
TweetLib.Browser
TweetLib.Browser.CEF
Component
Data
ByteArrayResource.cs
ContextMenuActionRegistry.cs
DownloadCallbacks.cs
ResourceHandlerRegistry.cs
Dialogs
Interfaces
Logic
Utils
Lib.cs
TweetLib.Browser.CEF.csproj
TweetLib.Communication
TweetLib.Core
TweetLib.Utils
TweetTest.Browser.CEF
TweetTest.Core
TweetTest.Utils
linux
resources
windows
.gitattributes
.gitignore
LICENSE.md
README.md
TweetDuck.sln
TweetDuck.sln.DotSettings
Version.cs
global.json

27 lines
1.0 KiB
C#

using System.Net;
using System.Text;
namespace TweetLib.Browser.CEF.Data {
public sealed class ByteArrayResource {
private const string DefaultMimeType = "text/html";
private const HttpStatusCode DefaultStatusCode = HttpStatusCode.OK;
private const string DefaultStatusText = "OK";
internal byte[] Contents { get; }
internal int Length { get; }
internal string MimeType { get; }
internal HttpStatusCode StatusCode { get; }
internal string StatusText { get; }
public ByteArrayResource(byte[] contents, string mimeType = DefaultMimeType, HttpStatusCode statusCode = DefaultStatusCode, string statusText = DefaultStatusText) {
this.Contents = contents;
this.Length = contents.Length;
this.MimeType = mimeType;
this.StatusCode = statusCode;
this.StatusText = statusText;
}
public ByteArrayResource(string contents, Encoding encoding, string mimeType = DefaultMimeType, HttpStatusCode statusCode = DefaultStatusCode, string statusText = DefaultStatusText) : this(encoding.GetBytes(contents), mimeType, statusCode, statusText) {}
}
}