Merge remote-tracking branch 'remotes/upstream/master' into cef/2171

This commit is contained in:
amaitland
2014-11-18 13:48:46 +10:00
13 changed files with 853 additions and 45 deletions
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CefSharp.OffScreen.Example</RootNamespace>
<AssemblyName>CefSharp.OffScreen.Example</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CefSharp.Core\CefSharp.Core.vcxproj">
<Project>{7b495581-2271-4f41-9476-acb86e8c864f}</Project>
<Name>CefSharp.Core</Name>
</ProjectReference>
<ProjectReference Include="..\CefSharp.Example\CefSharp.Example.csproj">
<Project>{a4394e7b-1155-43a6-989e-8ab72dddc9e4}</Project>
<Name>CefSharp.Example</Name>
</ProjectReference>
<ProjectReference Include="..\CefSharp.OffScreen\CefSharp.OffScreen.csproj">
<Project>{483b158d-f57d-49d9-9046-31e6a73f8a53}</Project>
<Name>CefSharp.OffScreen</Name>
</ProjectReference>
<ProjectReference Include="..\CefSharp\CefSharp.csproj">
<Project>{a55848cc-10e7-40cb-addb-04740b16dd43}</Project>
<Name>CefSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\CefSharp.props" />
<Import Project="$(SolutionDir)\CefSharp.Native.props" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cef.redist.x64.3.2062.1898\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x64.3.2062.1898\build\cef.redist.x64.targets'))" />
<Error Condition="!Exists('..\packages\cef.redist.x86.3.2062.1898\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x86.3.2062.1898\build\cef.redist.x86.targets'))" />
</Target>
<Import Project="..\packages\cef.redist.x64.3.2062.1898\build\cef.redist.x64.targets" Condition="Exists('..\packages\cef.redist.x64.3.2062.1898\build\cef.redist.x64.targets')" />
<Import Project="..\packages\cef.redist.x86.3.2062.1898\build\cef.redist.x86.targets" Condition="Exists('..\packages\cef.redist.x86.3.2062.1898\build\cef.redist.x86.targets')" />
</Project>
+81
View File
@@ -0,0 +1,81 @@
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Diagnostics;
using System.IO;
using CefSharp.Example;
namespace CefSharp.OffScreen.Example
{
public class Program
{
private static ChromiumWebBrowser browser;
public static void Main(string[] args)
{
const string testUrl = "https://www.google.com/";
Console.WriteLine("This example application will load {0}, take a screenshot, and save it to your desktop.", testUrl);
Console.WriteLine("You may see a lot of Chromium debugging output, please wait...");
Console.WriteLine();
// You need to replace this with your own call to Cef.Initialize();
CefExample.Init();
// Create the offscreen Chromium browser.
browser = new ChromiumWebBrowser();
// An event that is fired when the first page is finished loading.
// This returns to us from another thread.
browser.FrameLoadEnd += BrowserFrameLoadEnd;
// Start loading the test URL in Chrome's thread.
browser.Load(testUrl);
// We have to wait for something, otherwise the process will exit too soon.
Console.ReadKey();
// Clean up Chromium objects. You need to call this in your application otherwise
// you will get a crash when closing.
Cef.Shutdown();
}
private static void BrowserFrameLoadEnd(object sender, FrameLoadEndEventArgs e)
{
// Check to ensure it is the main frame which has finished loading
// (rather than an iframe within the main frame).
if (e.IsMainFrame)
{
// Remove the load event handler, because we only want one snapshot of the initial page.
browser.FrameLoadEnd -= BrowserFrameLoadEnd;
// Wait for the screenshot to be taken.
var task = browser.ScreenshotAsync();
task.Wait();
// Make a file to save it to (e.g. C:\Users\jan\Desktop\CefSharp screenshot.png)
var screenshotPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "CefSharp screenshot.png");
Console.WriteLine();
Console.WriteLine("Screenshot ready. Saving to {0}", screenshotPath);
// Save the Bitmap to the path.
// The image type is auto-detected via the ".png" extension.
task.Result.Save(screenshotPath);
// We no longer need the Bitmap.
// Dispose it to avoid keeping the memory alive. Especially important in 32-bit applications.
task.Result.Dispose();
Console.WriteLine("Screenshot saved. Launching your default image viewer...");
// Tell Windows to launch the saved image.
Process.Start(screenshotPath);
Console.WriteLine("Image viewer launched. Press any key to exit.");
}
}
}
}
@@ -0,0 +1,13 @@
using CefSharp;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CefSharp.OffScreen.Example")]
[assembly: AssemblyCompany(AssemblyInfo.AssemblyCompany)]
[assembly: AssemblyProduct(AssemblyInfo.AssemblyProduct)]
[assembly: AssemblyCopyright(AssemblyInfo.AssemblyCopyright)]
[assembly: ComVisible(AssemblyInfo.ComVisible)]
[assembly: AssemblyVersion(AssemblyInfo.AssemblyVersion)]
[assembly: AssemblyFileVersion(AssemblyInfo.AssemblyFileVersion)]
[assembly: CLSCompliant(AssemblyInfo.ClsCompliant)]
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="3.2062.1898" targetFramework="net40-Client" />
<package id="cef.redist.x86" version="3.2062.1898" targetFramework="net40-Client" />
</packages>
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{483B158D-F57D-49D9-9046-31E6A73F8A53}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CefSharp.OffScreen</RootNamespace>
<AssemblyName>CefSharp.OffScreen</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x64\Debug\CefSharp.OffScreen.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x64\Release\CefSharp.OffScreen.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x86\Debug\CefSharp.OffScreen.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x86\Release\CefSharp.OffScreen.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ChromiumWebBrowser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CefSharp.Core\CefSharp.Core.vcxproj">
<Project>{7b495581-2271-4f41-9476-acb86e8c864f}</Project>
<Name>CefSharp.Core</Name>
</ProjectReference>
<ProjectReference Include="..\CefSharp\CefSharp.csproj">
<Project>{a55848cc-10e7-40cb-addb-04740b16dd43}</Project>
<Name>CefSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+496
View File
@@ -0,0 +1,496 @@
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using CefSharp.Internals;
namespace CefSharp.OffScreen
{
/// <summary>
/// An offscreen instance of Chromium that you can use to take
/// snapshots or evaluate JavaScript.
/// </summary>
public class ChromiumWebBrowser : IRenderWebBrowser
{
private ManagedCefBrowserAdapter managedCefBrowserAdapter;
/// <summary>Contains the last rendering from Chromium.</summary>
private Bitmap bitmap;
/// <summary>Need a lock because the caller may be asking for the bitmap
/// while Chromium async rendering has returned on another thread.</summary>
private readonly object bitmapLock = new object();
/// <summary>Size of the Chromium viewport.
///
/// This must be set to something other than 0x0 otherwise Chromium will not render,
/// and the ScreenshotAsync task will deadlock.</summary>
private System.Drawing.Size size = new System.Drawing.Size(1366, 768);
/// <summary>
/// Create a new offscreen Chromium with the initial URL of "about:blank".
/// </summary>
/// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
public ChromiumWebBrowser(BrowserSettings browserSettings = null)
{
Cef.AddDisposable(this);
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
managedCefBrowserAdapter.CreateOffscreenBrowser(browserSettings ?? new BrowserSettings());
}
public void Dispose()
{
Cef.RemoveDisposable(this);
if (bitmap != null)
{
bitmap.Dispose();
bitmap = null;
}
if (managedCefBrowserAdapter != null)
{
if (!managedCefBrowserAdapter.IsDisposed)
managedCefBrowserAdapter.Dispose();
managedCefBrowserAdapter = null;
}
GC.SuppressFinalize(this);
}
/// <summary>
/// Get/set the size of the Chromium viewport, in pixels.
///
/// This also changes the size of the next screenshot.
/// </summary>
public System.Drawing.Size Size
{
get { return size; }
set
{
if (size != value)
{
size = value;
managedCefBrowserAdapter.WasResized();
}
}
}
/// <summary>
/// Fired by a separate thread when Chrome has re-rendered.
/// This means that a Bitmap will be returned by ScreenshotOrNull().
/// </summary>
public event EventHandler NewScreenshot;
/// <summary>
/// Immediately returns a copy of the last rendering from Chrome,
/// or null if no rendering has occurred yet.
///
/// Chrome also renders the page loading, so if you want to see a complete rendering,
/// only start this task once your page is loaded (which you can detect via FrameLoadEnd
/// or your own heuristics based on evaluating JavaScript).
///
/// It is your responsibility to dispose the returned Bitmap.
///
/// The bitmap size is determined by the Size property set earlier.
/// </summary>
public Bitmap ScreenshotOrNull()
{
lock (bitmapLock)
{
if (bitmap == null)
return null;
else
return new Bitmap(bitmap);
}
}
/// <summary>
/// Starts a task that waits for the next rendering from Chrome.
///
/// Chrome also renders the page loading, so if you want to see a complete rendering,
/// only start this task once your page is loaded (which you can detect via FrameLoadEnd
/// or your own heuristics based on evaluating JavaScript).
///
/// It is your responsibility to dispose the returned Bitmap.
///
/// The bitmap size is determined by the Size property set earlier.
/// </summary>
public Task<Bitmap> ScreenshotAsync()
{
// Try our luck and see if there is already a screenshot, to save us creating a new thread for nothing.
var screenshot = ScreenshotOrNull();
Task<Bitmap> task;
if (screenshot != null)
{
var completionSource = new TaskCompletionSource<Bitmap>();
completionSource.SetResult(screenshot);
task = completionSource.Task;
}
else
{
// No existing screenshot, so wait for Chromium to render itself.
// A wait handle, so the task knows when NewScreenshot has fired.
var waitForBitmap = new EventWaitHandle(false, EventResetMode.AutoReset);
EventHandler newScreenshot = null; // otherwise we cannot reference ourselves in the anonymous method below
newScreenshot = (sender, e) =>
{
// Chromium has rendered. Tell the task about it.
NewScreenshot -= newScreenshot;
waitForBitmap.Set();
};
NewScreenshot += newScreenshot;
task = new Task<Bitmap>(() =>
{
// Wait in this thread for the NewScreenshot event to fire.
waitForBitmap.WaitOne();
return ScreenshotOrNull();
});
task.Start();
}
return task;
}
public IJsDialogHandler JsDialogHandler { get; set; }
public IDialogHandler DialogHandler { get; set; }
public IDownloadHandler DownloadHandler { get; set; }
public IKeyboardHandler KeyboardHandler { get; set; }
public ILifeSpanHandler LifeSpanHandler { get; set; }
public IMenuHandler MenuHandler { get; set; }
public IRequestHandler RequestHandler { get; set; }
public event EventHandler<LoadErrorEventArgs> LoadError;
public event EventHandler<FrameLoadStartEventArgs> FrameLoadStart;
public event EventHandler<FrameLoadEndEventArgs> FrameLoadEnd;
public event EventHandler<ConsoleMessageEventArgs> ConsoleMessage;
public event EventHandler BrowserInitialized;
public event EventHandler<StatusMessageEventArgs> StatusMessage;
public void ShowDevTools()
{
throw new NotImplementedException();
}
public void CloseDevTools()
{
throw new NotImplementedException();
}
public string Address { get; set; }
public bool CanGoBack { get; private set; }
public bool CanGoForward { get; private set; }
public Task<JavascriptResponse> EvaluateScriptAsync(string script, TimeSpan? timeout = null)
{
return managedCefBrowserAdapter.EvaluateScriptAsync(script, timeout);
}
public void ExecuteScriptAsync(string script)
{
managedCefBrowserAdapter.ExecuteScriptAsync(script);
}
public void Find(int identifier, string searchText, bool forward, bool matchCase, bool findNext)
{
managedCefBrowserAdapter.Find(identifier, searchText, forward, matchCase, findNext);
}
public void StopFinding(bool clearSelection)
{
managedCefBrowserAdapter.StopFinding(clearSelection);
}
public bool IsBrowserInitialized { get; private set; }
public bool IsLoading { get; set; }
public void Load(string url)
{
Address = url;
managedCefBrowserAdapter.LoadUrl(Address);
}
public void LoadHtml(string html, string url)
{
managedCefBrowserAdapter.LoadHtml(html, url);
}
public void RegisterJsObject(string name, object objectToBind)
{
managedCefBrowserAdapter.RegisterJsObject(name, objectToBind);
}
public void Stop()
{
managedCefBrowserAdapter.Stop();
}
public string Title { get; set; }
public string TooltipText { get; set; }
public bool CanReload { get; private set; }
public Task<string> GetSourceAsync()
{
var taskStringVisitor = new TaskStringVisitor();
managedCefBrowserAdapter.GetSource(taskStringVisitor);
return taskStringVisitor.Task;
}
public Task<string> GetTextAsync()
{
var taskStringVisitor = new TaskStringVisitor();
managedCefBrowserAdapter.GetText(taskStringVisitor);
return taskStringVisitor.Task;
}
bool IWebBrowser.Focus()
{
// no control to focus for offscreen browser
return false;
}
public void Reload()
{
Reload(false);
}
public void Reload(bool ignoreCache)
{
managedCefBrowserAdapter.Reload(ignoreCache);
}
public void ViewSource()
{
managedCefBrowserAdapter.ViewSource();
}
public void Print()
{
managedCefBrowserAdapter.Print();
}
public void Back()
{
managedCefBrowserAdapter.GoBack();
}
public void Forward()
{
managedCefBrowserAdapter.GoForward();
}
public double ZoomLevel
{
get { return managedCefBrowserAdapter.GetZoomLevel(); }
set { managedCefBrowserAdapter.SetZoomLevel(value); }
}
public void SendMouseWheelEvent(int x, int y, int deltaX, int deltaY)
{
managedCefBrowserAdapter.OnMouseWheel(x, y, deltaX, deltaY);
}
#region IRenderWebBrowser (rendering to bitmap; derived from CefSharp.Wpf.ChromiumWebBrowser)
/// <summary>The bitmap buffer is 32 BPP.</summary>
int IRenderWebBrowser.BytesPerPixel
{
get { return 4; }
}
void IRenderWebBrowser.ClearBitmap(BitmapInfo bitmapInfo)
{
lock (bitmapLock)
{
if (bitmap != null)
bitmap.Dispose();
bitmap = null;
}
}
int IRenderWebBrowser.Width
{
get { return size.Width; }
}
int IRenderWebBrowser.Height
{
get { return size.Height; }
}
void IRenderWebBrowser.InvokeRenderAsync(BitmapInfo bitmapInfo)
{
((IRenderWebBrowser)this).SetBitmap(bitmapInfo);
}
void IRenderWebBrowser.SetBitmap(BitmapInfo bitmapInfo)
{
lock (bitmapLock)
{
((IRenderWebBrowser)this).ClearBitmap(bitmapInfo);
lock (bitmapInfo.BitmapLock)
{
var stride = bitmapInfo.Width * ((IRenderWebBrowser)this).BytesPerPixel;
bitmap = BitmapSourceToBitmap2(Imaging.CreateBitmapSourceFromMemorySection(bitmapInfo.FileMappingHandle,
bitmapInfo.Width, bitmapInfo.Height, PixelFormats.Bgra32, stride, 0));
var handler = NewScreenshot;
if (handler != null)
{
handler(this, EventArgs.Empty);
}
}
}
}
/// <summary>
/// http://stackoverflow.com/a/5709472/450141
/// </summary>
/// <param name="srs">BitmapSource</param>
/// <returns>Bitmap</returns>
private static Bitmap BitmapSourceToBitmap2(BitmapSource srs)
{
var bmp = new Bitmap(
srs.PixelWidth,
srs.PixelHeight,
System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
var data = bmp.LockBits(
new Rectangle(System.Drawing.Point.Empty, bmp.Size),
ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
srs.CopyPixels(
Int32Rect.Empty,
data.Scan0,
data.Height * data.Stride,
data.Stride);
bmp.UnlockBits(data);
return bmp;
}
void IRenderWebBrowser.SetCursor(IntPtr cursor)
{
}
void IRenderWebBrowser.SetPopupIsOpen(bool show)
{
}
void IRenderWebBrowser.SetPopupSizeAndPosition(int width, int height, int x, int y)
{
}
#endregion
#region IWebBrowserInternal (notifications from CEF to C#; derived from CefSharp.Wpf.ChromiumWebBrowser)
void IWebBrowserInternal.OnConsoleMessage(string message, string source, int line)
{
var handler = ConsoleMessage;
if (handler != null)
{
handler(this, new ConsoleMessageEventArgs(message, source, line));
}
}
void IWebBrowserInternal.OnFrameLoadStart(string url, bool isMainFrame)
{
var handler = FrameLoadStart;
if (handler != null)
{
handler(this, new FrameLoadStartEventArgs(url, isMainFrame));
}
}
void IWebBrowserInternal.OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
{
var handler = FrameLoadEnd;
if (handler != null)
{
handler(this, new FrameLoadEndEventArgs(url, isMainFrame, httpStatusCode));
}
}
void IWebBrowserInternal.OnInitialized()
{
IsBrowserInitialized = true;
var handler = BrowserInitialized;
if (handler != null)
{
handler(this, EventArgs.Empty);
}
}
void IWebBrowserInternal.OnLoadError(string url, CefErrorCode errorCode, string errorText)
{
var handler = LoadError;
if (handler != null)
{
handler(this, new LoadErrorEventArgs(url, errorCode, errorText));
}
}
void IWebBrowserInternal.OnTakeFocus(bool next)
{
throw new NotImplementedException();
}
void IWebBrowserInternal.OnStatusMessage(string value)
{
var handler = StatusMessage;
if (handler != null)
{
handler(this, new StatusMessageEventArgs(value));
}
}
void IWebBrowserInternal.SetAddress(string address)
{
this.Address = address;
}
void IWebBrowserInternal.SetIsLoading(bool isloading)
{
IsLoading = isloading;
}
void IWebBrowserInternal.SetNavState(bool canGoBack, bool canGoForward, bool canReload)
{
CanGoBack = canGoBack;
CanGoForward = canGoForward;
CanReload = canReload;
}
void IWebBrowserInternal.SetTitle(string title)
{
Title = title;
}
void IWebBrowserInternal.SetTooltipText(string tooltipText)
{
TooltipText = tooltipText;
}
#endregion
}
}
@@ -0,0 +1,18 @@
using CefSharp;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CefSharp.OffScreen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany(AssemblyInfo.AssemblyCompany)]
[assembly: AssemblyProduct(AssemblyInfo.AssemblyProduct)]
[assembly: AssemblyCopyright(AssemblyInfo.AssemblyCopyright)]
[assembly: ComVisible(AssemblyInfo.ComVisible)]
[assembly: AssemblyVersion(AssemblyInfo.AssemblyVersion)]
[assembly: AssemblyFileVersion(AssemblyInfo.AssemblyFileVersion)]
[assembly: CLSCompliant(AssemblyInfo.ClsCompliant)]
+5
View File
@@ -120,6 +120,11 @@ namespace CefSharp.WinForms
return managedCefBrowserAdapter.EvaluateScriptAsync(script, timeout);
}
public void SendMouseWheelEvent(int x, int y, int deltaX, int deltaY)
{
managedCefBrowserAdapter.OnMouseWheel(x, y, deltaX, deltaY);
}
public event EventHandler<LoadErrorEventArgs> LoadError;
public event EventHandler<FrameLoadStartEventArgs> FrameLoadStart;
public event EventHandler<FrameLoadEndEventArgs> FrameLoadEnd;
+5
View File
@@ -896,6 +896,11 @@ namespace CefSharp.Wpf
}
}
public void SendMouseWheelEvent(int x, int y, int deltaX, int deltaY)
{
managedCefBrowserAdapter.OnMouseWheel(x, y, deltaX, deltaY);
}
protected void PopupMouseEnter(object sender, MouseEventArgs e)
{
Focus();
+8 -3
View File
@@ -270,9 +270,14 @@ namespace CefSharp
/// </summary>
/// <param name="word">The new word that will be added to the dictionary.</param>
void AddWordToDictionary(string word);
/// <summary>
/// Send a mouse wheel event to the browser.
/// </summary>
/// <param name="x">X-Axis coordinate relative to the upper-left corner of the view.</param>
/// <param name="y">Y-Axis coordinate relative to the upper-left corner of the view.</param>
/// <param name="deltaX">Movement delta for X direction.</param>
/// <param name="deltaY">movement delta for Y direction.</param>
void SendMouseWheelEvent(int x, int y, int deltaX, int deltaY);
}
}
+20 -42
View File
@@ -65,136 +65,114 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{9AD9C469
build.ps1 = build.ps1
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.OffScreen", "CefSharp.OffScreen\CefSharp.OffScreen.csproj", "{483B158D-F57D-49D9-9046-31E6A73F8A53}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.OffScreen.Example", "CefSharp.OffScreen.Example\CefSharp.OffScreen.Example.csproj", "{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Debug|Mixed Platforms.Build.0 = Debug|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Debug|Win32.ActiveCfg = Debug|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Debug|Win32.Build.0 = Debug|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Debug|x64.ActiveCfg = Debug|x64
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Debug|x64.Build.0 = Debug|x64
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Release|Mixed Platforms.ActiveCfg = Release|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Release|Mixed Platforms.Build.0 = Release|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Release|Win32.ActiveCfg = Release|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Release|Win32.Build.0 = Release|x86
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Release|x64.ActiveCfg = Release|x64
{7A4D5447-183B-4A11-8E63-9848991B46FF}.Release|x64.Build.0 = Release|x64
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Debug|Win32.ActiveCfg = Debug|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Debug|Win32.Build.0 = Debug|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Debug|x64.ActiveCfg = Debug|x64
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Debug|x64.Build.0 = Debug|x64
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Release|Mixed Platforms.Build.0 = Release|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Release|Win32.ActiveCfg = Release|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Release|Win32.Build.0 = Release|x86
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Release|x64.ActiveCfg = Release|x64
{A4394E7B-1155-43A6-989E-8AB72DDDC9E4}.Release|x64.Build.0 = Release|x64
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Mixed Platforms.Build.0 = Debug|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Win32.ActiveCfg = Debug|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Win32.Build.0 = Debug|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|x64.ActiveCfg = Debug|x64
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|x64.Build.0 = Debug|x64
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Mixed Platforms.ActiveCfg = Release|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Mixed Platforms.Build.0 = Release|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Win32.ActiveCfg = Release|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Win32.Build.0 = Release|x86
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|x64.ActiveCfg = Release|x64
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|x64.Build.0 = Release|x64
{E6CB3790-F267-4AC7-892C-2620737682CA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Debug|Mixed Platforms.Build.0 = Debug|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Debug|Win32.ActiveCfg = Debug|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Debug|Win32.Build.0 = Debug|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Debug|x64.ActiveCfg = Debug|x64
{E6CB3790-F267-4AC7-892C-2620737682CA}.Debug|x64.Build.0 = Debug|x64
{E6CB3790-F267-4AC7-892C-2620737682CA}.Release|Mixed Platforms.ActiveCfg = Release|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Release|Mixed Platforms.Build.0 = Release|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Release|Win32.ActiveCfg = Release|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Release|Win32.Build.0 = Release|x86
{E6CB3790-F267-4AC7-892C-2620737682CA}.Release|x64.ActiveCfg = Release|x64
{E6CB3790-F267-4AC7-892C-2620737682CA}.Release|x64.Build.0 = Release|x64
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Debug|Mixed Platforms.Build.0 = Debug|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Debug|Win32.ActiveCfg = Debug|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Debug|Win32.Build.0 = Debug|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Debug|x64.ActiveCfg = Debug|x64
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Debug|x64.Build.0 = Debug|x64
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Release|Mixed Platforms.ActiveCfg = Release|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Release|Mixed Platforms.Build.0 = Release|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Release|Win32.ActiveCfg = Release|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Release|Win32.Build.0 = Release|x86
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Release|x64.ActiveCfg = Release|x64
{23EE5140-2C2C-4B53-A954-10B08DCA6BD6}.Release|x64.Build.0 = Release|x64
{882505AD-246D-402A-8414-347EFB8E2C8D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Debug|Mixed Platforms.Build.0 = Debug|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Debug|Win32.ActiveCfg = Debug|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Debug|Win32.Build.0 = Debug|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Debug|x64.ActiveCfg = Debug|x64
{882505AD-246D-402A-8414-347EFB8E2C8D}.Debug|x64.Build.0 = Debug|x64
{882505AD-246D-402A-8414-347EFB8E2C8D}.Release|Mixed Platforms.ActiveCfg = Release|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Release|Mixed Platforms.Build.0 = Release|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Release|Win32.ActiveCfg = Release|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Release|Win32.Build.0 = Release|x86
{882505AD-246D-402A-8414-347EFB8E2C8D}.Release|x64.ActiveCfg = Release|x64
{882505AD-246D-402A-8414-347EFB8E2C8D}.Release|x64.Build.0 = Release|x64
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Debug|Mixed Platforms.Build.0 = Debug|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Debug|Win32.ActiveCfg = Debug|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Debug|Win32.Build.0 = Debug|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Debug|x64.ActiveCfg = Debug|x64
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Debug|x64.Build.0 = Debug|x64
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Mixed Platforms.ActiveCfg = Release|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Mixed Platforms.Build.0 = Release|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Win32.ActiveCfg = Release|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Win32.Build.0 = Release|x86
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|x64.ActiveCfg = Release|x64
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|x64.Build.0 = Release|x64
{7B495581-2271-4F41-9476-ACB86E8C864F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Debug|Win32.ActiveCfg = Debug|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Debug|Win32.Build.0 = Debug|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Debug|x64.ActiveCfg = Debug|x64
{7B495581-2271-4F41-9476-ACB86E8C864F}.Debug|x64.Build.0 = Debug|x64
{7B495581-2271-4F41-9476-ACB86E8C864F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Release|Mixed Platforms.Build.0 = Release|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Release|Win32.ActiveCfg = Release|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Release|Win32.Build.0 = Release|Win32
{7B495581-2271-4F41-9476-ACB86E8C864F}.Release|x64.ActiveCfg = Release|x64
{7B495581-2271-4F41-9476-ACB86E8C864F}.Release|x64.Build.0 = Release|x64
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Debug|Win32.ActiveCfg = Debug|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Debug|Win32.Build.0 = Debug|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Debug|x64.ActiveCfg = Debug|x64
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Debug|x64.Build.0 = Debug|x64
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Release|Mixed Platforms.Build.0 = Release|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Release|Win32.ActiveCfg = Release|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Release|Win32.Build.0 = Release|x86
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Release|x64.ActiveCfg = Release|x64
{A55848CC-10E7-40CB-ADDB-04740B16DD43}.Release|x64.Build.0 = Release|x64
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Debug|Win32.ActiveCfg = Debug|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Debug|Win32.Build.0 = Debug|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Debug|x64.ActiveCfg = Debug|x64
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Debug|x64.Build.0 = Debug|x64
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Release|Mixed Platforms.Build.0 = Release|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Release|Win32.ActiveCfg = Release|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Release|Win32.Build.0 = Release|Win32
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Release|x64.ActiveCfg = Release|x64
{6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C}.Release|x64.Build.0 = Release|x64
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Debug|Win32.ActiveCfg = Debug|x86
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Debug|Win32.Build.0 = Debug|x86
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Debug|x64.ActiveCfg = Debug|x64
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Debug|x64.Build.0 = Debug|x64
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Release|Win32.ActiveCfg = Release|x86
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Release|Win32.Build.0 = Release|x86
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Release|x64.ActiveCfg = Release|x64
{483B158D-F57D-49D9-9046-31E6A73F8A53}.Release|x64.Build.0 = Release|x64
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Debug|Win32.ActiveCfg = Debug|x86
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Debug|Win32.Build.0 = Debug|x86
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Debug|x64.ActiveCfg = Debug|x64
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Debug|x64.Build.0 = Debug|x64
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Release|Win32.ActiveCfg = Release|x86
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Release|Win32.Build.0 = Release|x86
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Release|x64.ActiveCfg = Release|x64
{A4DEB90C-A529-4A93-ACE3-226A39EFCB00}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+16
View File
@@ -218,6 +218,11 @@ function NugetPackageRestore
function Nupkg
{
if($SkipNugetForPr)
{
return;
}
$nuget = Join-Path $WorkingDir .\nuget\NuGet.exe
if(-not (Test-Path $nuget)) {
Die "Please install nuget. More information available at: http://docs.nuget.org/docs/start-here/installing-nuget"
@@ -261,6 +266,17 @@ function WriteAssemblyVersion
$NewString | Set-Content $Filename -Encoding UTF8
}
function CheckIfPrBuild()
{
if (Test-Path Env:\APPVEYOR_PULL_REQUEST_NUMBER)
{
Write-Diagnostic "Pr Number: $env:APPVEYOR_PULL_REQUEST_NUMBER"
$SkipNugetForPr = $true
}
}
CheckIfPrBuild
DownloadNuget
NugetPackageRestore