/// <summary> /// Create a new CfxStreamWriter object for a file. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>. /// </remarks> public static CfxStreamWriter CreateForFile(string fileName) { var fileName_pinned = new PinnedString(fileName); var __retval = CfxApi.StreamWriter.cfx_stream_writer_create_for_file(fileName_pinned.Obj.PinnedPtr, fileName_pinned.Length); fileName_pinned.Obj.Free(); return(CfxStreamWriter.Wrap(__retval)); }
internal static CfxStreamWriter Wrap(IntPtr nativePtr) { if (nativePtr == IntPtr.Zero) { return(null); } lock (weakCache) { var wrapper = (CfxStreamWriter)weakCache.Get(nativePtr); if (wrapper == null) { wrapper = new CfxStreamWriter(nativePtr); weakCache.Add(wrapper); } else { CfxApi.cfx_release(nativePtr); } return(wrapper); } }
/// <summary> /// Create a new CfxStreamWriter object for a custom handler. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>. /// </remarks> public static CfxStreamWriter CreateForHandler(CfxWriteHandler handler) { return(CfxStreamWriter.Wrap(CfxApi.StreamWriter.cfx_stream_writer_create_for_handler(CfxWriteHandler.Unwrap(handler)))); }
/// <summary> /// Write the contents of the file being dragged out of the web view into /// |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL /// this function will return the size of the file contents in bytes. Call /// get_file_name() to get a suggested name for the file. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_drag_data_capi.h">cef/include/capi/cef_drag_data_capi.h</see>. /// </remarks> public ulong GetFileContents(CfxStreamWriter writer) { return((ulong)CfxApi.DragData.cfx_drag_data_get_file_contents(NativePtr, CfxStreamWriter.Unwrap(writer))); }
/// <summary> /// Write the contents of the file being dragged out of the web view into /// |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL /// this function will return the size of the file contents in bytes. Call /// get_file_name() to get a suggested name for the file. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_drag_data_capi.h">cef/include/capi/cef_drag_data_capi.h</see>. /// </remarks> public int GetFileContents(CfxStreamWriter writer) { return(CfxApi.cfx_drag_data_get_file_contents(NativePtr, CfxStreamWriter.Unwrap(writer))); }