init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
namespace Cef3
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Cef3.Interop;
|
||||
|
||||
/// <summary>
|
||||
/// Class used to represent a web response. The methods of this class may be
|
||||
/// called on any thread.
|
||||
/// </summary>
|
||||
public sealed unsafe partial class CefResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new CefResponse object.
|
||||
/// </summary>
|
||||
public static CefResponse Create()
|
||||
{
|
||||
return CefResponse.FromNative(
|
||||
cef_response_t.create()
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this object is read-only.
|
||||
/// </summary>
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return cef_response_t.is_read_only(_self) != 0; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the response status code.
|
||||
/// </summary>
|
||||
public int Status
|
||||
{
|
||||
get { return cef_response_t.get_status(_self); }
|
||||
set { cef_response_t.set_status(_self, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the response status text.
|
||||
/// </summary>
|
||||
public string StatusText
|
||||
{
|
||||
get
|
||||
{
|
||||
var n_result = cef_response_t.get_status_text(_self);
|
||||
return cef_string_userfree.ToString(n_result);
|
||||
}
|
||||
set
|
||||
{
|
||||
fixed (char* value_str = value)
|
||||
{
|
||||
var n_value = new cef_string_t(value_str, value != null ? value.Length : 0);
|
||||
cef_response_t.set_status_text(_self, &n_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the response mime type.
|
||||
/// </summary>
|
||||
public string MimeType
|
||||
{
|
||||
get
|
||||
{
|
||||
var n_result = cef_response_t.get_mime_type(_self);
|
||||
return cef_string_userfree.ToString(n_result);
|
||||
}
|
||||
set
|
||||
{
|
||||
fixed (char* value_str = value)
|
||||
{
|
||||
var n_value = new cef_string_t(value_str, value != null ? value.Length : 0);
|
||||
cef_response_t.set_mime_type(_self, &n_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the value for the specified response header field.
|
||||
/// </summary>
|
||||
public string GetHeader(string name)
|
||||
{
|
||||
if (name == null) throw new ArgumentNullException("name");
|
||||
|
||||
fixed (char* name_str = name)
|
||||
{
|
||||
var n_name = new cef_string_t(name_str, name.Length);
|
||||
var n_result = cef_response_t.get_header(_self, &n_name);
|
||||
return cef_string_userfree.ToString(n_result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all response header fields.
|
||||
/// </summary>
|
||||
public NameValueCollection GetHeaderMap()
|
||||
{
|
||||
var headerMap = libcef.string_multimap_alloc();
|
||||
cef_response_t.get_header_map(_self, headerMap);
|
||||
var result = cef_string_multimap.ToNameValueCollection(headerMap);
|
||||
libcef.string_multimap_free(headerMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set all response header fields.
|
||||
/// </summary>
|
||||
public void SetHeaderMap(NameValueCollection headers)
|
||||
{
|
||||
var headerMap = cef_string_multimap.From(headers);
|
||||
cef_response_t.set_header_map(_self, headerMap);
|
||||
libcef.string_multimap_free(headerMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user