From 841faea234d6ca715e779130e3314e5049a8202d Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Wed, 8 Dec 2021 09:52:48 +1000 Subject: [PATCH] Upgrade to 96.0.142 (#142) * Update to 96.0.140-pre * Upgrade to 96.0.141 * Minor code cleanup --- .../CefSharp.MinimalExample.OffScreen.csproj | 20 +++++++-------- ...rp.MinimalExample.OffScreen.netcore.csproj | 2 +- CefSharp.MinimalExample.OffScreen/Program.cs | 25 ++++++------------- .../packages.config | 8 +++--- .../BrowserForm.cs | 2 +- .../CefSharp.MinimalExample.WinForms.csproj | 20 +++++++-------- ...harp.MinimalExample.WinForms.net472.csproj | 2 +- ...arp.MinimalExample.WinForms.netcore.csproj | 2 +- CefSharp.MinimalExample.WinForms/Program.cs | 2 +- .../packages.config | 8 +++--- .../CefSharp.MinimalExample.Wpf.csproj | 20 +++++++-------- ...CefSharp.MinimalExample.Wpf.netcore.csproj | 2 +- CefSharp.MinimalExample.Wpf/packages.config | 8 +++--- UpdateNugetPackages.bat | 2 +- 14 files changed, 57 insertions(+), 66 deletions(-) diff --git a/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.csproj b/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.csproj index 5b45d38..7d7cacf 100644 --- a/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.csproj +++ b/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.csproj @@ -1,8 +1,8 @@  - - - + + + Debug @@ -88,16 +88,16 @@ CefSharp.MinimalExample.OffScreen.Program - - ..\packages\CefSharp.Common.95.7.141\lib\net452\CefSharp.dll + + ..\packages\CefSharp.Common.96.0.141\lib\net452\CefSharp.dll True - - ..\packages\CefSharp.Common.95.7.141\lib\net452\CefSharp.Core.dll + + ..\packages\CefSharp.Common.96.0.141\lib\net452\CefSharp.Core.dll True - - ..\packages\CefSharp.OffScreen.95.7.141\lib\net452\CefSharp.OffScreen.dll + + ..\packages\CefSharp.OffScreen.96.0.141\lib\net452\CefSharp.OffScreen.dll True @@ -123,5 +123,5 @@ - + \ No newline at end of file diff --git a/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.netcore.csproj b/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.netcore.csproj index de9fdca..2a0d6e9 100644 --- a/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.netcore.csproj +++ b/CefSharp.MinimalExample.OffScreen/CefSharp.MinimalExample.OffScreen.netcore.csproj @@ -61,7 +61,7 @@ - + diff --git a/CefSharp.MinimalExample.OffScreen/Program.cs b/CefSharp.MinimalExample.OffScreen/Program.cs index 829bd14..ef7b4a0 100644 --- a/CefSharp.MinimalExample.OffScreen/Program.cs +++ b/CefSharp.MinimalExample.OffScreen/Program.cs @@ -14,7 +14,7 @@ namespace CefSharp.MinimalExample.OffScreen /// /// CefSharp.OffScreen Minimal Example /// - public class Program + public static class Program { /// /// Asynchronous demo using CefSharp.OffScreen @@ -71,12 +71,12 @@ namespace CefSharp.MinimalExample.OffScreen throw new Exception(string.Format("Page load failed with ErrorCode:{0}, HttpStatusCode:{1}", initialLoadResponse.ErrorCode, initialLoadResponse.HttpStatusCode)); } - var response = await browser.EvaluateScriptAsync("document.querySelector('[name=q]').value = 'CefSharp Was Here!'"); + _ = await browser.EvaluateScriptAsync("document.querySelector('[name=q]').value = 'CefSharp Was Here!'"); //Give the browser a little time to render await Task.Delay(500); // Wait for the screenshot to be taken. - var bitmap = await browser.ScreenshotAsync(); + var bitmapAsByteArray = await browser.CaptureScreenshotAsync(); // File path to save our screenshot e.g. C:\Users\{username}\Desktop\CefSharp screenshot.png var screenshotPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "CefSharp screenshot.png"); @@ -84,13 +84,7 @@ namespace CefSharp.MinimalExample.OffScreen 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. - bitmap.Save(screenshotPath); - - // We no longer need the Bitmap. - // Dispose it to avoid keeping the memory alive. Especially important in 32-bit applications. - bitmap.Dispose(); + File.WriteAllBytes(screenshotPath, bitmapAsByteArray); Console.WriteLine("Screenshot saved. Launching your default image viewer..."); @@ -172,7 +166,7 @@ namespace CefSharp.MinimalExample.OffScreen //Give the browser a little time to render Thread.Sleep(500); // Wait for the screenshot to be taken. - var task = browser.ScreenshotAsync(); + var task = browser.CaptureScreenshotAsync(); task.ContinueWith(x => { // File path to save our screenshot e.g. C:\Users\{username}\Desktop\CefSharp screenshot.png @@ -181,13 +175,10 @@ namespace CefSharp.MinimalExample.OffScreen 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); + var bitmapAsByteArray = x.Result; - // We no longer need the Bitmap. - // Dispose it to avoid keeping the memory alive. Especially important in 32-bit applications. - task.Result.Dispose(); + // Save the Bitmap to the path. + File.WriteAllBytes(screenshotPath, bitmapAsByteArray); Console.WriteLine("Screenshot saved. Launching your default image viewer..."); diff --git a/CefSharp.MinimalExample.OffScreen/packages.config b/CefSharp.MinimalExample.OffScreen/packages.config index e628be1..28e9f9a 100644 --- a/CefSharp.MinimalExample.OffScreen/packages.config +++ b/CefSharp.MinimalExample.OffScreen/packages.config @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff --git a/CefSharp.MinimalExample.WinForms/BrowserForm.cs b/CefSharp.MinimalExample.WinForms/BrowserForm.cs index b1a17c8..d9a07e2 100644 --- a/CefSharp.MinimalExample.WinForms/BrowserForm.cs +++ b/CefSharp.MinimalExample.WinForms/BrowserForm.cs @@ -16,7 +16,7 @@ namespace CefSharp.MinimalExample.WinForms #else private const string Build = "Release"; #endif - private string title = "CefSharp.MinimalExample.WinForms (" + Build + ")"; + private readonly string title = "CefSharp.MinimalExample.WinForms (" + Build + ")"; private readonly ChromiumWebBrowser browser; public BrowserForm() diff --git a/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.csproj b/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.csproj index 59d7b90..d6bb17c 100644 --- a/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.csproj +++ b/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.csproj @@ -1,8 +1,8 @@  - - - + + + Debug AnyCPU @@ -72,16 +72,16 @@ app.manifest - - ..\packages\CefSharp.Common.95.7.141\lib\net452\CefSharp.dll + + ..\packages\CefSharp.Common.96.0.141\lib\net452\CefSharp.dll True - - ..\packages\CefSharp.Common.95.7.141\lib\net452\CefSharp.Core.dll + + ..\packages\CefSharp.Common.96.0.141\lib\net452\CefSharp.Core.dll True - - ..\packages\CefSharp.WinForms.95.7.141\lib\net452\CefSharp.WinForms.dll + + ..\packages\CefSharp.WinForms.96.0.141\lib\net452\CefSharp.WinForms.dll True @@ -144,5 +144,5 @@ - + \ No newline at end of file diff --git a/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.net472.csproj b/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.net472.csproj index 0d82a94..6a3450b 100644 --- a/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.net472.csproj +++ b/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.net472.csproj @@ -47,7 +47,7 @@ - + diff --git a/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.netcore.csproj b/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.netcore.csproj index 708f657..d637069 100644 --- a/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.netcore.csproj +++ b/CefSharp.MinimalExample.WinForms/CefSharp.MinimalExample.WinForms.netcore.csproj @@ -68,7 +68,7 @@ - + diff --git a/CefSharp.MinimalExample.WinForms/Program.cs b/CefSharp.MinimalExample.WinForms/Program.cs index f61349c..280aba3 100644 --- a/CefSharp.MinimalExample.WinForms/Program.cs +++ b/CefSharp.MinimalExample.WinForms/Program.cs @@ -9,7 +9,7 @@ using System.Windows.Forms; namespace CefSharp.MinimalExample.WinForms { - public class Program + public static class Program { [STAThread] public static int Main(string[] args) diff --git a/CefSharp.MinimalExample.WinForms/packages.config b/CefSharp.MinimalExample.WinForms/packages.config index e4de504..cc48e2a 100644 --- a/CefSharp.MinimalExample.WinForms/packages.config +++ b/CefSharp.MinimalExample.WinForms/packages.config @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff --git a/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.csproj b/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.csproj index 6e0929c..bc3300c 100644 --- a/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.csproj +++ b/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.csproj @@ -1,8 +1,8 @@  - - - + + + Debug @@ -91,16 +91,16 @@ app.manifest - - ..\packages\CefSharp.Common.95.7.141\lib\net452\CefSharp.dll + + ..\packages\CefSharp.Common.96.0.141\lib\net452\CefSharp.dll True - - ..\packages\CefSharp.Common.95.7.141\lib\net452\CefSharp.Core.dll + + ..\packages\CefSharp.Common.96.0.141\lib\net452\CefSharp.Core.dll True - - ..\packages\CefSharp.Wpf.95.7.141\lib\net452\CefSharp.Wpf.dll + + ..\packages\CefSharp.Wpf.96.0.141\lib\net452\CefSharp.Wpf.dll True @@ -179,5 +179,5 @@ - + \ No newline at end of file diff --git a/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.netcore.csproj b/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.netcore.csproj index 3428a0b..2853c05 100644 --- a/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.netcore.csproj +++ b/CefSharp.MinimalExample.Wpf/CefSharp.MinimalExample.Wpf.netcore.csproj @@ -65,7 +65,7 @@ - + diff --git a/CefSharp.MinimalExample.Wpf/packages.config b/CefSharp.MinimalExample.Wpf/packages.config index 1c975b4..8134baf 100644 --- a/CefSharp.MinimalExample.Wpf/packages.config +++ b/CefSharp.MinimalExample.Wpf/packages.config @@ -1,8 +1,8 @@  - - - - + + + + \ No newline at end of file diff --git a/UpdateNugetPackages.bat b/UpdateNugetPackages.bat index 277d9be..63152d0 100644 --- a/UpdateNugetPackages.bat +++ b/UpdateNugetPackages.bat @@ -1,4 +1,4 @@ -SET cefsharpversion=95.7.141 +SET cefsharpversion=96.0.141 ..\nuget restore CefSharp.MinimalExample.sln