基线 SVN r240

SVN-Revision: r240
This commit is contained in:
cyf
2025-02-06 06:46:06 +00:00
commit ab56a9bcf7
5317 changed files with 902274 additions and 0 deletions
@@ -0,0 +1,690 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Drawing;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
namespace Lskj.MiniBlink
{
/// <summary>
/// 如需要更完善的功能,请根据Pinvoke封装规则把wke.h里的API进行封装
/// </summary>
public static class BlinkBrowserPInvoke
{
const string BlinkBrowserdll = "miniblink_4975_x32.dll";//"node.dll";miniblink
[DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
[DllImport("user32.dll", EntryPoint = "SendMessageW")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
public static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int nMaxCount);
private static Dictionary<string, Assembly> _ResourceAssemblys = new Dictionary<string, Assembly>();
public static Dictionary<string, Assembly> ResourceAssemblys
{
get
{
return _ResourceAssemblys;
}
}
static BlinkBrowserPInvoke()
{
}
/// <summary>
/// 释放内存
/// </summary>
public static void ClearMemory()
{
GC.Collect();
GC.WaitForPendingFinalizers();
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
}
}
/// <summary>
/// 设置页面控件的偏移量,一般用作控件时,需要制定位置,否则会出现事件响应位置有问题。
/// </summary>
/// <param name="webView"></param>
/// <param name="x"></param>
/// <param name="y"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetHandleOffset(IntPtr webView, int x, int y);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetHandle(IntPtr webView, IntPtr wnd);
/// <summary>
/// 是否启用插件
/// </summary>
/// <param name="webView"></param>
/// <param name="Enable"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetNpapiPluginsEnabled(IntPtr webView, bool Enable);
/// <summary>
/// 是否渲染,True 禁止渲染,false 启用渲染
/// </summary>
/// <param name="webView"></param>
/// <param name="Enable"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetHeadlessEnabled(IntPtr webView, bool Enable);
/// <summary>
/// 绑定View请求时,所用IP,比如一台电脑两个IP的情况下,可以指定某个IP访问
/// </summary>
/// <param name="webView"></param>
/// <param name="netInterface"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetViewNetInterface(IntPtr webView, IntPtr netInterface);
/// <summary>
/// 是否检查CSP,也就是跨域安全检查
/// </summary>
/// <param name="webView"></param>
/// <param name="Enable"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetCspCheckEnable(IntPtr webView, bool Enable);
/// <summary>
/// 是否新开窗口
/// </summary>
/// <param name="webView"></param>
/// <param name="Enable"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetNavigationToNewWindowEnable(IntPtr webView, bool Enable);
/// <summary>
/// 是否启用 Touch 触摸事件
/// </summary>
/// <param name="webView"></param>
/// <param name="Enable"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetTouchEnabled(IntPtr webView, bool Enable);
/// <summary>
/// 是否启用内存缓存
/// </summary>
/// <param name="webView"></param>
/// <param name="Enable"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetMemoryCacheEnable(IntPtr webView, bool Enable);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeShowDevtools(IntPtr webView, [In] [MarshalAs(UnmanagedType.LPWStr)] string path, wkeOnShowDevtoolsCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnLoadUrlBegin(IntPtr webView, wkeLoadUrlBeginCallback callback, IntPtr callbackParam);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnLoadUrlEnd(IntPtr webView, wkeLoadUrlEndCallback callback, IntPtr callbackParam);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnDidDownloadCallback(OnDidDownloadCallback _callback);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
public static extern IntPtr wkeGetStringW(IntPtr @string);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
public static extern IntPtr wkeToStringW(IntPtr @string);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetString(IntPtr @string);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSelectAll(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeCopy(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeCut(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkePaste(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeDelete(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern float wkeMediaVolume(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetMediaVolume(IntPtr webView, Single volume);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Single wkeGetMediaVolume(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnReadFile(ReadFileCallback _callback);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeBeforeSendCallback(BeforeSendCallback _callback);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern void wkeNetSetMIMEType(IntPtr job, IntPtr type);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeNetSetURL(IntPtr job, [MarshalAs(UnmanagedType.LPStr)]string url);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeNetSetData(IntPtr job, byte[] buf, int len);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeNetOnResponse(IntPtr webView, wkeNetResponseCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeNetGetMIMEType(IntPtr job, IntPtr mime);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeNetHookRequest(IntPtr job);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeExecCommand(IntPtr handle, [In] [MarshalAs(UnmanagedType.LPWStr)] string command, [In] [MarshalAs(UnmanagedType.LPWStr)] string args);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetUserAgent(IntPtr handle);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetUserAgent(IntPtr handle, [In] [MarshalAs(UnmanagedType.LPStr)] string str);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetUserAgentW(IntPtr handle, [In] [MarshalAs(UnmanagedType.LPWStr)] string str);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeJsBindFunction([MarshalAs(UnmanagedType.LPStr)] [In] string name, wkeJsNativeFunction fn, IntPtr param, uint argCount);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeJsBindGetter([MarshalAs(UnmanagedType.LPStr)] [In] string name, wkeJsNativeFunction fn, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeJsBindSetter([MarshalAs(UnmanagedType.LPStr)] [In] string name, wkeJsNativeFunction fn, IntPtr param);
/// <summary>
/// 调试接口
/// </summary>
/// <param name="name"></param>
/// <param name="fn"></param>
/// <param name="param"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetDebugConfig(IntPtr handler, [MarshalAs(UnmanagedType.LPStr)] [In] string debugString, [MarshalAs(UnmanagedType.LPStr)] [In] string param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetDeviceParameter(IntPtr webview, [MarshalAs(UnmanagedType.LPStr)] [In] string device, [MarshalAs(UnmanagedType.LPStr)] [In] string paramStr, int paramInt, float paramFloat);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsStringW(IntPtr es, IntPtr str);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsString(IntPtr es, IntPtr str);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr jsToString(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr jsToStringW(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern wkeJSData wkeJSGetData(IntPtr es, Int64 jsValue);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeCreateStringW(IntPtr str, Int64 len);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeDeleteString(IntPtr str);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetWTFString(IntPtr wtfstr, [In] [MarshalAs(UnmanagedType.LPWStr)] string str);
/// <summary>
/// 直接执行JS代码
/// </summary>
/// <param name="es"></param>
/// <param name="js"></param>
/// <returns></returns>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeJSEval(IntPtr es, [MarshalAs(UnmanagedType.LPWStr)] [In] string js);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetWTFString(IntPtr wtfstr);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkePaint(IntPtr webView, IntPtr bits, int pitch);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetDragFiles(IntPtr webView, Point clintPos, Point screenPos, IntPtr[] files, int filesCount);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern WkeCursorInfo wkeGetCursorInfoType(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkePaint2(IntPtr webView, IntPtr bits, int bufWid, int bufHei, int xDst, int yDst, int w, int h, int xSrc, int ySrc, [MarshalAs(UnmanagedType.I1)]bool bCopyAlpha);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkePaintDC(IntPtr handle, IntPtr hdc);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsArg(IntPtr es, int argIdx);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern int jsArgCount(IntPtr wkeJSState);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGlobalExec(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern wkeJSType jsTypeOf(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsNumber(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsString(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsBool(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsObject(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsFunction(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsUndefined(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsNull(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsArray(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsTrue(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeJSIsFalse(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeJSGetAt(IntPtr es, Int64 @object, int @index);
#region
[Obsolete("官方编译版本目前没有")]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeHasSelection(IntPtr webView);
[Obsolete("官方编译版本目前没有")]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern string wkeGetSelectedTextW(IntPtr webView);
[Obsolete("官方编译版本目前没有")]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetSelectedText(IntPtr webView);
[Obsolete("官方编译版本目前没有")]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetSelectedSource(IntPtr webView);
#endregion
#region JS基础变量
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsInt(IntPtr es, int n);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsFloat(IntPtr es, float f);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsDouble(IntPtr es, double d);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsBoolean(IntPtr es, [MarshalAs(UnmanagedType.I1)] bool b);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsUndefined(IntPtr es);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsNull(IntPtr es);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsTrue(IntPtr es);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 jsFalse(IntPtr es);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeJSEmptyObject(IntPtr es);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeJSEmptyArray(IntPtr es);
#endregion
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern double jsToDouble(IntPtr es, Int64 v);
/// <summary>
/// WebView关联操作
/// </summary>
/// <param name="es"></param>
/// <returns></returns>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeJSGetWebView(IntPtr es);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern float jsToFloat(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern int jsToInt(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool jsToBoolean(IntPtr es, Int64 v);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeRunJS(IntPtr webView, IntPtr script);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeRunJSW(IntPtr webView, [In] [MarshalAs(UnmanagedType.LPWStr)] string script);
/// <summary>
/// 可以在wkeOnDocumentReady2回调里注入JS执行
/// </summary>
/// <param name="webView"></param>
/// <param name="frameId"></param>
/// <param name="script"></param>
/// <param name="isInClosure"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeRunJsByFrame(IntPtr webView, IntPtr frameId, IntPtr script, [MarshalAs(UnmanagedType.I1)] bool isInClosure);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnAlertBox(IntPtr webView, AlertBoxCallback callback, IntPtr callbackParam);
/// <summary>
/// 下载回调
/// </summary>
/// <param name="webView"></param>
/// <param name="callback"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnDownloadFile(IntPtr webView, wkeDownloadFileCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnDownload(IntPtr webView, wkeDownloadFileCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnConfirmBox(IntPtr webView, ConfirmBoxCallback callback);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnPromptBox(IntPtr webView, PromptBoxCallback callback);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetViewDC(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeFireMouseEvent(IntPtr webView, uint message, int x, int y, uint flags);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeFireMouseWheelEvent(IntPtr webView, int x, int y, int delta, uint flags);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool wkeFireKeyUpEvent(IntPtr webView, uint virtualKeyCode, uint flags, [MarshalAs(UnmanagedType.I1)] bool systemKey);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeFireKeyDownEvent(IntPtr webView, uint virtualKeyCode, uint flags, [MarshalAs(UnmanagedType.I1)] bool systemKey);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool wkeFireKeyPressEvent(IntPtr webView, uint charCode, uint flags, [MarshalAs(UnmanagedType.I1)] bool systemKey);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetFocus(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeGetCaretRect(IntPtr webView, ref wkeRect rect);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeKillFocus(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeResize(IntPtr webView, int w, int h);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetCookie(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern string wkeGetCookieW(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetCookieJarPath(IntPtr webView, [MarshalAs(UnmanagedType.LPWStr)] [In] string path);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetCookieJarFullPath(IntPtr webView, [MarshalAs(UnmanagedType.LPWStr)] [In] string path);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetCookie(IntPtr webView, [MarshalAs(UnmanagedType.LPArray)]byte[] url, [MarshalAs(UnmanagedType.LPArray)]byte[] cookie);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Utf8StringToWkeChar([In, MarshalAs(UnmanagedType.LPStr)] string param0);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeCallOnMainThread(EweCallBack _callback, IntPtr context);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeCallOnMainThreadAndWait(EweCallBack _callback, IntPtr context);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeCanGoBack(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeCanGoForward(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr WkeCharToUtf8String([In, MarshalAs(UnmanagedType.LPWStr)] string param0);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeContextMenuEvent(IntPtr webView, int x, int y, uint flags);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeCreateWebView();
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeCreateWindow(IntPtr hParent);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeDestroyWebView(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEnableContextMenu(IntPtr webView, [MarshalAs(UnmanagedType.I1)] bool enable);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEnableWindow(IntPtr webView, [MarshalAs(UnmanagedType.I1)] bool enable);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeFree(IntPtr ptr);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern int wkeGetContentHeight(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern int wkeGetContentWidth(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern int wkeGetHeight(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern int wkeGetWidth(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern float wkeGetZoomFactor(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeGoBack(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorSelectAll(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorUnSelect(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorCopy(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorCut(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorUndo(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorRedo(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeEditorDelete(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeGoForward(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeInitialize();
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeInitializeEx(IntPtr settings);
public static void wkeInitializeExWrap(wkeSettings settings)
{
int nSizeOfSettings = Marshal.SizeOf(settings);
IntPtr intPtr = Marshal.AllocHGlobal(nSizeOfSettings);
Marshal.StructureToPtr(settings, intPtr, true);
BlinkBrowserPInvoke.wkeInitializeEx(intPtr);
Marshal.DestroyStructure(intPtr, typeof(wkeSettings));
}
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeConfigure(IntPtr settings); // wkeSettings
public static void wkeConfigureWrap(wkeSettings settings)
{
int nSizeOfSettings = Marshal.SizeOf(settings);
IntPtr intPtr = Marshal.AllocHGlobal(nSizeOfSettings);
Marshal.StructureToPtr(settings, intPtr, true);
BlinkBrowserPInvoke.wkeConfigure(intPtr);
Marshal.DestroyStructure(intPtr, typeof(wkeSettings));
}
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsCookieEnabled(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsDirty(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsLoadComplete(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsLoading(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsLoadingCompleted(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsLoadingFailed(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsLoadingSucceeded(IntPtr webView);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern bool wkeIsTransparent(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeJSCollectGarbge();
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeJSContextCreateCallback(ContextCreateCallback cb);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 wkeJSGet(IntPtr es, Int64 jsValue, [In, MarshalAs(UnmanagedType.LPWStr)] string proName);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeLimitPlugins(IntPtr handle, [MarshalAs(UnmanagedType.I1)] bool b);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeLoadFile(IntPtr webView, [In, MarshalAs(UnmanagedType.LPWStr)] string filename);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeLoadHTML(IntPtr webView, IntPtr html);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeLoadHTMLW(IntPtr webView, [In, MarshalAs(UnmanagedType.LPWStr)] string html);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeLoadURL(IntPtr webView, IntPtr url);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern void wkeLoadURLW(IntPtr webView, [In, MarshalAs(UnmanagedType.LPWStr)] string url);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern void wkeLoadFileW(IntPtr webView, [In, MarshalAs(UnmanagedType.LPWStr)] string url);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern void wkeLoadW(IntPtr webView, [In, MarshalAs(UnmanagedType.LPWStr)] string url);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeMalloc(int size);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnConsole(IntPtr webView, wkeConsoleMessageCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnCreateView(IntPtr webView, wkeCreateViewCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnDidDownloadCallback(DidDownloadCallback callback_);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnDocumentReady(IntPtr webView, wkeDocumentReadyCallback callback, IntPtr param);
/// <summary>
/// 可判断是不是主 frame 加载完成
/// </summary>
/// <param name="webView"></param>
/// <param name="callback"></param>
/// <param name="param"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnDocumentReady2(IntPtr webView, wkeDocumentReadyCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnLoadingFinish(IntPtr webView, wkeLoadingFinishCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnNavigation(IntPtr webView, wkeNavigationCallback callback, IntPtr param);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnPaintUpdated(IntPtr webView, wkePaintUpdatedCallback callback, IntPtr callbackParam);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnTitleChanged(IntPtr webView, TitleChangedCallback callback, IntPtr callbackParam);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnURLChanged(IntPtr webView, UrlChangedCallback callback, IntPtr callbackParam);
/// <summary>
/// 可以实现类似谷歌浏览器鼠标移动到带有超链接的地方,给出链接地址。
/// </summary>
/// <param name="webView"></param>
/// <param name="callback"></param>
/// <param name="callbackParam"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnMouseOverUrlChanged(IntPtr webView, TitleChangedCallback callback, IntPtr callbackParam);
/// <summary>
/// URL 改变,可判断是否是主 frame 的url 改变
/// </summary>
/// <param name="webView"></param>
/// <param name="callback"></param>
/// <param name="callbackParam"></param>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeOnURLChanged2(IntPtr webView, UrlChangedCallback2 callback, IntPtr callbackParam);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkePostURL(IntPtr webView, [In, MarshalAs(UnmanagedType.LPStr)] string url, IntPtr data, int dataBytes);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeReload(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetCookieEnabled(IntPtr webView, [MarshalAs(UnmanagedType.I1)] bool enable);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetMenuItemText([In, MarshalAs(UnmanagedType.LPStr)] string item, [In, MarshalAs(UnmanagedType.LPStr)] string text);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetMenuItemVisible([In, MarshalAs(UnmanagedType.LPStr)] string item, [MarshalAs(UnmanagedType.I1)] bool enable);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetTransparent(IntPtr webView, [MarshalAs(UnmanagedType.I1)] bool transparent);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetZoomFactor(IntPtr webView, float factor);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeStopLoading(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeTitleW(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeWindowOnPaint(IntPtr webView, IntPtr bits, int pitch);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeFinalize();
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern void wkeSetStoragePath([MarshalAs(UnmanagedType.LPWStr)] [In] string directory);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeGetVersionString();
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeNetGetPostBody(IntPtr job);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeNetGetHTTPHeaderFieldFromResponse(IntPtr jobPtr, [MarshalAs(UnmanagedType.LPStr)] [In] string key);
/// <summary>
/// wkeRequestType
/// </summary>
/// <param name="job"></param>
/// <returns></returns>
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern wkeRequestType wkeNetGetRequestMethod(IntPtr job);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkeWebFrameGetMainFrame(IntPtr webView);
[DllImport(BlinkBrowserdll, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr wkePrintToBitmap(IntPtr webView,IntPtr wkeWebFrameHandle, wkeScreenshotSettings settings);
public static string Utf8IntptrToString(IntPtr ptr)
{
var data = new List<byte>();
var off = 0;
while (true)
{
var ch = Marshal.ReadByte(ptr, off++);
if (ch == 0)
{
break;
}
data.Add(ch);
}
return Encoding.UTF8.GetString(data.ToArray());
}
}
}
@@ -0,0 +1,87 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Lskj.MiniBlink
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkePaintUpdatedCallback(IntPtr webView, IntPtr param, IntPtr hdc, int x, int y, int cx, int cy);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool wkeJSSetPropertyCallback(IntPtr es, long @object, [MarshalAs(UnmanagedType.LPWStr)] [In] string propertyName, long value);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate long wkeJSGetPropertyCallback(IntPtr es, long @object, [MarshalAs(UnmanagedType.LPWStr)] [In] string propertyName);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkeJSFinalizeCallback(ref wkeJSData data);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate long wkeJSCallAsFunctionCallback(IntPtr es, long @object, ref long args, int argCount);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void AlertBoxCallback(IntPtr webView, IntPtr param, IntPtr msg);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool ConfirmBoxCallback(IntPtr webView, IntPtr msg);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool PromptBoxCallback(IntPtr webView, IntPtr msg, IntPtr defaultResult, IntPtr result);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkeDocumentReadyCallback(IntPtr webView, IntPtr param);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkeDocumentReady2Callback(IntPtr webView, IntPtr param, IntPtr frameId);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkeNetResponseCallback(IntPtr webView, IntPtr param, IntPtr url,IntPtr job);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ReadFileCallback(IntPtr _caller, [MarshalAs(UnmanagedType.LPStr)]string szFile, SetDataCallback setData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SetDataCallback(IntPtr _caller, IntPtr data, uint length);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool BeforeSendCallback(IntPtr url, IntPtr method, IntPtr data, long dataSize);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void EweCallBack(IntPtr param0);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkeConsoleMessageCallback(IntPtr webView, IntPtr param, wkeConsoleLevel level, IntPtr message, IntPtr sourceName, int sourceLine, IntPtr stackTrace);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void wkeLoadingFinishCallback(IntPtr webView, IntPtr param, IntPtr url, wkeLoadingResult result, IntPtr failedReason);
/// <summary>
/// 下载回调
/// </summary>
/// <param name="webView"></param>
/// <param name="url"></param>
/// <param name="result"></param>
/// <param name="failedReason"></param>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool wkeDownloadFileCallback(IntPtr webView, IntPtr param, string url);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DidDownloadCallback([In, MarshalAs(UnmanagedType.LPWStr)] string url, IntPtr data, uint size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ContextCreateCallback(IntPtr es);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void TitleChangedCallback(IntPtr webView, IntPtr param, IntPtr title);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate IntPtr wkeCreateViewCallback(IntPtr webView, IntPtr param, wkeNavigationType navigationType, IntPtr url);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void OnDidDownloadCallback([MarshalAs(UnmanagedType.LPWStr)] [In] string url, IntPtr data, uint size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate Int64 JsCallCallback(IntPtr es);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void UrlChangedCallback(IntPtr webView, IntPtr param, IntPtr url);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void UrlChangedCallback2(IntPtr webView, IntPtr param, IntPtr frameId, IntPtr url);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool wkeNavigationCallback(IntPtr webView, IntPtr param, wkeNavigationType navigationType, IntPtr url);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public delegate bool wkeLoadUrlBeginCallback(IntPtr webView, IntPtr param, [MarshalAs(UnmanagedType.LPStr)] string url, IntPtr job);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public delegate void wkeLoadUrlEndCallback(IntPtr webView, IntPtr param, [MarshalAs(UnmanagedType.LPStr)] string url, IntPtr job, IntPtr buf, int len);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public delegate Int64 jsNativeFunction(IntPtr es);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public delegate Int64 wkeJsNativeFunction(IntPtr es, IntPtr param);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public delegate void wkeOnShowDevtoolsCallback(IntPtr webView, IntPtr param);
}
+149
View File
@@ -0,0 +1,149 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Lskj.MiniBlink
{
public enum wkeProxyType
{
WKE_PROXY_NONE,
WKE_PROXY_HTTP,
WKE_PROXY_SOCKS4,
WKE_PROXY_SOCKS4A,
WKE_PROXY_SOCKS5,
WKE_PROXY_SOCKS5HOSTNAME
}
public enum wkeSettingMask
{
WKE_SETTING_PROXY = 1,
WKE_SETTING_PAINTCALLBACK_IN_OTHER_THREAD = 1 << 2,
}
public enum wkeMouseMessage : uint
{
WKE_MSG_MOUSEMOVE = 0x0200,
WKE_MSG_LBUTTONDOWN = 0x0201,
WKE_MSG_LBUTTONUP = 0x0202,
WKE_MSG_LBUTTONDBLCLK = 0x0203,
WKE_MSG_RBUTTONDOWN = 0x0204,
WKE_MSG_RBUTTONUP = 0x0205,
WKE_MSG_RBUTTONDBLCLK = 0x0206,
WKE_MSG_MBUTTONDOWN = 0x0207,
WKE_MSG_MBUTTONUP = 0x0208,
WKE_MSG_MBUTTONDBLCLK = 0x0209,
WKE_MSG_MOUSEWHEEL = 0x020A,
}
public enum wkeMouseFlags
{
WKE_LBUTTON = 0x01,
WKE_RBUTTON = 0x02,
WKE_SHIFT = 0x04,
WKE_CONTROL = 0x08,
WKE_MBUTTON = 0x10,
}
public enum wkeJSType
{
JSTYPE_NUMBER,
JSTYPE_STRING,
JSTYPE_BOOLEAN,
JSTYPE_OBJECT,
JSTYPE_FUNCTION,
JSTYPE_UNDEFINED
}
public enum wkeMessageSource
{
WKE_MESSAGE_SOURCE_HTML,
WKE_MESSAGE_SOURCE_XML,
WKE_MESSAGE_SOURCE_JS,
WKE_MESSAGE_SOURCE_NETWORK,
WKE_MESSAGE_SOURCE_CONSOLE_API,
WKE_MESSAGE_SOURCE_OTHER
}
public enum wkeMessageType
{
WKE_MESSAGE_TYPE_LOG,
WKE_MESSAGE_TYPE_DIR,
WKE_MESSAGE_TYPE_DIR_XML,
WKE_MESSAGE_TYPE_TRACE,
WKE_MESSAGE_TYPE_START_GROUP,
WKE_MESSAGE_TYPE_START_GROUP_COLLAPSED,
WKE_MESSAGE_TYPE_END_GROUP,
WKE_MESSAGE_TYPE_ASSERT
}
public enum wkeMessageLevel
{
WKE_MESSAGE_LEVEL_TIP,
WKE_MESSAGE_LEVEL_LOG,
WKE_MESSAGE_LEVEL_WARNING,
WKE_MESSAGE_LEVEL_ERROR,
WKE_MESSAGE_LEVEL_DEBUG
}
public enum wkeConsoleLevel
{
wkeLevelDebug = 4,
wkeLevelLog = 1,
wkeLevelInfo = 5,
wkeLevelWarning = 2,
wkeLevelError = 3,
wkeLevelRevokedError = 6,
wkeLevelLast = wkeLevelInfo
}
public enum wkeNavigationAction
{
WKE_NAVIGATION_CONTINUE,
WKE_NAVIGATION_ABORT,
WKE_NAVIGATION_DOWNLOAD
}
public enum wkeNavigationType
{
WKE_NAVIGATION_TYPE_LINKCLICK,
WKE_NAVIGATION_TYPE_FORMSUBMITTE,
WKE_NAVIGATION_TYPE_BACKFORWARD,
WKE_NAVIGATION_TYPE_RELOAD,
WKE_NAVIGATION_TYPE_FORMRESUBMITT,
WKE_NAVIGATION_TYPE_OTHER
}
public enum WkeCursorInfo
{
WkeCursorInfoPointer = 0,
WkeCursorInfoCross = 1,
WkeCursorInfoHand = 2,
WkeCursorInfoIBeam = 3,
WkeCursorInfoWait = 4,
WkeCursorInfoHelp = 5,
WkeCursorInfoEastResize = 6,
WkeCursorInfoNorthResize = 7,
WkeCursorInfoNorthEastResize = 8,
WkeCursorInfoNorthWestResize = 9,
WkeCursorInfoSouthResize = 10,
WkeCursorInfoSouthEastResize = 11,
WkeCursorInfoSouthWestResize = 12,
WkeCursorInfoWestResize = 13,
WkeCursorInfoNorthSouthResize = 14,
WkeCursorInfoEastWestResize = 15,
WkeCursorInfoNorthEastSouthWestResize = 16,
WkeCursorInfoNorthWestSouthEastResize = 17,
WkeCursorInfoColumnResize = 18,
WkeCursorInfoRowResize = 19,
}
public enum wkeLoadingResult
{
WKE_LOADING_SUCCEEDED,
WKE_LOADING_FAILED,
WKE_LOADING_CANCELED
}
public enum wkeHttBodyElementType
{
wkeHttBodyElementTypeData,
wkeHttBodyElementTypeFile
}
public enum wkeRequestType
{
kWkeRequestTypeInvalidation,
kWkeRequestTypeGet,
kWkeRequestTypePost,
kWkeRequestTypePut,
}
}
@@ -0,0 +1,96 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
namespace Lskj.MiniBlink
{
[StructLayout(LayoutKind.Sequential)]
public struct wkeRect
{
public int x;
public int y;
public int w;
public int h;
public Rectangle ToRectangle()
{
return new Rectangle(this.x, this.y, this.w, this.h);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct wkeJSData
{
public IntPtr userdata;
public wkeJSGetPropertyCallback propertyGet;
public wkeJSSetPropertyCallback propertySet;
public wkeJSFinalizeCallback finalize;
public wkeJSCallAsFunctionCallback callAsFunction;
}
[StructLayout(LayoutKind.Sequential)]
public struct wkeProxy
{
public wkeProxyType type;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string hostname;
public ushort port;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)]
public string username;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)]
public string password;
}
[StructLayout(LayoutKind.Sequential)]
public struct wkeSettings
{
public wkeProxy proxy;
public wkeSettingMask mask;
}
[StructLayout(LayoutKind.Sequential)]
public struct wkePostBodyElement
{
public int size;
public wkeHttBodyElementType type;
/// <summary>
/// 转 wkeMemBuf
/// </summary>
public IntPtr data;
/// <summary>
/// wkeString
/// </summary>
public IntPtr filePath;
public Int64 fileStart;
public Int64 fileLength;
}
[StructLayout(LayoutKind.Sequential)]
public struct wkeMemBuf
{
public int size;
public IntPtr data;
public Int32 length;
}
[StructLayout(LayoutKind.Sequential)]
public struct wkePostBodyElements
{
public int size;
/// <summary>
/// wkePostBodyElement**
/// </summary>
public IntPtr element;
public int elementSize;
[MarshalAs(UnmanagedType.I1)]
public bool isDirty;
}
public struct wkeScreenshotSettings
{
public int structSize;
public int width;
public int height;
}
}
@@ -0,0 +1,21 @@
using System;
using System.Runtime.InteropServices;
namespace MiniBlinkPinvoke.Core
{
public static class GraphicsWrapper
{
[DllImport("gdi32.dll")]
private static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop);
public static bool CopyTo(this System.Drawing.Graphics gr1, System.Drawing.Graphics gr2, System.Drawing.Rectangle rect)
{
bool result = false;
var graaa1 = gr2.GetHdc();
var graaa2 = gr1.GetHdc();
result = BitBlt(graaa1, rect.X, rect.Y, rect.Width, rect.Height, graaa2, rect.X, rect.Y, 0x00CC0020);
gr1.ReleaseHdc(graaa2);
gr2.ReleaseHdc(graaa1);
return result;
}
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
namespace Lskj.MiniBlink
{
/// <summary>
/// 只有标记为此属性才能配合 BlinkBrowser 里的GlobalObjectJs使用。
/// </summary>
public class JSFunctin : Attribute
{
public JSFunctin() { }
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MiniBlink
{
public class JSFunctin : Attribute
{
public JSFunctin() { }
}
}
+117
View File
@@ -0,0 +1,117 @@
using System;
using System.Runtime.InteropServices;
namespace Lskj.MiniBlink
{
public class JsValue
{
private IntPtr intptr_0;
private Int64 long_0;
public JsValue(Int64 value, IntPtr jsExecState)
{
this.long_0 = value;
this.intptr_0 = jsExecState;
}
public JsValue(IntPtr jsExecState, int argIndex)
{
this.intptr_0 = jsExecState;
this.long_0 = BlinkBrowserPInvoke.jsArg(this.intptr_0, argIndex);
}
public static int ArgCount(IntPtr jsExecState)
{
return BlinkBrowserPInvoke.jsArgCount(jsExecState);
}
public static Int64 JsDouble(IntPtr jsExecState, double d)
{
return BlinkBrowserPInvoke.jsDouble(jsExecState, d);
}
public static Int64 JsFalse(IntPtr jsExecState)
{
return BlinkBrowserPInvoke.jsFalse(jsExecState);
}
public static Int64 JsFloat(IntPtr jsExecState, float f)
{
return BlinkBrowserPInvoke.jsFloat(jsExecState, f);
}
public static Int64 JsInt(IntPtr jsExecState, int n)
{
return BlinkBrowserPInvoke.jsInt(jsExecState, n);
}
public static Int64 JsNull(IntPtr jsExecState)
{
return BlinkBrowserPInvoke.jsNull(jsExecState);
}
public static Int64 JsString(IntPtr jsExecState, string str)
{
IntPtr strPtr = Marshal.StringToCoTaskMemAnsi(str);
Int64 result = BlinkBrowserPInvoke.jsStringW(jsExecState, strPtr);
Marshal.FreeCoTaskMem(strPtr);
return result;
}
public static Int64 JsTrue(IntPtr jsExecState)
{
return BlinkBrowserPInvoke.jsTrue(jsExecState);
}
public static Int64 JsUndefined(IntPtr jsExecState)
{
return BlinkBrowserPInvoke.jsUndefined(jsExecState);
}
public bool ToBool()
{
return BlinkBrowserPInvoke.jsToBoolean(this.intptr_0, this.long_0);
}
public double ToDouble()
{
return BlinkBrowserPInvoke.jsToDouble(this.intptr_0, this.long_0);
}
public float ToFloat()
{
return BlinkBrowserPInvoke.jsToFloat(this.intptr_0, this.long_0);
}
public int ToInt()
{
return BlinkBrowserPInvoke.jsToInt(this.intptr_0, this.long_0);
}
public override string ToString()
{
if (this.intptr_0 == IntPtr.Zero)
{
return string.Empty;
}
return BlinkBrowserPInvoke.Utf8IntptrToString(BlinkBrowserPInvoke.jsToString(this.intptr_0, this.long_0));
}
public wkeJSType JsType
{
get
{
return BlinkBrowserPInvoke.jsTypeOf(this.intptr_0, this.long_0);
}
}
public Int64 Value
{
get
{
return this.long_0;
}
}
}
}
+480
View File
@@ -0,0 +1,480 @@
using System;
using System.Runtime.InteropServices;
public static class XL
{
[DllImport("xldl.dll", CharSet = CharSet.Unicode)]
public static extern bool XL_Init();
[DllImport("xldl.dll", CharSet = CharSet.Unicode)]
public static extern bool XL_UnInit();
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr XL_CreateTask([In()]DownTaskParam stParam);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool XL_StartTask(IntPtr hTask);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool XL_StopTask(IntPtr hTask);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern object XL_SetSpeedLimit(Int32 nKBps);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int XL_CreateTaskByThunder(string pszUrl, string pszFileName, string pszReferUrl, string pszCharSet, string pszCookie);
//LONG XL_CreateTaskByThunder(wchar_t *pszUrl, wchar_t *pszFileName, wchar_t *pszReferUrl, wchar_t *pszCharSet, wchar_t *pszCookie)
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern object XL_SetUploadSpeedLimit(Int32 nTcpKBps, Int32 nOtherKBps);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern object XL_SetProxy(DOWN_PROXY_INFO stProxyInfo);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern object XL_DelTempFile(DownTaskParam stParam);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool XL_DeleteTask(IntPtr hTask);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool XL_GetBtDataFileList(string szFilePath, string szSeedFileFullPath);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool XL_SetUserAgent(string pszUserAgent);
[DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool XL_GetFileSizeWithUrl(string lpURL, Int64 iFileSize);
[DllImportAttribute("xldl.dll", EntryPoint = "XL_QueryTaskInfoEx", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAsAttribute(UnmanagedType.Bool)]
public static extern bool XL_QueryTaskInfoEx(IntPtr hTask, [Out()]DownTaskInfo stTaskInfo);
[DllImportAttribute("xldl.dll", EntryPoint = "XL_QueryTaskInfoEx", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr XL_CreateBTTask(DownBTTaskParam stParam);
[DllImportAttribute("xldl.dll", EntryPoint = "XL_QueryTaskInfoEx", CallingConvention = CallingConvention.Cdecl)]
public static extern long XL_QueryBTFileInfo(IntPtr hTask, UIntPtr dwFileIndex, ulong ullFileSize, ulong ullCompleteSize, UIntPtr dwStatus);
[DllImportAttribute("xldl.dll", EntryPoint = "XL_QueryTaskInfoEx", CallingConvention = CallingConvention.Cdecl)]
public static extern long XL_QueryBTFileInfo(IntPtr hTask, BTTaskInfo pTaskInfo);
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
public class DownTaskParam
{
public int nReserved;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 2084)]
public string szTaskUrl;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 2084)]
public string szRefUrl;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 4096)]
public string szCookies;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szFilename;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szReserved0;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szSavePath;
public IntPtr hReserved;
public int bReserved = 0;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 64)]
public string szReserved1;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 64)]
public string szReserved2;
public int IsOnlyOriginal = 0;
public uint nReserved1 = 5;
public int DisableAutoRename = 0;
public int IsResume = 1;
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2048, ArraySubType = UnmanagedType.U4)]
public uint[] reserved;
}
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct BTTaskInfo
{
///LONG->int
public int lTaskStatus;
///DWORD->unsigned int
public uint dwUsingResCount;
///DWORD->unsigned int
public uint dwSumResCount;
///ULONGLONG->unsigned __int64
public ulong ullRecvBytes;
///ULONGLONG->unsigned __int64
public ulong ullSendBytes;
///BOOL->int
[MarshalAsAttribute(UnmanagedType.Bool)]
public bool bFileCreated;
///DWORD->unsigned int
public uint dwSeedCount;
///DWORD->unsigned int
public uint dwConnectedBTPeerCount;
///DWORD->unsigned int
public uint dwAllBTPeerCount;
///DWORD->unsigned int
public uint dwHealthyGrade;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public class DownTaskInfo
{
public DOWN_TASK_STATUS stat;
public TASK_ERROR_TYPE fail_code;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szFilename;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szReserved0;
public long nTotalSize;
public long nTotalDownload;
public float fPercent;
public int nReserved0;
public int nSrcTotal;
public int nSrcUsing;
public int nReserved1;
public int nReserved2;
public int nReserved3;
///int
public int nReserved4;
///__int64
public long nReserved5;
///__int64
public long nDonationP2P;
///__int64
public long nReserved6;
///__int64
public long nDonationOrgin;
///__int64
public long nDonationP2S;
///__int64
public long nReserved7;
///__int64
public long nReserved8;
///int
public int nSpeed;
///int
public int nSpeedP2S;
///int
public int nSpeedP2P;
///boolean
public bool bIsOriginUsable;
///float
public float fHashPercent;
///int
public int IsCreatingFile;
///DWORD[64]
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.U4)]
public uint[] reserved;
}
public enum DOWN_TASK_STATUS
{
///NOITEM -> 0
NOITEM = 0,
TSC_ERROR,
TSC_PAUSE,
TSC_DOWNLOAD,
TSC_COMPLETE,
TSC_STARTPENDING,
TSC_STOPPENDING
}
public enum TASK_ERROR_TYPE
{
///TASK_ERROR_UNKNOWN -> 0x00
TASK_ERROR_UNKNOWN = 0,
///TASK_ERROR_DISK_CREATE -> 0x01
TASK_ERROR_DISK_CREATE = 1,
///TASK_ERROR_DISK_WRITE -> 0x02
TASK_ERROR_DISK_WRITE = 2,
///TASK_ERROR_DISK_READ -> 0x03
TASK_ERROR_DISK_READ = 3,
///TASK_ERROR_DISK_RENAME -> 0x04
TASK_ERROR_DISK_RENAME = 4,
///TASK_ERROR_DISK_PIECEHASH -> 0x05
TASK_ERROR_DISK_PIECEHASH = 5,
///TASK_ERROR_DISK_FILEHASH -> 0x06
TASK_ERROR_DISK_FILEHASH = 6,
///TASK_ERROR_DISK_DELETE -> 0x07
TASK_ERROR_DISK_DELETE = 7,
///TASK_ERROR_DOWN_INVALID -> 0x10
TASK_ERROR_DOWN_INVALID = 16,
///TASK_ERROR_PROXY_AUTH_TYPE_UNKOWN -> 0x20
TASK_ERROR_PROXY_AUTH_TYPE_UNKOWN = 32,
///TASK_ERROR_PROXY_AUTH_TYPE_FAILED -> 0x21
TASK_ERROR_PROXY_AUTH_TYPE_FAILED = 33,
///TASK_ERROR_HTTPMGR_NOT_IP -> 0x30
TASK_ERROR_HTTPMGR_NOT_IP = 48,
///TASK_ERROR_TIMEOUT -> 0x40
TASK_ERROR_TIMEOUT = 64,
///TASK_ERROR_CANCEL -> 0x41
TASK_ERROR_CANCEL = 65,
///TASK_ERROR_TP_CRASHED -> 0x42
TASK_ERROR_TP_CRASHED = 66,
///TASK_ERROR_ID_INVALID -> 0x43
TASK_ERROR_ID_INVALID = 67
}
public enum DOWN_PROXY_TYPE
{
///PROXY_TYPE_IE -> 0
PROXY_TYPE_IE = 0,
///PROXY_TYPE_HTTP -> 1
PROXY_TYPE_HTTP = 1,
///PROXY_TYPE_SOCK4 -> 2
PROXY_TYPE_SOCK4 = 2,
///PROXY_TYPE_SOCK5 -> 3
PROXY_TYPE_SOCK5 = 3,
///PROXY_TYPE_FTP -> 4
PROXY_TYPE_FTP = 4,
///PROXY_TYPE_UNKOWN -> 255
PROXY_TYPE_UNKOWN = 255
}
public enum DOWN_PROXY_AUTH_TYPE
{
///PROXY_AUTH_NONE -> 0
PROXY_AUTH_NONE = 0,
PROXY_AUTH_AUTO,
PROXY_AUTH_BASE64,
PROXY_AUTH_NTLM,
PROXY_AUTH_DEGEST,
PROXY_AUTH_UNKOWN
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public class DOWN_PROXY_INFO
{
///BOOL->int
[MarshalAsAttribute(UnmanagedType.Bool)]
public bool bIEProxy;
///BOOL->int
[MarshalAsAttribute(UnmanagedType.Bool)]
public bool bProxy;
///DOWN_PROXY_TYPE
public DOWN_PROXY_TYPE stPType;
///DOWN_PROXY_AUTH_TYPE
public DOWN_PROXY_AUTH_TYPE stAType;
///wchar_t[2048]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 2048)]
public string szHost;
///INT32->int
public int nPort;
///wchar_t[50]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 50)]
public string szUser;
///wchar_t[50]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 50)]
public string szPwd;
///wchar_t[2048]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 2048)]
public string szDomain;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class TrackerInfo
{
///TCHAR[1024]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string szTrackerUrl;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class DownBTTaskParam
{
///TCHAR[260]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szSeedFullPath;
///TCHAR[260]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szFilePath;
///DWORD->unsigned int
public uint dwNeedDownloadFileCount;
///DWORD*
public IntPtr dwNeedDownloadFileIndexArray;
///DWORD->unsigned int
public uint dwTrackerInfoCount;
///TrackerInfo*
public IntPtr pTrackerInfoArray;
///BOOL->int
public int IsResume;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class tracker_info
{
///DWORD->unsigned int
public uint tracker_url_len;
///CHAR[1024]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string tracker_url;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class bt_file_info
{
///ULONGLONG->unsigned __int64
public ulong file_size;
///DWORD->unsigned int
public uint path_len;
///CHAR[256]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 256)]
public string file_path;
///DWORD->unsigned int
public uint name_len;
///CHAR[1024]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string file_name;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class bt_seed_file_info
{
///CHAR[20]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 20)]
public string info_id;
///DWORD->unsigned int
public uint title_len;
///CHAR[1024]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string title;
///DWORD->unsigned int
public uint file_info_count;
///bt_file_info*
public IntPtr file_info_array;
///DWORD->unsigned int
public uint tracker_count;
///tracker_info*
public IntPtr tracker_info_array;
///DWORD->unsigned int
public uint publisher_len;
///CHAR[8192]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 8192)]
public string publisher;
///DWORD->unsigned int
public uint publisher_url_len;
///CHAR[1024]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string publisher_url;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class bt_data_file_item
{
///DWORD->unsigned int
public uint path_len;
///CHAR[256]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 256)]
public string file_path;
///DWORD->unsigned int
public uint name_len;
///CHAR[1024]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string file_name;
}
[StructLayoutAttribute(LayoutKind.Sequential)]
public class bt_data_file_list
{
public uint item_count;
public IntPtr item_array;
}
}