示例#1
0
        /// <summary>
        /// Parses the specified |jsonString| and returns a dictionary or list
        /// representation. If JSON parsing fails this function returns NULL and
        /// populates |errorCodeOut| and |errorMsgOut| with an error code and a
        /// formatted error message respectively.
        /// </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 CfxValue ParseJsonAndReturnError(string jsonString, CfxJsonParserOptions options, out CfxJsonParserError errorCodeOut, ref string errorMsgOut)
        {
            var    jsonString_pinned = new PinnedString(jsonString);
            int    errorCodeOut_tmp;
            var    errorMsgOut_pinned = new PinnedString(errorMsgOut);
            IntPtr errorMsgOut_str    = errorMsgOut_pinned.Obj.PinnedPtr;
            int    errorMsgOut_length = errorMsgOut_pinned.Length;
            var    __retval           = CfxApi.cfx_parse_jsonand_return_error(jsonString_pinned.Obj.PinnedPtr, jsonString_pinned.Length, (int)options, out errorCodeOut_tmp, ref errorMsgOut_str, ref errorMsgOut_length);

            jsonString_pinned.Obj.Free();
            errorCodeOut = (CfxJsonParserError)errorCodeOut_tmp;
            if (errorMsgOut_str != errorMsgOut_pinned.Obj.PinnedPtr)
            {
                if (errorMsgOut_length > 0)
                {
                    errorMsgOut = System.Runtime.InteropServices.Marshal.PtrToStringUni(errorMsgOut_str, errorMsgOut_length);
                    // free the native string?
                }
                else
                {
                    errorMsgOut = null;
                }
            }
            errorMsgOut_pinned.Obj.Free();
            return(CfxValue.Wrap(__retval));
        }
示例#2
0
        /// <summary>
        /// Returns the value for the preference with the specified |name|. Returns
        /// NULL if the preference does not exist. The returned object contains a copy
        /// of the underlying preference value and modifications to the returned object
        /// will not modify the underlying preference value. 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 CfxValue GetPreference(string name)
        {
            var name_pinned = new PinnedString(name);
            var __retval    = CfxApi.cfx_request_context_get_preference(NativePtr, name_pinned.Obj.PinnedPtr, name_pinned.Length);

            name_pinned.Obj.Free();
            return(CfxValue.Wrap(__retval));
        }
示例#3
0
        /// <summary>
        /// Parses the specified |jsonString| and returns a dictionary or list
        /// representation. If JSON parsing fails this function returns NULL.
        /// </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 CfxValue ParseJson(string jsonString, CfxJsonParserOptions options)
        {
            var jsonString_pinned = new PinnedString(jsonString);
            var __retval          = CfxApi.cfx_parse_json(jsonString_pinned.Obj.PinnedPtr, jsonString_pinned.Length, (int)options);

            jsonString_pinned.Obj.Free();
            return(CfxValue.Wrap(__retval));
        }
        /// <summary>
        /// Returns the value at the specified key. For simple types the returned value
        /// will copy existing data and modifications to the value will not modify this
        /// object. For complex types (binary, dictionary and list) the returned value
        /// will reference existing data and modifications to the 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 CfxValue GetValue(string key)
        {
            var key_pinned = new PinnedString(key);
            var __retval   = CfxApi.DictionaryValue.cfx_dictionary_value_get_value(NativePtr, key_pinned.Obj.PinnedPtr, key_pinned.Length);

            key_pinned.Obj.Free();
            return(CfxValue.Wrap(__retval));
        }
示例#5
0
 /// <summary>
 /// Returns the value at the specified index. For simple types the returned
 /// value will copy existing data and modifications to the value will not
 /// modify this object. For complex types (binary, dictionary and list) the
 /// returned value will reference existing data and modifications to the 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 CfxValue GetValue(int index)
 {
     return(CfxValue.Wrap(CfxApi.cfx_list_value_get_value(NativePtr, index)));
 }
示例#6
0
 /// <summary>
 /// Creates a new 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 static CfxValue Create()
 {
     return(CfxValue.Wrap(CfxApi.cfx_value_create()));
 }
示例#7
0
 /// <summary>
 /// Returns a copy of this object. The underlying data will also be copied.
 /// </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 CfxValue Copy()
 {
     return(CfxValue.Wrap(CfxApi.cfx_value_copy(NativePtr)));
 }
示例#8
0
 /// <summary>
 /// Returns the value at the specified index. For simple types the returned
 /// value will copy existing data and modifications to the value will not
 /// modify this object. For complex types (binary, dictionary and list) the
 /// returned value will reference existing data and modifications to the 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 CfxValue GetValue(ulong index)
 {
     return(CfxValue.Wrap(CfxApi.ListValue.cfx_list_value_get_value(NativePtr, (UIntPtr)index)));
 }