/// <summary> /// Set the |value| associated with preference |name|. Returns true (1) if the /// value is set successfully and false (0) otherwise. If |value| is NULL the /// preference will be restored to its default value. If setting the preference /// fails then |error| will be populated with a detailed description of the /// problem. This function must be called on the browser process UI thread. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_request_context_capi.h">cef/include/capi/cef_request_context_capi.h</see>. /// </remarks> public bool SetPreference(string name, CfxValue value, ref string error) { var name_pinned = new PinnedString(name); var error_pinned = new PinnedString(error); IntPtr error_str = error_pinned.Obj.PinnedPtr; int error_length = error_pinned.Length; var __retval = CfxApi.cfx_request_context_set_preference(NativePtr, name_pinned.Obj.PinnedPtr, name_pinned.Length, CfxValue.Unwrap(value), ref error_str, ref error_length); name_pinned.Obj.Free(); if (error_str != error_pinned.Obj.PinnedPtr) { if (error_length > 0) { error = System.Runtime.InteropServices.Marshal.PtrToStringUni(error_str, error_length); // free the native string? } else { error = null; } } error_pinned.Obj.Free(); return(0 != __retval); }
/// <summary> /// Generates a JSON string from the specified root |node| which should be a /// dictionary or list value. Returns an NULL string on failure. This function /// requires exclusive access to |node| including any underlying data. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_parser_capi.h">cef/include/capi/cef_parser_capi.h</see>. /// </remarks> public static string WriteJson(CfxValue node, CfxJsonWriterOptions options) { return(StringFunctions.ConvertStringUserfree(CfxApi.cfx_write_json(CfxValue.Unwrap(node), (int)options))); }
/// <summary> /// Sets the value at the specified index. Returns true (1) if the value was /// set successfully. If |value| represents simple data then the underlying /// data will be copied and modifications to |value| will not modify this /// object. If |value| represents complex data (binary, dictionary or list) /// then the underlying data will be referenced and modifications to |value| /// will modify this object. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>. /// </remarks> public bool SetValue(int index, CfxValue value) { return(0 != CfxApi.cfx_list_value_set_value(NativePtr, index, CfxValue.Unwrap(value))); }
/// <summary> /// Returns true (1) if this object and |that| object have an equivalent /// underlying value but are not necessarily the same object. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>. /// </remarks> public bool IsEqual(CfxValue that) { return(0 != CfxApi.cfx_value_is_equal(NativePtr, CfxValue.Unwrap(that))); }
/// <summary> /// Returns true (1) if this object and |that| object have the same underlying /// data. If true (1) modifications to this object will also affect |that| /// object and vice-versa. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>. /// </remarks> public bool IsSame(CfxValue that) { return(0 != CfxApi.cfx_value_is_same(NativePtr, CfxValue.Unwrap(that))); }
/// <summary> /// Sets the value at the specified key. Returns true (1) if the value was set /// successfully. If |value| represents simple data then the underlying data /// will be copied and modifications to |value| will not modify this object. If /// |value| represents complex data (binary, dictionary or list) then the /// underlying data will be referenced and modifications to |value| will modify /// this object. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>. /// </remarks> public bool SetValue(string key, CfxValue value) { var key_pinned = new PinnedString(key); var __retval = CfxApi.DictionaryValue.cfx_dictionary_value_set_value(NativePtr, key_pinned.Obj.PinnedPtr, key_pinned.Length, CfxValue.Unwrap(value)); key_pinned.Obj.Free(); return(0 != __retval); }
/// <summary> /// Sets the value at the specified index. Returns true (1) if the value was /// set successfully. If |value| represents simple data then the underlying /// data will be copied and modifications to |value| will not modify this /// object. If |value| represents complex data (binary, dictionary or list) /// then the underlying data will be referenced and modifications to |value| /// will modify this object. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_values_capi.h">cef/include/capi/cef_values_capi.h</see>. /// </remarks> public bool SetValue(ulong index, CfxValue value) { return(0 != CfxApi.ListValue.cfx_list_value_set_value(NativePtr, (UIntPtr)index, CfxValue.Unwrap(value))); }