資源簡介
CEF3的2016整合版本,output包含了所有所需的必要dll,解決加載flash動畫閃現命令框問題;增加下載模塊;整合之前未上傳的控件源碼;增加MP3、MP4支持;并更新了tabcontrol,增加關閉按鈕;重新寫了右鍵菜單;啟用NPAPI以及PPAPI功能,只需將對應的動態庫拷貝到對應文件夾,其中NPAPI拷貝到plugins文件夾,PPAPI拷貝到PepperFlash文件夾;
代碼片段和文件信息
namespace?Xilium.CefGlue
{
????using?System;
????using?System.Collections.Generic;
????using?System.Globalization;
????using?System.Runtime.InteropServices;
????using?System.Text;
????using?Xilium.CefGlue.Interop;
????public?static?unsafe?class?CefRuntime
????{
????????private?static?readonly?CefRuntimePlatform?_platform;
????????private?static?bool?_loaded;
????????private?static?bool?_initialized;
????????static?CefRuntime()
????????{
????????????_platform?=?DetectPlatform();
????????}
????????#region?Platform?Detection
????????private?static?CefRuntimePlatform?DetectPlatform()
????????{
????????????var?platformId?=?Environment.OSVersion.Platform;
????????????if?(platformId?==?PlatformID.MacOSX)
????????????????return?CefRuntimePlatform.MacOSX;
????????????int?p?=?(int)platformId;
????????????if?((p?==?4)?||?(p?==?128))
????????????????return?IsRunningOnMac()???CefRuntimePlatform.MacOSX?:?CefRuntimePlatform.Linux;
????????????return?CefRuntimePlatform.Windows;
????????}
????????//From?Managed.Windows.Forms/XplatUI
????????private?static?bool?IsRunningOnMac()
????????{
????????????IntPtr?buf?=?IntPtr.Zero;
????????????try
????????????{
????????????????buf?=?Marshal.AllocHGlobal(8192);
????????????????//?This?is?a?hacktastic?way?of?getting?sysname?from?uname?()
????????????????if?(uname(buf)?==?0)
????????????????{
????????????????????string?os?=?Marshal.PtrToStringAnsi(buf);
????????????????????if?(os?==?“Darwin“)
????????????????????????return?true;
????????????????}
????????????}
????????????catch?{?}
????????????finally
????????????{
????????????????if?(buf?!=?IntPtr.Zero)
????????????????????Marshal.FreeHGlobal(buf);
????????????}
????????????return?false;
????????}
????????[DllImport(“libc“)]
????????private?static?extern?int?uname(IntPtr?buf);
????????public?static?CefRuntimePlatform?Platform
????????{
????????????get?{?return?_platform;?}
????????}
????????#endregion
????????///?
????????///?Loads?CEF?runtime.
????????///?
????????///?
????????///?
????????///?
????????public?static?void?Load()
????????{
????????????Load(null);
????????}
????????///?
????????///?Loads?CEF?runtime?from?specified?path.
????????///?
????????///?
????????///?
????????///?
????????public?static?void?Load(string?path)
????????{
????????????if?(_loaded)?return;
????????????if?(!string.IsNullOrEmpty(path))
????????????{
????????????????if?(Platform?==?CefRuntimePlatform.Windows)
????????????????????LoadLibraryWindows(path);
????????????????else
????????????????????throw?new?PlatformNotSupportedException(“CEF?Runtime?can‘t?be?initialized?on?altered?path?on?this?platform.?Use?CefRuntime.Loa
評論
共有 條評論