From e8e47d5b144bb482c53deaf415bcaf51c16ca423 Mon Sep 17 00:00:00 2001 From: Florian Rappl Date: Wed, 15 May 2019 02:07:59 +0200 Subject: [PATCH] Updated code base --- .../AngleSharp.Samples.App.csproj | 502 +++++++++--------- AngleSharp.Samples.App/App.config | 80 +-- .../Properties/Resources.Designer.cs | 134 +++-- .../Properties/Settings.Designer.cs | 98 ++-- .../ViewModels/CssRuleViewModel.cs | 4 +- .../ViewModels/ErrorsViewModel.cs | 15 +- .../ViewModels/MainViewModel.cs | 17 +- .../ViewModels/ProfilerViewModel.cs | 34 +- .../ViewModels/ReplViewModel.cs | 4 +- .../ViewModels/SheetViewModel.cs | 20 +- .../ViewModels/TreeNodeViewModel.cs | 2 +- AngleSharp.Samples.App/packages.config | 26 +- .../AngleSharp.Samples.Demos.csproj | 172 +++--- AngleSharp.Samples.Demos/App.config | 36 +- .../Snippets/Construction.cs | 6 +- .../Snippets/CreateToc.cs | 5 +- .../Snippets/CustomEventScripting.cs | 5 +- .../Snippets/ExtendedScripting.cs | 2 +- .../Snippets/Html5Test.cs | 2 +- .../Snippets/LegacyEventScripting.cs | 5 +- .../Snippets/SimpleScripting.cs | 2 +- .../Snippets/SingleElements.cs | 4 +- .../Snippets/UsingLinq.cs | 4 +- .../StandardConsoleLogger.cs | 4 +- AngleSharp.Samples.Demos/packages.config | 13 +- AngleSharp.Samples.sln | 59 +- 26 files changed, 640 insertions(+), 615 deletions(-) diff --git a/AngleSharp.Samples.App/AngleSharp.Samples.App.csproj b/AngleSharp.Samples.App/AngleSharp.Samples.App.csproj index 199cebc..d909bce 100644 --- a/AngleSharp.Samples.App/AngleSharp.Samples.App.csproj +++ b/AngleSharp.Samples.App/AngleSharp.Samples.App.csproj @@ -1,253 +1,263 @@ - - - - - Debug - AnyCPU - {DA318620-F6B5-4DFA-B012-38F06141A2DD} - WinExe - Properties - Samples - Samples - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - ..\ - true - 65879974 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Logo.ico - - - - - ..\packages\AngleSharp.0.9.9\lib\net45\AngleSharp.dll - True - - - ..\packages\AngleSharp.Io.0.3.2\lib\net45\AngleSharp.Io.dll - True - - - ..\packages\AngleSharp.Scripting.JavaScript.0.5.0\lib\portable-windows8+net45+windowsphone8+wpa+monoandroid+monotouch\AngleSharp.Scripting.JavaScript.dll - True - - - ..\packages\Jint.2.9.1\lib\portable-net40+sl50+win+WindowsPhoneApp81+wp80\Jint.dll - True - - - ..\packages\MahApps.Metro.1.2.4.0\lib\net45\MahApps.Metro.dll - True - - - ..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll - True - - - False - ..\packages\OxyPlot.Core.2015.1.943-alpha\lib\net45\OxyPlot.dll - - - False - ..\packages\OxyPlot.Wpf.2015.1.943-alpha\lib\net45\OxyPlot.Wpf.dll - - - False - ..\packages\OxyPlot.Wpf.2015.1.943-alpha\lib\net45\OxyPlot.Xps.dll - - - - - ..\packages\Simple.Wpf.Terminal.1.35.0.0\lib\net40\Simple.Wpf.Terminal.dll - True - - - ..\packages\Simple.Wpf.Terminal.1.35.0.0\lib\net40\Simple.Wpf.Terminal.Themes.dll - True - - - - - - - - - ..\packages\MahApps.Metro.1.2.4.0\lib\net45\System.Windows.Interactivity.dll - True - - - - - - - - 4.0 - - - - - - - - - - MSBuild:Compile - Designer - - - Errors.xaml - - - Main.xaml - - - Profiler.xaml - - - Query.xaml - - - Repl.xaml - - - Sheets.xaml - - - Tree.xaml - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - Browser.xaml - - - Statistics.xaml - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - - - + + + + + Debug + AnyCPU + {DA318620-F6B5-4DFA-B012-38F06141A2DD} + WinExe + Properties + Samples + Samples + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + ..\ + true + 65879974 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + Logo.ico + + + + + ..\packages\AngleSharp.0.12.1\lib\net46\AngleSharp.dll + + + ..\packages\AngleSharp.Css.0.12.1\lib\net46\AngleSharp.Css.dll + + + ..\packages\AngleSharp.Io.0.12.1\lib\netstandard2.0\AngleSharp.Io.dll + + + ..\packages\AngleSharp.Js.0.12.1\lib\net46\AngleSharp.Js.dll + + + ..\packages\AngleSharp.Xml.0.12.1\lib\netstandard1.3\AngleSharp.Xml.dll + + + ..\packages\jint.2.10.4\lib\net45\jint.dll + + + ..\packages\MahApps.Metro.1.2.4.0\lib\net45\MahApps.Metro.dll + True + + + ..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll + True + + + False + ..\packages\OxyPlot.Core.2015.1.943-alpha\lib\net45\OxyPlot.dll + + + False + ..\packages\OxyPlot.Wpf.2015.1.943-alpha\lib\net45\OxyPlot.Wpf.dll + + + False + ..\packages\OxyPlot.Wpf.2015.1.943-alpha\lib\net45\OxyPlot.Xps.dll + + + + + ..\packages\Simple.Wpf.Terminal.1.35.0.0\lib\net40\Simple.Wpf.Terminal.dll + True + + + ..\packages\Simple.Wpf.Terminal.1.35.0.0\lib\net40\Simple.Wpf.Terminal.Themes.dll + True + + + + + + + + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Text.Encoding.CodePages.4.5.0\lib\net461\System.Text.Encoding.CodePages.dll + + + ..\packages\MahApps.Metro.1.2.4.0\lib\net45\System.Windows.Interactivity.dll + True + + + + + + + + 4.0 + + + + + + + + + + MSBuild:Compile + Designer + + + Errors.xaml + + + Main.xaml + + + Profiler.xaml + + + Query.xaml + + + Repl.xaml + + + Sheets.xaml + + + Tree.xaml + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + Browser.xaml + + + Statistics.xaml + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + --> \ No newline at end of file diff --git a/AngleSharp.Samples.App/App.config b/AngleSharp.Samples.App/App.config index ff69e2b..e22f638 100644 --- a/AngleSharp.Samples.App/App.config +++ b/AngleSharp.Samples.App/App.config @@ -1,38 +1,42 @@ - - - - -
- - - - - - - - - True - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + +
+ + + + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AngleSharp.Samples.App/Properties/Resources.Designer.cs b/AngleSharp.Samples.App/Properties/Resources.Designer.cs index 6db1f74..8a7df6b 100644 --- a/AngleSharp.Samples.App/Properties/Resources.Designer.cs +++ b/AngleSharp.Samples.App/Properties/Resources.Designer.cs @@ -1,71 +1,63 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18033 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Samples.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Samples.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Samples.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Samples.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/AngleSharp.Samples.App/Properties/Settings.Designer.cs b/AngleSharp.Samples.App/Properties/Settings.Designer.cs index 3701e20..d7e5056 100644 --- a/AngleSharp.Samples.App/Properties/Settings.Designer.cs +++ b/AngleSharp.Samples.App/Properties/Settings.Designer.cs @@ -1,49 +1,49 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18046 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Samples.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool SharedMode { - get { - return ((bool)(this["SharedMode"])); - } - set { - this["SharedMode"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection TypedUrls { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["TypedUrls"])); - } - set { - this["TypedUrls"] = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Samples.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool SharedMode { + get { + return ((bool)(this["SharedMode"])); + } + set { + this["SharedMode"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Collections.Specialized.StringCollection TypedUrls { + get { + return ((global::System.Collections.Specialized.StringCollection)(this["TypedUrls"])); + } + set { + this["TypedUrls"] = value; + } + } + } +} diff --git a/AngleSharp.Samples.App/ViewModels/CssRuleViewModel.cs b/AngleSharp.Samples.App/ViewModels/CssRuleViewModel.cs index f2a945c..c0e0365 100644 --- a/AngleSharp.Samples.App/ViewModels/CssRuleViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/CssRuleViewModel.cs @@ -1,6 +1,6 @@ namespace Samples.ViewModels -{ - using AngleSharp.Dom.Css; +{ + using AngleSharp.Css.Dom; using System; using System.Collections.ObjectModel; diff --git a/AngleSharp.Samples.App/ViewModels/ErrorsViewModel.cs b/AngleSharp.Samples.App/ViewModels/ErrorsViewModel.cs index 901285f..c501664 100644 --- a/AngleSharp.Samples.App/ViewModels/ErrorsViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/ErrorsViewModel.cs @@ -1,7 +1,10 @@ namespace Samples.ViewModels { - using AngleSharp; - using AngleSharp.Dom.Events; + using AngleSharp; + using AngleSharp.Css.Dom.Events; + using AngleSharp.Dom; + using AngleSharp.Dom.Events; + using AngleSharp.Html.Dom.Events; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -34,15 +37,13 @@ private void Register(Action listener) where T : Event { - _context.ParseError += (obj, ev) => + _context.AddEventListener(EventNames.Error, (obj, ev) => { - var data = ev as T; - - if (data != null) + if (ev is T data) { listener.Invoke(data); } - }; + }); } public void Reset() diff --git a/AngleSharp.Samples.App/ViewModels/MainViewModel.cs b/AngleSharp.Samples.App/ViewModels/MainViewModel.cs index 14baa27..74c9b69 100644 --- a/AngleSharp.Samples.App/ViewModels/MainViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/MainViewModel.cs @@ -1,6 +1,7 @@ namespace Samples.ViewModels { - using AngleSharp; + using AngleSharp; + using AngleSharp.Io; using System; using System.Threading; using System.Threading.Tasks; @@ -38,11 +39,15 @@ public MainViewModel() { - var config = Configuration.Default.WithCss().WithRequesters(setup => - { - setup.IsNavigationEnabled = true; - setup.IsResourceLoadingEnabled = true; - }).WithJavaScript(); + var config = Configuration.Default + .WithCss() + .WithCookies() + .WithJs() + .WithDefaultLoader(new LoaderOptions + { + IsNavigationDisabled = true, + IsResourceLoadingEnabled = true, + }); _context = BrowsingContext.New(config); _profiler = new ProfilerViewModel(_context); _errors = new ErrorsViewModel(_context); diff --git a/AngleSharp.Samples.App/ViewModels/ProfilerViewModel.cs b/AngleSharp.Samples.App/ViewModels/ProfilerViewModel.cs index e2f6538..d2adc79 100644 --- a/AngleSharp.Samples.App/ViewModels/ProfilerViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/ProfilerViewModel.cs @@ -1,7 +1,10 @@ namespace Samples.ViewModels { - using AngleSharp; - using AngleSharp.Dom.Events; + using AngleSharp; + using AngleSharp.Css.Dom.Events; + using AngleSharp.Dom; + using AngleSharp.Dom.Events; + using AngleSharp.Html.Dom.Events; using OxyPlot; using OxyPlot.Axes; using OxyPlot.Series; @@ -22,10 +25,10 @@ _tracker = new Dictionary(); _context = context; _model = CreateModel(); - _context.Parsing += TrackParsing; - _context.Parsed += TrackParsed; - _context.Requesting += TrackRequesting; - _context.Requested += TrackRequested; + _context.AddEventListener(EventNames.Parsing, TrackParsing); + _context.AddEventListener(EventNames.Parsed, TrackParsed); + _context.AddEventListener(EventNames.Requesting, TrackRequesting); + _context.AddEventListener(EventNames.Requested, TrackRequested); } private static PlotModel CreateModel() @@ -91,14 +94,11 @@ private void TrackParsing(Object sender, Event ev) { - var html = ev as HtmlParseEvent; - var css = ev as CssParseEvent; - - if (html != null) + if (ev is HtmlParseEvent html) { _tracker.Add(html.Document, _time.Elapsed); } - else if (css != null) + else if (ev is CssParseEvent css) { _tracker.Add(css.StyleSheet, _time.Elapsed); } @@ -106,20 +106,16 @@ private void TrackParsed(Object sender, Event ev) { - var html = ev as HtmlParseEvent; - var css = ev as CssParseEvent; - var start = default(TimeSpan); - - if (html != null && _tracker.TryGetValue(html.Document, out start)) + if (ev is HtmlParseEvent html && _tracker.TryGetValue(html.Document, out var startHtml)) { var document = html.Document; - AddItem("Parse HTML " + document.Url, OxyColors.Orange, start, _time.Elapsed); + AddItem("Parse HTML " + document.Url, OxyColors.Orange, startHtml, _time.Elapsed); _tracker.Remove(document); } - else if (css != null && _tracker.TryGetValue(css.StyleSheet, out start)) + else if (ev is CssParseEvent css && _tracker.TryGetValue(css.StyleSheet, out var startCss)) { var styleSheet = css.StyleSheet; - AddItem("Parse CSS " + styleSheet.Href, OxyColors.Violet, start, _time.Elapsed); + AddItem("Parse CSS " + styleSheet.Href, OxyColors.Violet, startCss, _time.Elapsed); _tracker.Remove(styleSheet); } } diff --git a/AngleSharp.Samples.App/ViewModels/ReplViewModel.cs b/AngleSharp.Samples.App/ViewModels/ReplViewModel.cs index 9fd2e1c..664bbf2 100644 --- a/AngleSharp.Samples.App/ViewModels/ReplViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/ReplViewModel.cs @@ -1,7 +1,7 @@ namespace Samples.ViewModels { - using AngleSharp.Dom; - using AngleSharp.Extensions; + using AngleSharp.Dom; + using AngleSharp.Js; using Jint.Runtime; using System; using System.Collections.ObjectModel; diff --git a/AngleSharp.Samples.App/ViewModels/SheetViewModel.cs b/AngleSharp.Samples.App/ViewModels/SheetViewModel.cs index 6986cdb..3073cff 100644 --- a/AngleSharp.Samples.App/ViewModels/SheetViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/SheetViewModel.cs @@ -1,7 +1,8 @@ namespace Samples.ViewModels -{ +{ + using AngleSharp.Css.Dom; + using AngleSharp.Css.Dom.Events; using AngleSharp.Dom; - using AngleSharp.Dom.Css; using AngleSharp.Dom.Events; using System; using System.Collections.ObjectModel; @@ -37,9 +38,8 @@ _selected = value; RaisePropertyChanged(); _tree.Clear(); - var sheet = _selected as ICssStyleSheet; - if (sheet != null) + if (_selected is ICssStyleSheet sheet) { for (int i = 0; i < sheet.Rules.Length; i++) { @@ -57,7 +57,7 @@ { if (_document != null) { - _document.Context.Parsed -= ParseEnded; + _document.Context.RemoveEventListener(EventNames.Parsed, ParseEnded); } _document = value; @@ -66,18 +66,16 @@ foreach (var sheet in _document.StyleSheets) { _source.Add(sheet); - } - - _document.Context.Parsed += ParseEnded; + } + + _document.Context.AddEventListener(EventNames.Parsed, ParseEnded); Selected = null; } } private void ParseEnded(Object sender, Event ev) { - var data = ev as CssParseEvent; - - if (data != null) + if (ev is CssParseEvent data) { App.Current.Dispatcher.Invoke(() => _source.Add(data.StyleSheet)); } diff --git a/AngleSharp.Samples.App/ViewModels/TreeNodeViewModel.cs b/AngleSharp.Samples.App/ViewModels/TreeNodeViewModel.cs index 36d1348..9d2508d 100644 --- a/AngleSharp.Samples.App/ViewModels/TreeNodeViewModel.cs +++ b/AngleSharp.Samples.App/ViewModels/TreeNodeViewModel.cs @@ -104,7 +104,7 @@ if (data.Length == 0) return null; - return new TreeNodeViewModel { Value = HtmlMarkupFormatter.Instance.Text(text.Data), Foreground = Brushes.SteelBlue }; + return new TreeNodeViewModel { Value = HtmlMarkupFormatter.Instance.Text(text), Foreground = Brushes.SteelBlue }; } private static TreeNodeViewModel Create(IElement node) diff --git a/AngleSharp.Samples.App/packages.config b/AngleSharp.Samples.App/packages.config index 438a0d4..6d74c43 100644 --- a/AngleSharp.Samples.App/packages.config +++ b/AngleSharp.Samples.App/packages.config @@ -1,12 +1,16 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AngleSharp.Samples.Demos/AngleSharp.Samples.Demos.csproj b/AngleSharp.Samples.Demos/AngleSharp.Samples.Demos.csproj index c0ef34e..12bdbc1 100644 --- a/AngleSharp.Samples.Demos/AngleSharp.Samples.Demos.csproj +++ b/AngleSharp.Samples.Demos/AngleSharp.Samples.Demos.csproj @@ -1,89 +1,97 @@ - - - - - Debug - AnyCPU - {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760} - Exe - Properties - AngleSharp.Samples.Demos - AngleSharp.Samples.Demos - v4.5 - 512 - ba6035cc - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\AngleSharp.0.9.9\lib\net45\AngleSharp.dll - True - - - ..\packages\AngleSharp.Scripting.JavaScript.0.5.0\lib\portable-windows8+net45+windowsphone8+wpa+monoandroid+monotouch\AngleSharp.Scripting.JavaScript.dll - True - - - ..\packages\Jint.2.9.1\lib\portable-net40+sl50+win+WindowsPhoneApp81+wp80\Jint.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760} + Exe + Properties + AngleSharp.Samples.Demos + AngleSharp.Samples.Demos + v4.6.1 + 512 + ba6035cc + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\AngleSharp.0.12.1\lib\net46\AngleSharp.dll + + + ..\packages\AngleSharp.Css.0.12.1\lib\net46\AngleSharp.Css.dll + + + ..\packages\AngleSharp.Js.0.12.1\lib\net46\AngleSharp.Js.dll + + + ..\packages\jint.2.10.4\lib\net45\jint.dll + + + + + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Text.Encoding.CodePages.4.5.0\lib\net46\System.Text.Encoding.CodePages.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> \ No newline at end of file diff --git a/AngleSharp.Samples.Demos/App.config b/AngleSharp.Samples.Demos/App.config index 3615a95..c63b321 100644 --- a/AngleSharp.Samples.Demos/App.config +++ b/AngleSharp.Samples.Demos/App.config @@ -1,18 +1,18 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + diff --git a/AngleSharp.Samples.Demos/Snippets/Construction.cs b/AngleSharp.Samples.Demos/Snippets/Construction.cs index c3bf2bd..07fa9b5 100644 --- a/AngleSharp.Samples.Demos/Snippets/Construction.cs +++ b/AngleSharp.Samples.Demos/Snippets/Construction.cs @@ -1,7 +1,7 @@ namespace AngleSharp.Samples.Demos.Snippets -{ - using AngleSharp.Dom.Html; - using AngleSharp.Extensions; +{ + using AngleSharp.Dom; + using AngleSharp.Html.Dom; using System; using System.Threading.Tasks; diff --git a/AngleSharp.Samples.Demos/Snippets/CreateToc.cs b/AngleSharp.Samples.Demos/Snippets/CreateToc.cs index 3aef97f..f2185b1 100644 --- a/AngleSharp.Samples.Demos/Snippets/CreateToc.cs +++ b/AngleSharp.Samples.Demos/Snippets/CreateToc.cs @@ -1,8 +1,7 @@ namespace AngleSharp.Samples.Demos.Snippets { - using AngleSharp.Dom; - using AngleSharp.Dom.Html; - using AngleSharp.Extensions; + using AngleSharp.Dom; + using AngleSharp.Html.Dom; using System; using System.Collections.Generic; using System.Linq; diff --git a/AngleSharp.Samples.Demos/Snippets/CustomEventScripting.cs b/AngleSharp.Samples.Demos/Snippets/CustomEventScripting.cs index 0465cdd..aa091b7 100644 --- a/AngleSharp.Samples.Demos/Snippets/CustomEventScripting.cs +++ b/AngleSharp.Samples.Demos/Snippets/CustomEventScripting.cs @@ -8,8 +8,9 @@ public async Task Run() { // We require a custom configuration with JavaScript - var config = Configuration.Default.WithJavaScript(). - WithConsoleLogger(context => new StandardConsoleLogger()); + var config = Configuration.Default + .WithJs() + .WithConsoleLogger(context => new StandardConsoleLogger()); // This is our sample source, we will trigger the load event var source = @" diff --git a/AngleSharp.Samples.Demos/Snippets/ExtendedScripting.cs b/AngleSharp.Samples.Demos/Snippets/ExtendedScripting.cs index 787b1bc..02b5ca4 100644 --- a/AngleSharp.Samples.Demos/Snippets/ExtendedScripting.cs +++ b/AngleSharp.Samples.Demos/Snippets/ExtendedScripting.cs @@ -9,7 +9,7 @@ { //We require a custom configuration with JavaScript and CSS var config = Configuration.Default - .WithJavaScript() + .WithJs() .WithCss(); // This is our sample source, we will do some DOM manipulation diff --git a/AngleSharp.Samples.Demos/Snippets/Html5Test.cs b/AngleSharp.Samples.Demos/Snippets/Html5Test.cs index 9ffb888..a5a3ff3 100644 --- a/AngleSharp.Samples.Demos/Snippets/Html5Test.cs +++ b/AngleSharp.Samples.Demos/Snippets/Html5Test.cs @@ -10,7 +10,7 @@ { // We require a custom configuration with JavaScript, CSS and the default loader var config = Configuration.Default - .WithJavaScript() + .WithJs() .WithCss() .WithDefaultLoader(); diff --git a/AngleSharp.Samples.Demos/Snippets/LegacyEventScripting.cs b/AngleSharp.Samples.Demos/Snippets/LegacyEventScripting.cs index 2538f08..86d3f70 100644 --- a/AngleSharp.Samples.Demos/Snippets/LegacyEventScripting.cs +++ b/AngleSharp.Samples.Demos/Snippets/LegacyEventScripting.cs @@ -8,8 +8,9 @@ public async Task Run() { // We require a custom configuration with JavaScript - var config = Configuration.Default.WithJavaScript(). - WithConsoleLogger(context => new StandardConsoleLogger()); + var config = Configuration.Default + .WithJs() + .WithConsoleLogger(context => new StandardConsoleLogger()); // This is our sample source, we will trigger the load event var source = @" diff --git a/AngleSharp.Samples.Demos/Snippets/SimpleScripting.cs b/AngleSharp.Samples.Demos/Snippets/SimpleScripting.cs index 93d05d4..c139d8e 100644 --- a/AngleSharp.Samples.Demos/Snippets/SimpleScripting.cs +++ b/AngleSharp.Samples.Demos/Snippets/SimpleScripting.cs @@ -8,7 +8,7 @@ public async Task Run() { // We require a custom configuration with JavaScript - var config = Configuration.Default.WithJavaScript(); + var config = Configuration.Default.WithJs(); // This is our sample source, we will set the title and write on the document var source = @" diff --git a/AngleSharp.Samples.Demos/Snippets/SingleElements.cs b/AngleSharp.Samples.Demos/Snippets/SingleElements.cs index f3fe82e..15183aa 100644 --- a/AngleSharp.Samples.Demos/Snippets/SingleElements.cs +++ b/AngleSharp.Samples.Demos/Snippets/SingleElements.cs @@ -1,6 +1,6 @@ namespace AngleSharp.Samples.Demos.Snippets -{ - using AngleSharp.Extensions; +{ + using AngleSharp.Dom; using System; using System.Threading.Tasks; diff --git a/AngleSharp.Samples.Demos/Snippets/UsingLinq.cs b/AngleSharp.Samples.Demos/Snippets/UsingLinq.cs index e2a9e8d..3dd836d 100644 --- a/AngleSharp.Samples.Demos/Snippets/UsingLinq.cs +++ b/AngleSharp.Samples.Demos/Snippets/UsingLinq.cs @@ -1,6 +1,6 @@ namespace AngleSharp.Samples.Demos.Snippets -{ - using AngleSharp.Extensions; +{ + using AngleSharp.Dom; using System; using System.Linq; using System.Threading.Tasks; diff --git a/AngleSharp.Samples.Demos/StandardConsoleLogger.cs b/AngleSharp.Samples.Demos/StandardConsoleLogger.cs index d19bbd7..07b845b 100644 --- a/AngleSharp.Samples.Demos/StandardConsoleLogger.cs +++ b/AngleSharp.Samples.Demos/StandardConsoleLogger.cs @@ -1,6 +1,6 @@ namespace AngleSharp.Samples.Demos -{ - using AngleSharp.Scripting.JavaScript.Services; +{ + using AngleSharp.Js; using System; using System.Linq; diff --git a/AngleSharp.Samples.Demos/packages.config b/AngleSharp.Samples.Demos/packages.config index 5e4177e..38c9daa 100644 --- a/AngleSharp.Samples.Demos/packages.config +++ b/AngleSharp.Samples.Demos/packages.config @@ -1,6 +1,9 @@ - - - - - + + + + + + + + \ No newline at end of file diff --git a/AngleSharp.Samples.sln b/AngleSharp.Samples.sln index 4e901ce..243c9f5 100644 --- a/AngleSharp.Samples.sln +++ b/AngleSharp.Samples.sln @@ -1,28 +1,31 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.22310.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Samples.App", "AngleSharp.Samples.App\AngleSharp.Samples.App.csproj", "{DA318620-F6B5-4DFA-B012-38F06141A2DD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Samples.Demos", "AngleSharp.Samples.Demos\AngleSharp.Samples.Demos.csproj", "{3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Release|Any CPU.Build.0 = Release|Any CPU - {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.572 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Samples.App", "AngleSharp.Samples.App\AngleSharp.Samples.App.csproj", "{DA318620-F6B5-4DFA-B012-38F06141A2DD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Samples.Demos", "AngleSharp.Samples.Demos\AngleSharp.Samples.Demos.csproj", "{3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA318620-F6B5-4DFA-B012-38F06141A2DD}.Release|Any CPU.Build.0 = Release|Any CPU + {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F8D45C0-140D-4A48-B1DC-91BF3F4EC760}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0DF14775-AB02-41C1-B392-62858D096DB1} + EndGlobalSection +EndGlobal