Decompiled source of OnTogetherSchoolScreen v0.1.12
BepInEx/plugins/Microsoft.Web.WebView2.Core.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Security; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.Web.WebView2.Core.Raw; using Microsoft.Win32.SafeHandles; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: InternalsVisibleTo("Microsoft.Web.WebView2.WinForms, PublicKey=00240000048000009400000006020000002400005253413100040000010001005dba207a79aa19b084a6b574c6f8945bd211921eaefa27a8031dd74b31af8094b3945f00288bc93f0751ecc62d3f5ca42681f09ed4ff1716aefc600bee20b042828dd897db022a07459a20a1042d0fcdd4a19610e838f5cfd992bcad1499861e24a28e5884452ce638803b5fac55a9967d92794723d2f4a0b49cc1148ae03dc7")] [assembly: InternalsVisibleTo("Microsoft.Web.WebView2.Wpf, PublicKey=00240000048000009400000006020000002400005253413100040000010001005dba207a79aa19b084a6b574c6f8945bd211921eaefa27a8031dd74b31af8094b3945f00288bc93f0751ecc62d3f5ca42681f09ed4ff1716aefc600bee20b042828dd897db022a07459a20a1042d0fcdd4a19610e838f5cfd992bcad1499861e24a28e5884452ce638803b5fac55a9967d92794723d2f4a0b49cc1148ae03dc7")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyConfiguration("Release")] [assembly: Debuggable(false, false)] [assembly: AssemblyCopyright("Copyright ©2020")] [assembly: AssemblyProduct("WebView2 .NET Interop Wrapper")] [assembly: AssemblyTitle("Microsoft.Web.WebView2.Core")] [assembly: InternalsVisibleTo("dotNetAPIWrapperGeneratorTester, PublicKey=00240000048000009400000006020000002400005253413100040000010001005dba207a79aa19b084a6b574c6f8945bd211921eaefa27a8031dd74b31af8094b3945f00288bc93f0751ecc62d3f5ca42681f09ed4ff1716aefc600bee20b042828dd897db022a07459a20a1042d0fcdd4a19610e838f5cfd992bcad1499861e24a28e5884452ce638803b5fac55a9967d92794723d2f4a0b49cc1148ae03dc7")] [assembly: AssemblyFileVersion("1.0.4258.31")] [assembly: AssemblyVersion("1.0.4258.31")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Microsoft.Web.WebView2.Core { internal static class COMDotNetTypeConverter { public static IReadOnlyList<string> stringCollectionCOMToNet(ICoreWebView2StringCollection rawCollection) { if (rawCollection == null) { return null; } List<string> list = new List<string>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(rawCollection.GetValueAtIndex(num)); } return new ReadOnlyCollection<string>(list); } public static IReadOnlyList<CoreWebView2ClientCertificate> CoreWebView2ClientCertificateCollectionCOMToNet(ICoreWebView2ClientCertificateCollection rawCollection) { if (rawCollection == null) { return null; } List<CoreWebView2ClientCertificate> list = new List<CoreWebView2ClientCertificate>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(new CoreWebView2ClientCertificate(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2ClientCertificate>(list); } public static IReadOnlyList<Rectangle> RectangleCollectionCOMToNet(ICoreWebView2RegionRectCollectionView rawCollection) { if (rawCollection == null) { return null; } List<Rectangle> list = new List<Rectangle>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(RectangleCOMToNet(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<Rectangle>(list); } public static IReadOnlyList<CoreWebView2ProcessExtendedInfo> CoreWebView2ProcessExtendedInfoCollectionCOMToNet(ICoreWebView2ProcessExtendedInfoCollection rawCollection) { if (rawCollection == null) { return null; } List<CoreWebView2ProcessExtendedInfo> list = new List<CoreWebView2ProcessExtendedInfo>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(new CoreWebView2ProcessExtendedInfo(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2ProcessExtendedInfo>(list); } public static IReadOnlyList<CoreWebView2ProcessInfo> CoreWebView2ProcessInfoCollectionCOMToNet(ICoreWebView2ProcessInfoCollection rawCollection) { if (rawCollection == null) { return null; } List<CoreWebView2ProcessInfo> list = new List<CoreWebView2ProcessInfo>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(new CoreWebView2ProcessInfo(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2ProcessInfo>(list); } public static IReadOnlyList<CoreWebView2BrowserExtension> CoreWebView2BrowserExtensionCollectionCOMToNet(ICoreWebView2BrowserExtensionList rawCollection) { if (rawCollection == null) { return null; } List<CoreWebView2BrowserExtension> list = new List<CoreWebView2BrowserExtension>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(new CoreWebView2BrowserExtension(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2BrowserExtension>(list); } public static IReadOnlyList<CoreWebView2ServiceWorkerRegistration> CoreWebView2ServiceWorkerRegistrationCollectionCOMToNet(ICoreWebView2ServiceWorkerRegistrationCollectionView rawCollection) { if (rawCollection == null) { return null; } List<CoreWebView2ServiceWorkerRegistration> list = new List<CoreWebView2ServiceWorkerRegistration>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(new CoreWebView2ServiceWorkerRegistration(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2ServiceWorkerRegistration>(list); } public static IReadOnlyList<CoreWebView2SharedWorker> CoreWebView2SharedWorkerCollectionCOMToNet(ICoreWebView2SharedWorkerCollectionView rawCollection) { if (rawCollection == null) { return null; } List<CoreWebView2SharedWorker> list = new List<CoreWebView2SharedWorker>(Convert.ToInt32(rawCollection.Count)); for (uint num = 0u; num < rawCollection.Count; num++) { list.Add(new CoreWebView2SharedWorker(rawCollection.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2SharedWorker>(list); } public static Rectangle RectangleCOMToNet(tagRECT rect) { int x = rect.left; int y = rect.top; int width = rect.right - rect.left; int height = rect.bottom - rect.top; return new Rectangle(x, y, width, height); } public static tagRECT RectangleNetToCOM(Rectangle dotNetRect) { return new tagRECT { top = dotNetRect.Top, left = dotNetRect.Left, right = dotNetRect.Right, bottom = dotNetRect.Bottom }; } public static List<CoreWebView2Cookie> CoreWebView2CookieCollectionCOMToNet(ICoreWebView2CookieList rawCookieList) { List<CoreWebView2Cookie> list = new List<CoreWebView2Cookie>(Convert.ToInt32(rawCookieList.Count)); for (uint num = 0u; num < rawCookieList.Count; num++) { list.Add(new CoreWebView2Cookie(rawCookieList.GetValueAtIndex(num))); } return list; } public static IReadOnlyList<CoreWebView2FrameInfo> CoreWebView2FrameInfoCollectionCOMToNet(ICoreWebView2FrameInfoCollection rawFrameInfoCollection) { if (rawFrameInfoCollection == null) { return null; } List<CoreWebView2FrameInfo> list = new List<CoreWebView2FrameInfo>(); ICoreWebView2FrameInfoCollectionIterator iterator = rawFrameInfoCollection.GetIterator(); while (iterator.HasCurrent != 0) { list.Add(new CoreWebView2FrameInfo(iterator.GetCurrent())); iterator.MoveNext(); } return new ReadOnlyCollection<CoreWebView2FrameInfo>(list); } public static Color ColorCOMToNet(COREWEBVIEW2_COLOR color) { return Color.FromArgb(color.A, color.R, color.G, color.B); } public static COREWEBVIEW2_COLOR ColorNetToCOM(Color dotNetColor) { return new COREWEBVIEW2_COLOR { A = dotNetColor.A, R = dotNetColor.R, G = dotNetColor.G, B = dotNetColor.B }; } public static Point PointCOMToNet(tagPOINT point) { return new Point(point.x, point.y); } public static tagPOINT PointNetToCOM(Point dotNetPoint) { return new tagPOINT { x = Convert.ToInt32(dotNetPoint.X), y = Convert.ToInt32(dotNetPoint.Y) }; } public static TimeSpan ThrottlingIntervalCOMToNet(int intervalMs) { return new TimeSpan(0, 0, 0, 0, intervalMs); } public static int ThrottlingIntervalNetToCOM(TimeSpan timeSpan) { return timeSpan.Milliseconds; } public static IReadOnlyList<string> CoreWebView2StringCollectionCOMToNet(ICoreWebView2StringCollection rawStringCollection) { if (rawStringCollection == null) { return null; } List<string> list = new List<string>(Convert.ToInt32(rawStringCollection.Count)); for (uint num = 0u; num < rawStringCollection.Count; num++) { list.Add(rawStringCollection.GetValueAtIndex(num)); } return new ReadOnlyCollection<string>(list); } public static IReadOnlyList<object> objectCollectionCOMToNet(ICoreWebView2ObjectCollectionView rawObjectCollection) { if (rawObjectCollection == null) { return null; } List<object> list = new List<object>(Convert.ToInt32(rawObjectCollection.Count)); for (uint num = 0u; num < rawObjectCollection.Count; num++) { object obj = rawObjectCollection.GetValueAtIndex(num); if (obj != null) { if (!(obj is ICoreWebView2File rawCoreWebView2File)) { continue; } obj = new CoreWebView2File(rawCoreWebView2File); } list.Add(obj); } return new ReadOnlyCollection<object>(list); } public static IList<CoreWebView2ContextMenuItem> CoreWebView2ContextMenuItemCollectionCOMToNet(ICoreWebView2ContextMenuItemCollection rawContextMenuCollection) { if (rawContextMenuCollection == null) { return null; } List<CoreWebView2ContextMenuItem> list = new List<CoreWebView2ContextMenuItem>(Convert.ToInt32(rawContextMenuCollection.Count)); for (uint num = 0u; num < rawContextMenuCollection.Count; num++) { list.Add(new CoreWebView2ContextMenuItem(rawContextMenuCollection.GetValueAtIndex(num))); } ObservableCollection<CoreWebView2ContextMenuItem> collection = new ObservableCollection<CoreWebView2ContextMenuItem>(list); collection.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { switch (args.Action) { case NotifyCollectionChangedAction.Remove: rawContextMenuCollection.RemoveValueAtIndex((uint)args.OldStartingIndex); break; case NotifyCollectionChangedAction.Add: rawContextMenuCollection.InsertValueAtIndex((uint)args.NewStartingIndex, ((CoreWebView2ContextMenuItem)args.NewItems[0])._nativeICoreWebView2ContextMenuItem); break; case NotifyCollectionChangedAction.Replace: rawContextMenuCollection.RemoveValueAtIndex((uint)args.OldStartingIndex); rawContextMenuCollection.InsertValueAtIndex((uint)args.NewStartingIndex, ((CoreWebView2ContextMenuItem)args.NewItems[0])._nativeICoreWebView2ContextMenuItem); break; case NotifyCollectionChangedAction.Move: case NotifyCollectionChangedAction.Reset: { uint count = rawContextMenuCollection.Count; for (uint num2 = 0u; num2 < count; num2++) { rawContextMenuCollection.RemoveValueAtIndex(0u); } for (int i = 0; i < collection.Count; i++) { rawContextMenuCollection.InsertValueAtIndex((uint)i, collection[i]._nativeICoreWebView2ContextMenuItem); } break; } } }; return collection; } public static IReadOnlyList<Rectangle> CoreWebView2RegionRectCollectionViewCOMToNet(ICoreWebView2RegionRectCollectionView regionList) { if (regionList == null) { return null; } List<Rectangle> list = new List<Rectangle>(Convert.ToInt32(regionList.Count)); for (uint num = 0u; num < regionList.Count; num++) { list.Add(RectangleCOMToNet(regionList.GetValueAtIndex(num))); } return new ReadOnlyCollection<Rectangle>(list); } public static COMStreamWrapper StreamCOMToNet(IStream stream) { if (stream == null) { return null; } return new COMStreamWrapper(stream); } public static IReadOnlyList<CoreWebView2PermissionSetting> CoreWebView2PermissionSettingCollectionCOMToNet(ICoreWebView2PermissionSettingCollectionView rawPermissionSettingCollectionView) { if (rawPermissionSettingCollectionView == null) { return null; } List<CoreWebView2PermissionSetting> list = new List<CoreWebView2PermissionSetting>(Convert.ToInt32(rawPermissionSettingCollectionView.Count)); for (uint num = 0u; num < rawPermissionSettingCollectionView.Count; num++) { list.Add(new CoreWebView2PermissionSetting(rawPermissionSettingCollectionView.GetValueAtIndex(num))); } return new ReadOnlyCollection<CoreWebView2PermissionSetting>(list); } public static ICoreWebView2ObjectCollectionView CoreWebView2WebObjectCollectionViewNetToCOM(List<object> dotNetObjectCollection) { return new CoreWebView2WebObjectCollectionView(dotNetObjectCollection); } } public enum CoreWebView2BoundsMode { UseRawPixels, UseRasterizationScale } public enum CoreWebView2BrowserProcessExitKind { Normal, Failed } [Flags] public enum CoreWebView2BrowsingDataKinds { FileSystems = 1, IndexedDb = 2, LocalStorage = 4, WebSql = 8, CacheStorage = 0x10, AllDomStorage = 0x20, Cookies = 0x40, AllSite = 0x80, DiskCache = 0x100, DownloadHistory = 0x200, GeneralAutofill = 0x400, PasswordAutosave = 0x800, BrowsingHistory = 0x1000, Settings = 0x2000, AllProfile = 0x4000, ServiceWorkers = 0x8000 } public enum CoreWebView2CapturePreviewImageFormat { Png, Jpeg } public enum CoreWebView2ChannelSearchKind { MostStable, LeastStable } public enum CoreWebView2ClientCertificateKind { SmartCard, Pin, Other } public enum CoreWebView2ContextMenuItemKind { Command, CheckBox, Radio, Separator, Submenu } public enum CoreWebView2ContextMenuTargetKind { Page, Image, SelectedText, Audio, Video } public enum CoreWebView2CookieSameSiteKind { None, Lax, Strict } public enum CoreWebView2DefaultDownloadDialogCornerAlignment { TopLeft, TopRight, BottomLeft, BottomRight } public enum CoreWebView2DownloadInterruptReason { None, FileFailed, FileAccessDenied, FileNoSpace, FileNameTooLong, FileTooLarge, FileMalicious, FileTransientError, FileBlockedByPolicy, FileSecurityCheckFailed, FileTooShort, FileHashMismatch, NetworkFailed, NetworkTimeout, NetworkDisconnected, NetworkServerDown, NetworkInvalidRequest, ServerFailed, ServerNoRange, ServerBadContent, ServerUnauthorized, ServerCertificateProblem, ServerForbidden, ServerUnexpectedResponse, ServerContentLengthMismatch, ServerCrossOriginRedirect, UserCanceled, UserShutdown, UserPaused, DownloadProcessCrashed } public enum CoreWebView2DownloadState { InProgress, Interrupted, Completed } public enum CoreWebView2FaviconImageFormat { Png, Jpeg } public enum CoreWebView2FileSystemHandleKind { File, Directory } public enum CoreWebView2FileSystemHandlePermission { ReadOnly, ReadWrite } public enum CoreWebView2FrameKind { Unknown, MainFrame, Iframe, Embed, Object } public enum CoreWebView2HostResourceAccessKind { Deny, Allow, DenyCors } public enum CoreWebView2KeyEventKind { KeyDown, KeyUp, SystemKeyDown, SystemKeyUp } public enum CoreWebView2MemoryUsageTargetLevel { Normal, Low } public enum CoreWebView2MouseEventKind { HorizontalWheel = 526, LeftButtonDoubleClick = 515, LeftButtonDown = 513, LeftButtonUp = 514, Leave = 675, MiddleButtonDoubleClick = 521, MiddleButtonDown = 519, MiddleButtonUp = 520, Move = 512, RightButtonDoubleClick = 518, RightButtonDown = 516, RightButtonUp = 517, Wheel = 522, XButtonDoubleClick = 525, XButtonDown = 523, XButtonUp = 524, NonClientRightButtonDown = 164, NonClientRightButtonUp = 165 } [Flags] public enum CoreWebView2MouseEventVirtualKeys { None = 0, LeftButton = 1, RightButton = 2, Shift = 4, Control = 8, MiddleButton = 0x10, XButton1 = 0x20, XButton2 = 0x40 } public enum CoreWebView2MoveFocusReason { Programmatic, Next, Previous } public enum CoreWebView2NavigationKind { Reload, BackOrForward, NewDocument } public enum CoreWebView2NonClientRegionKind { Nowhere = 0, Client = 1, Caption = 2, Minimize = 8, Maximize = 9, Close = 20 } [Flags] public enum CoreWebView2PdfToolbarItems { None = 0, Save = 1, Print = 2, SaveAs = 4, ZoomIn = 8, ZoomOut = 0x10, Rotate = 0x20, FitPage = 0x40, PageLayout = 0x80, Bookmarks = 0x100, PageSelector = 0x200, Search = 0x400, FullScreen = 0x800, MoreSettings = 0x1000 } public enum CoreWebView2PermissionKind { UnknownPermission, Microphone, Camera, Geolocation, Notifications, OtherSensors, ClipboardRead, MultipleAutomaticDownloads, FileReadWrite, Autoplay, LocalFonts, MidiSystemExclusiveMessages, WindowManagement, PersistentStorage } public enum CoreWebView2PermissionState { Default, Allow, Deny } public enum CoreWebView2PointerEventKind { Activate = 587, Down = 582, Enter = 585, Leave = 586, Up = 583, Update = 581 } public enum CoreWebView2PreferredColorScheme { Auto, Light, Dark } public enum CoreWebView2PrintCollation { Default, Collated, Uncollated } public enum CoreWebView2PrintColorMode { Default, Color, Grayscale } public enum CoreWebView2PrintDialogKind { Browser, System } public enum CoreWebView2PrintDuplex { Default, OneSided, TwoSidedLongEdge, TwoSidedShortEdge } public enum CoreWebView2PrintMediaSize { Default, Custom } public enum CoreWebView2PrintOrientation { Portrait, Landscape } public enum CoreWebView2PrintStatus { Succeeded, PrinterUnavailable, OtherError } public enum CoreWebView2ProcessFailedKind { BrowserProcessExited, RenderProcessExited, RenderProcessUnresponsive, FrameRenderProcessExited, UtilityProcessExited, SandboxHelperProcessExited, GpuProcessExited, PpapiPluginProcessExited, PpapiBrokerProcessExited, UnknownProcessExited } public enum CoreWebView2ProcessFailedReason { Unexpected, Unresponsive, Terminated, Crashed, LaunchFailed, OutOfMemory, ProfileDeleted, NormalExit, AbnormalExit, IntegrityFailure } public enum CoreWebView2ProcessKind { Browser, Renderer, Utility, SandboxHelper, Gpu, PpapiPlugin, PpapiBroker } [Flags] public enum CoreWebView2ReleaseChannels { None = 0, Stable = 1, Beta = 2, Dev = 4, Canary = 8 } public enum CoreWebView2SaveAsKind { Default, HtmlOnly, SingleFile, Complete } public enum CoreWebView2SaveAsUIResult { Success, InvalidPath, FileAlreadyExists, KindNotSupported, Cancelled } public enum CoreWebView2ScriptDialogKind { Alert, Confirm, Prompt, Beforeunload } public enum CoreWebView2ScrollbarStyle { Default, FluentOverlay } public enum CoreWebView2ServerCertificateErrorAction { AlwaysAllow, Cancel, Default } public enum CoreWebView2SharedBufferAccess { ReadOnly, ReadWrite } public enum CoreWebView2TextDirectionKind { Default, LeftToRight, RightToLeft } public enum CoreWebView2TrackingPreventionLevel { None, Basic, Balanced, Strict } public enum CoreWebView2WebErrorStatus { Unknown, CertificateCommonNameIsIncorrect, CertificateExpired, ClientCertificateContainsErrors, CertificateRevoked, CertificateIsInvalid, ServerUnreachable, Timeout, ErrorHttpInvalidServerResponse, ConnectionAborted, ConnectionReset, Disconnected, CannotConnect, HostNameNotResolved, OperationCanceled, RedirectFailed, UnexpectedError, ValidAuthenticationCredentialsRequired, ValidProxyAuthenticationRequired } public enum CoreWebView2WebResourceContext { All, Document, Stylesheet, Image, Media, Font, Script, XmlHttpRequest, Fetch, TextTrack, EventSource, Websocket, Manifest, SignedExchange, Ping, CspViolationReport, Other } [Flags] public enum CoreWebView2WebResourceRequestSourceKinds { None = 0, Document = 1, SharedWorker = 2, ServiceWorker = 4, All = -1 } public struct CoreWebView2Color { public byte A; public byte R; public byte G; public byte B; internal CoreWebView2Color(COREWEBVIEW2_COLOR rawStruct) { A = rawStruct.A; R = rawStruct.R; G = rawStruct.G; B = rawStruct.B; } } public class CoreWebView2 { internal object _rawNative; internal ICoreWebView2 _nativeICoreWebView2Value; private EventRegistrationToken _ContainsFullScreenElementChangedToken; private EventHandler<object> privateContainsFullScreenElementChanged; private EventRegistrationToken _ContentLoadingToken; private EventHandler<CoreWebView2ContentLoadingEventArgs> privateContentLoading; private EventRegistrationToken _DocumentTitleChangedToken; private EventHandler<object> privateDocumentTitleChanged; private EventRegistrationToken _FrameNavigationCompletedToken; private EventHandler<CoreWebView2NavigationCompletedEventArgs> privateFrameNavigationCompleted; private EventRegistrationToken _FrameNavigationStartingToken; private EventHandler<CoreWebView2NavigationStartingEventArgs> privateFrameNavigationStarting; private EventRegistrationToken _HistoryChangedToken; private EventHandler<object> privateHistoryChanged; private EventRegistrationToken _NavigationCompletedToken; private EventHandler<CoreWebView2NavigationCompletedEventArgs> privateNavigationCompleted; private EventRegistrationToken _NavigationStartingToken; private EventHandler<CoreWebView2NavigationStartingEventArgs> privateNavigationStarting; private EventRegistrationToken _NewWindowRequestedToken; private EventHandler<CoreWebView2NewWindowRequestedEventArgs> privateNewWindowRequested; private EventRegistrationToken _PermissionRequestedToken; private EventHandler<CoreWebView2PermissionRequestedEventArgs> privatePermissionRequested; private EventRegistrationToken _ProcessFailedToken; private EventHandler<CoreWebView2ProcessFailedEventArgs> privateProcessFailed; private EventRegistrationToken _ScriptDialogOpeningToken; private EventHandler<CoreWebView2ScriptDialogOpeningEventArgs> privateScriptDialogOpening; private EventRegistrationToken _SourceChangedToken; private EventHandler<CoreWebView2SourceChangedEventArgs> privateSourceChanged; private EventRegistrationToken _WebMessageReceivedToken; private EventHandler<CoreWebView2WebMessageReceivedEventArgs> privateWebMessageReceived; private EventRegistrationToken _WebResourceRequestedToken; private EventHandler<CoreWebView2WebResourceRequestedEventArgs> privateWebResourceRequested; private EventRegistrationToken _WindowCloseRequestedToken; private EventHandler<object> privateWindowCloseRequested; internal ICoreWebView2PrivatePartial _nativeICoreWebView2PrivatePartialValue; internal ICoreWebView2_10 _nativeICoreWebView2_10Value; private EventRegistrationToken _BasicAuthenticationRequestedToken; private EventHandler<CoreWebView2BasicAuthenticationRequestedEventArgs> privateBasicAuthenticationRequested; internal ICoreWebView2_11 _nativeICoreWebView2_11Value; private EventRegistrationToken _ContextMenuRequestedToken; private EventHandler<CoreWebView2ContextMenuRequestedEventArgs> privateContextMenuRequested; internal ICoreWebView2_12 _nativeICoreWebView2_12Value; private EventRegistrationToken _StatusBarTextChangedToken; private EventHandler<object> privateStatusBarTextChanged; internal ICoreWebView2_13 _nativeICoreWebView2_13Value; internal ICoreWebView2_14 _nativeICoreWebView2_14Value; private EventRegistrationToken _ServerCertificateErrorDetectedToken; private EventHandler<CoreWebView2ServerCertificateErrorDetectedEventArgs> privateServerCertificateErrorDetected; internal ICoreWebView2_15 _nativeICoreWebView2_15Value; private EventRegistrationToken _FaviconChangedToken; private EventHandler<object> privateFaviconChanged; internal ICoreWebView2_16 _nativeICoreWebView2_16Value; internal ICoreWebView2_17 _nativeICoreWebView2_17Value; internal ICoreWebView2_18 _nativeICoreWebView2_18Value; private EventRegistrationToken _LaunchingExternalUriSchemeToken; private EventHandler<CoreWebView2LaunchingExternalUriSchemeEventArgs> privateLaunchingExternalUriScheme; internal ICoreWebView2_19 _nativeICoreWebView2_19Value; internal ICoreWebView2_2 _nativeICoreWebView2_2Value; private EventRegistrationToken _DOMContentLoadedToken; private EventHandler<CoreWebView2DOMContentLoadedEventArgs> privateDOMContentLoaded; private EventRegistrationToken _WebResourceResponseReceivedToken; private EventHandler<CoreWebView2WebResourceResponseReceivedEventArgs> privateWebResourceResponseReceived; internal ICoreWebView2_20 _nativeICoreWebView2_20Value; internal ICoreWebView2_21 _nativeICoreWebView2_21Value; internal ICoreWebView2_22 _nativeICoreWebView2_22Value; internal ICoreWebView2_25 _nativeICoreWebView2_25Value; private EventRegistrationToken _SaveAsUIShowingToken; private EventHandler<CoreWebView2SaveAsUIShowingEventArgs> privateSaveAsUIShowing; internal ICoreWebView2_23 _nativeICoreWebView2_23Value; internal ICoreWebView2_27 _nativeICoreWebView2_27Value; private EventRegistrationToken _ScreenCaptureStartingToken; private EventHandler<CoreWebView2ScreenCaptureStartingEventArgs> privateScreenCaptureStarting; internal ICoreWebView2_28 _nativeICoreWebView2_28Value; internal ICoreWebView2_26 _nativeICoreWebView2_26Value; private EventRegistrationToken _SaveFileSecurityCheckStartingToken; private EventHandler<CoreWebView2SaveFileSecurityCheckStartingEventArgs> privateSaveFileSecurityCheckStarting; internal ICoreWebView2_24 _nativeICoreWebView2_24Value; private EventRegistrationToken _NotificationReceivedToken; private EventHandler<CoreWebView2NotificationReceivedEventArgs> privateNotificationReceived; internal ICoreWebView2_3 _nativeICoreWebView2_3Value; internal ICoreWebView2_29 _nativeICoreWebView2_29Value; private EventRegistrationToken _DedicatedWorkerCreatedToken; private EventHandler<CoreWebView2DedicatedWorkerCreatedEventArgs> privateDedicatedWorkerCreated; internal ICoreWebView2_4 _nativeICoreWebView2_4Value; private EventRegistrationToken _DownloadStartingToken; private EventHandler<CoreWebView2DownloadStartingEventArgs> privateDownloadStarting; private EventRegistrationToken _FrameCreatedToken; private EventHandler<CoreWebView2FrameCreatedEventArgs> privateFrameCreated; internal ICoreWebView2_5 _nativeICoreWebView2_5Value; private EventRegistrationToken _ClientCertificateRequestedToken; private EventHandler<CoreWebView2ClientCertificateRequestedEventArgs> privateClientCertificateRequested; internal ICoreWebView2_6 _nativeICoreWebView2_6Value; internal ICoreWebView2_7 _nativeICoreWebView2_7Value; internal ICoreWebView2_8 _nativeICoreWebView2_8Value; private EventRegistrationToken _IsDocumentPlayingAudioChangedToken; private EventHandler<object> privateIsDocumentPlayingAudioChanged; private EventRegistrationToken _IsMutedChangedToken; private EventHandler<object> privateIsMutedChanged; internal ICoreWebView2_9 _nativeICoreWebView2_9Value; private EventRegistrationToken _IsDefaultDownloadDialogOpenChangedToken; private EventHandler<object> privateIsDefaultDownloadDialogOpenChanged; internal ICoreWebView2 _nativeICoreWebView2 { get { if (_nativeICoreWebView2Value == null) { try { _nativeICoreWebView2Value = (ICoreWebView2)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2Value; } set { _nativeICoreWebView2Value = value; } } public uint BrowserProcessId { get { try { return _nativeICoreWebView2.BrowserProcessId; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public bool CanGoBack { get { try { return _nativeICoreWebView2.CanGoBack != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public bool CanGoForward { get { try { return _nativeICoreWebView2.CanGoForward != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public bool ContainsFullScreenElement { get { try { return _nativeICoreWebView2.ContainsFullScreenElement != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public string DocumentTitle { get { try { return _nativeICoreWebView2.DocumentTitle; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public CoreWebView2Settings Settings { get { try { return (_nativeICoreWebView2.Settings == null) ? null : new CoreWebView2Settings(_nativeICoreWebView2.Settings); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public string Source { get { try { return _nativeICoreWebView2.Source; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2PrivatePartial _nativeICoreWebView2PrivatePartial { get { if (_nativeICoreWebView2PrivatePartialValue == null) { try { _nativeICoreWebView2PrivatePartialValue = (ICoreWebView2PrivatePartial)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2PrivatePartial.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2PrivatePartialValue; } set { _nativeICoreWebView2PrivatePartialValue = value; } } internal ICoreWebView2_10 _nativeICoreWebView2_10 { get { if (_nativeICoreWebView2_10Value == null) { try { _nativeICoreWebView2_10Value = (ICoreWebView2_10)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_10.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_10Value; } set { _nativeICoreWebView2_10Value = value; } } internal ICoreWebView2_11 _nativeICoreWebView2_11 { get { if (_nativeICoreWebView2_11Value == null) { try { _nativeICoreWebView2_11Value = (ICoreWebView2_11)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_11.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_11Value; } set { _nativeICoreWebView2_11Value = value; } } internal ICoreWebView2_12 _nativeICoreWebView2_12 { get { if (_nativeICoreWebView2_12Value == null) { try { _nativeICoreWebView2_12Value = (ICoreWebView2_12)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_12.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_12Value; } set { _nativeICoreWebView2_12Value = value; } } public string StatusBarText { get { try { return _nativeICoreWebView2_12.StatusBarText; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_13 _nativeICoreWebView2_13 { get { if (_nativeICoreWebView2_13Value == null) { try { _nativeICoreWebView2_13Value = (ICoreWebView2_13)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_13.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_13Value; } set { _nativeICoreWebView2_13Value = value; } } public CoreWebView2Profile Profile { get { try { return (_nativeICoreWebView2_13.Profile == null) ? null : new CoreWebView2Profile(_nativeICoreWebView2_13.Profile); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_14 _nativeICoreWebView2_14 { get { if (_nativeICoreWebView2_14Value == null) { try { _nativeICoreWebView2_14Value = (ICoreWebView2_14)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_14.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_14Value; } set { _nativeICoreWebView2_14Value = value; } } internal ICoreWebView2_15 _nativeICoreWebView2_15 { get { if (_nativeICoreWebView2_15Value == null) { try { _nativeICoreWebView2_15Value = (ICoreWebView2_15)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_15.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_15Value; } set { _nativeICoreWebView2_15Value = value; } } public string FaviconUri { get { try { return _nativeICoreWebView2_15.FaviconUri; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_16 _nativeICoreWebView2_16 { get { if (_nativeICoreWebView2_16Value == null) { try { _nativeICoreWebView2_16Value = (ICoreWebView2_16)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_16.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_16Value; } set { _nativeICoreWebView2_16Value = value; } } internal ICoreWebView2_17 _nativeICoreWebView2_17 { get { if (_nativeICoreWebView2_17Value == null) { try { _nativeICoreWebView2_17Value = (ICoreWebView2_17)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_17.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_17Value; } set { _nativeICoreWebView2_17Value = value; } } internal ICoreWebView2_18 _nativeICoreWebView2_18 { get { if (_nativeICoreWebView2_18Value == null) { try { _nativeICoreWebView2_18Value = (ICoreWebView2_18)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_18.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_18Value; } set { _nativeICoreWebView2_18Value = value; } } internal ICoreWebView2_19 _nativeICoreWebView2_19 { get { if (_nativeICoreWebView2_19Value == null) { try { _nativeICoreWebView2_19Value = (ICoreWebView2_19)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_19.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_19Value; } set { _nativeICoreWebView2_19Value = value; } } public CoreWebView2MemoryUsageTargetLevel MemoryUsageTargetLevel { get { try { return (CoreWebView2MemoryUsageTargetLevel)_nativeICoreWebView2_19.MemoryUsageTargetLevel; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } set { try { _nativeICoreWebView2_19.MemoryUsageTargetLevel = (COREWEBVIEW2_MEMORY_USAGE_TARGET_LEVEL)value; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_2 _nativeICoreWebView2_2 { get { if (_nativeICoreWebView2_2Value == null) { try { _nativeICoreWebView2_2Value = (ICoreWebView2_2)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_2.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_2Value; } set { _nativeICoreWebView2_2Value = value; } } public CoreWebView2CookieManager CookieManager { get { try { return (_nativeICoreWebView2_2.CookieManager == null) ? null : new CoreWebView2CookieManager(_nativeICoreWebView2_2.CookieManager); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public CoreWebView2Environment Environment { get { try { return (_nativeICoreWebView2_2.Environment == null) ? null : new CoreWebView2Environment(_nativeICoreWebView2_2.Environment); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_20 _nativeICoreWebView2_20 { get { if (_nativeICoreWebView2_20Value == null) { try { _nativeICoreWebView2_20Value = (ICoreWebView2_20)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_20.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_20Value; } set { _nativeICoreWebView2_20Value = value; } } public uint FrameId { get { try { return _nativeICoreWebView2_20.FrameId; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_21 _nativeICoreWebView2_21 { get { if (_nativeICoreWebView2_21Value == null) { try { _nativeICoreWebView2_21Value = (ICoreWebView2_21)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_21.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_21Value; } set { _nativeICoreWebView2_21Value = value; } } internal ICoreWebView2_22 _nativeICoreWebView2_22 { get { if (_nativeICoreWebView2_22Value == null) { try { _nativeICoreWebView2_22Value = (ICoreWebView2_22)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_22.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_22Value; } set { _nativeICoreWebView2_22Value = value; } } internal ICoreWebView2_25 _nativeICoreWebView2_25 { get { if (_nativeICoreWebView2_25Value == null) { try { _nativeICoreWebView2_25Value = (ICoreWebView2_25)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_25.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_25Value; } set { _nativeICoreWebView2_25Value = value; } } internal ICoreWebView2_23 _nativeICoreWebView2_23 { get { if (_nativeICoreWebView2_23Value == null) { try { _nativeICoreWebView2_23Value = (ICoreWebView2_23)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_23.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_23Value; } set { _nativeICoreWebView2_23Value = value; } } internal ICoreWebView2_27 _nativeICoreWebView2_27 { get { if (_nativeICoreWebView2_27Value == null) { try { _nativeICoreWebView2_27Value = (ICoreWebView2_27)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_27.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_27Value; } set { _nativeICoreWebView2_27Value = value; } } internal ICoreWebView2_28 _nativeICoreWebView2_28 { get { if (_nativeICoreWebView2_28Value == null) { try { _nativeICoreWebView2_28Value = (ICoreWebView2_28)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_28.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_28Value; } set { _nativeICoreWebView2_28Value = value; } } public CoreWebView2Find Find { get { try { return (_nativeICoreWebView2_28.Find == null) ? null : new CoreWebView2Find(_nativeICoreWebView2_28.Find); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_26 _nativeICoreWebView2_26 { get { if (_nativeICoreWebView2_26Value == null) { try { _nativeICoreWebView2_26Value = (ICoreWebView2_26)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_26.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_26Value; } set { _nativeICoreWebView2_26Value = value; } } internal ICoreWebView2_24 _nativeICoreWebView2_24 { get { if (_nativeICoreWebView2_24Value == null) { try { _nativeICoreWebView2_24Value = (ICoreWebView2_24)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_24.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_24Value; } set { _nativeICoreWebView2_24Value = value; } } internal ICoreWebView2_3 _nativeICoreWebView2_3 { get { if (_nativeICoreWebView2_3Value == null) { try { _nativeICoreWebView2_3Value = (ICoreWebView2_3)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_3.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_3Value; } set { _nativeICoreWebView2_3Value = value; } } public bool IsSuspended { get { try { return _nativeICoreWebView2_3.IsSuspended != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_29 _nativeICoreWebView2_29 { get { if (_nativeICoreWebView2_29Value == null) { try { _nativeICoreWebView2_29Value = (ICoreWebView2_29)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_29.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_29Value; } set { _nativeICoreWebView2_29Value = value; } } internal ICoreWebView2_4 _nativeICoreWebView2_4 { get { if (_nativeICoreWebView2_4Value == null) { try { _nativeICoreWebView2_4Value = (ICoreWebView2_4)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_4.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_4Value; } set { _nativeICoreWebView2_4Value = value; } } internal ICoreWebView2_5 _nativeICoreWebView2_5 { get { if (_nativeICoreWebView2_5Value == null) { try { _nativeICoreWebView2_5Value = (ICoreWebView2_5)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_5.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_5Value; } set { _nativeICoreWebView2_5Value = value; } } internal ICoreWebView2_6 _nativeICoreWebView2_6 { get { if (_nativeICoreWebView2_6Value == null) { try { _nativeICoreWebView2_6Value = (ICoreWebView2_6)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_6.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_6Value; } set { _nativeICoreWebView2_6Value = value; } } internal ICoreWebView2_7 _nativeICoreWebView2_7 { get { if (_nativeICoreWebView2_7Value == null) { try { _nativeICoreWebView2_7Value = (ICoreWebView2_7)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_7.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_7Value; } set { _nativeICoreWebView2_7Value = value; } } internal ICoreWebView2_8 _nativeICoreWebView2_8 { get { if (_nativeICoreWebView2_8Value == null) { try { _nativeICoreWebView2_8Value = (ICoreWebView2_8)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_8.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_8Value; } set { _nativeICoreWebView2_8Value = value; } } public bool IsDocumentPlayingAudio { get { try { return _nativeICoreWebView2_8.IsDocumentPlayingAudio != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public bool IsMuted { get { try { return _nativeICoreWebView2_8.IsMuted != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } set { try { _nativeICoreWebView2_8.IsMuted = (value ? 1 : 0); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } internal ICoreWebView2_9 _nativeICoreWebView2_9 { get { if (_nativeICoreWebView2_9Value == null) { try { _nativeICoreWebView2_9Value = (ICoreWebView2_9)_rawNative; } catch (Exception inner) { throw new NotImplementedException("Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_9.\nThis may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.\nFor instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.\nOr, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.\nFor more information about WebView2 versioning please visit the following: https://learn.microsoft.com/microsoft-edge/webview2/concepts/versioning", inner); } } return _nativeICoreWebView2_9Value; } set { _nativeICoreWebView2_9Value = value; } } public CoreWebView2DefaultDownloadDialogCornerAlignment DefaultDownloadDialogCornerAlignment { get { try { return (CoreWebView2DefaultDownloadDialogCornerAlignment)_nativeICoreWebView2_9.DefaultDownloadDialogCornerAlignment; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } set { try { _nativeICoreWebView2_9.DefaultDownloadDialogCornerAlignment = (COREWEBVIEW2_DEFAULT_DOWNLOAD_DIALOG_CORNER_ALIGNMENT)value; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public Point DefaultDownloadDialogMargin { get { try { return COMDotNetTypeConverter.PointCOMToNet(_nativeICoreWebView2_9.DefaultDownloadDialogMargin); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } set { try { _nativeICoreWebView2_9.DefaultDownloadDialogMargin = COMDotNetTypeConverter.PointNetToCOM(value); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public bool IsDefaultDownloadDialogOpen { get { try { return _nativeICoreWebView2_9.IsDefaultDownloadDialogOpen != 0; } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<object> ContainsFullScreenElementChanged { add { if (privateContainsFullScreenElementChanged == null) { try { _nativeICoreWebView2.add_ContainsFullScreenElementChanged(new CoreWebView2ContainsFullScreenElementChangedEventHandler(OnContainsFullScreenElementChanged), out _ContainsFullScreenElementChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateContainsFullScreenElementChanged = (EventHandler<object>)Delegate.Combine(privateContainsFullScreenElementChanged, value); } remove { privateContainsFullScreenElementChanged = (EventHandler<object>)Delegate.Remove(privateContainsFullScreenElementChanged, value); if (privateContainsFullScreenElementChanged != null) { return; } try { _nativeICoreWebView2.remove_ContainsFullScreenElementChanged(_ContainsFullScreenElementChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2ContentLoadingEventArgs> ContentLoading { add { if (privateContentLoading == null) { try { _nativeICoreWebView2.add_ContentLoading(new CoreWebView2ContentLoadingEventHandler(OnContentLoading), out _ContentLoadingToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateContentLoading = (EventHandler<CoreWebView2ContentLoadingEventArgs>)Delegate.Combine(privateContentLoading, value); } remove { privateContentLoading = (EventHandler<CoreWebView2ContentLoadingEventArgs>)Delegate.Remove(privateContentLoading, value); if (privateContentLoading != null) { return; } try { _nativeICoreWebView2.remove_ContentLoading(_ContentLoadingToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<object> DocumentTitleChanged { add { if (privateDocumentTitleChanged == null) { try { _nativeICoreWebView2.add_DocumentTitleChanged(new CoreWebView2DocumentTitleChangedEventHandler(OnDocumentTitleChanged), out _DocumentTitleChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateDocumentTitleChanged = (EventHandler<object>)Delegate.Combine(privateDocumentTitleChanged, value); } remove { privateDocumentTitleChanged = (EventHandler<object>)Delegate.Remove(privateDocumentTitleChanged, value); if (privateDocumentTitleChanged != null) { return; } try { _nativeICoreWebView2.remove_DocumentTitleChanged(_DocumentTitleChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2NavigationCompletedEventArgs> FrameNavigationCompleted { add { if (privateFrameNavigationCompleted == null) { try { _nativeICoreWebView2.add_FrameNavigationCompleted(new CoreWebView2NavigationCompletedEventHandler(OnFrameNavigationCompleted), out _FrameNavigationCompletedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateFrameNavigationCompleted = (EventHandler<CoreWebView2NavigationCompletedEventArgs>)Delegate.Combine(privateFrameNavigationCompleted, value); } remove { privateFrameNavigationCompleted = (EventHandler<CoreWebView2NavigationCompletedEventArgs>)Delegate.Remove(privateFrameNavigationCompleted, value); if (privateFrameNavigationCompleted != null) { return; } try { _nativeICoreWebView2.remove_FrameNavigationCompleted(_FrameNavigationCompletedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2NavigationStartingEventArgs> FrameNavigationStarting { add { if (privateFrameNavigationStarting == null) { try { _nativeICoreWebView2.add_FrameNavigationStarting(new CoreWebView2NavigationStartingEventHandler(OnFrameNavigationStarting), out _FrameNavigationStartingToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateFrameNavigationStarting = (EventHandler<CoreWebView2NavigationStartingEventArgs>)Delegate.Combine(privateFrameNavigationStarting, value); } remove { privateFrameNavigationStarting = (EventHandler<CoreWebView2NavigationStartingEventArgs>)Delegate.Remove(privateFrameNavigationStarting, value); if (privateFrameNavigationStarting != null) { return; } try { _nativeICoreWebView2.remove_FrameNavigationStarting(_FrameNavigationStartingToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<object> HistoryChanged { add { if (privateHistoryChanged == null) { try { _nativeICoreWebView2.add_HistoryChanged(new CoreWebView2HistoryChangedEventHandler(OnHistoryChanged), out _HistoryChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateHistoryChanged = (EventHandler<object>)Delegate.Combine(privateHistoryChanged, value); } remove { privateHistoryChanged = (EventHandler<object>)Delegate.Remove(privateHistoryChanged, value); if (privateHistoryChanged != null) { return; } try { _nativeICoreWebView2.remove_HistoryChanged(_HistoryChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2NavigationCompletedEventArgs> NavigationCompleted { add { if (privateNavigationCompleted == null) { try { _nativeICoreWebView2.add_NavigationCompleted(new CoreWebView2NavigationCompletedEventHandler(OnNavigationCompleted), out _NavigationCompletedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateNavigationCompleted = (EventHandler<CoreWebView2NavigationCompletedEventArgs>)Delegate.Combine(privateNavigationCompleted, value); } remove { privateNavigationCompleted = (EventHandler<CoreWebView2NavigationCompletedEventArgs>)Delegate.Remove(privateNavigationCompleted, value); if (privateNavigationCompleted != null) { return; } try { _nativeICoreWebView2.remove_NavigationCompleted(_NavigationCompletedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2NavigationStartingEventArgs> NavigationStarting { add { if (privateNavigationStarting == null) { try { _nativeICoreWebView2.add_NavigationStarting(new CoreWebView2NavigationStartingEventHandler(OnNavigationStarting), out _NavigationStartingToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateNavigationStarting = (EventHandler<CoreWebView2NavigationStartingEventArgs>)Delegate.Combine(privateNavigationStarting, value); } remove { privateNavigationStarting = (EventHandler<CoreWebView2NavigationStartingEventArgs>)Delegate.Remove(privateNavigationStarting, value); if (privateNavigationStarting != null) { return; } try { _nativeICoreWebView2.remove_NavigationStarting(_NavigationStartingToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2NewWindowRequestedEventArgs> NewWindowRequested { add { if (privateNewWindowRequested == null) { try { _nativeICoreWebView2.add_NewWindowRequested(new CoreWebView2NewWindowRequestedEventHandler(OnNewWindowRequested), out _NewWindowRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateNewWindowRequested = (EventHandler<CoreWebView2NewWindowRequestedEventArgs>)Delegate.Combine(privateNewWindowRequested, value); } remove { privateNewWindowRequested = (EventHandler<CoreWebView2NewWindowRequestedEventArgs>)Delegate.Remove(privateNewWindowRequested, value); if (privateNewWindowRequested != null) { return; } try { _nativeICoreWebView2.remove_NewWindowRequested(_NewWindowRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2PermissionRequestedEventArgs> PermissionRequested { add { if (privatePermissionRequested == null) { try { _nativeICoreWebView2.add_PermissionRequested(new CoreWebView2PermissionRequestedEventHandler(OnPermissionRequested), out _PermissionRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privatePermissionRequested = (EventHandler<CoreWebView2PermissionRequestedEventArgs>)Delegate.Combine(privatePermissionRequested, value); } remove { privatePermissionRequested = (EventHandler<CoreWebView2PermissionRequestedEventArgs>)Delegate.Remove(privatePermissionRequested, value); if (privatePermissionRequested != null) { return; } try { _nativeICoreWebView2.remove_PermissionRequested(_PermissionRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2ProcessFailedEventArgs> ProcessFailed { add { if (privateProcessFailed == null) { try { _nativeICoreWebView2.add_ProcessFailed(new CoreWebView2ProcessFailedEventHandler(OnProcessFailed), out _ProcessFailedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateProcessFailed = (EventHandler<CoreWebView2ProcessFailedEventArgs>)Delegate.Combine(privateProcessFailed, value); } remove { privateProcessFailed = (EventHandler<CoreWebView2ProcessFailedEventArgs>)Delegate.Remove(privateProcessFailed, value); if (privateProcessFailed != null) { return; } try { _nativeICoreWebView2.remove_ProcessFailed(_ProcessFailedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2ScriptDialogOpeningEventArgs> ScriptDialogOpening { add { if (privateScriptDialogOpening == null) { try { _nativeICoreWebView2.add_ScriptDialogOpening(new CoreWebView2ScriptDialogOpeningEventHandler(OnScriptDialogOpening), out _ScriptDialogOpeningToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateScriptDialogOpening = (EventHandler<CoreWebView2ScriptDialogOpeningEventArgs>)Delegate.Combine(privateScriptDialogOpening, value); } remove { privateScriptDialogOpening = (EventHandler<CoreWebView2ScriptDialogOpeningEventArgs>)Delegate.Remove(privateScriptDialogOpening, value); if (privateScriptDialogOpening != null) { return; } try { _nativeICoreWebView2.remove_ScriptDialogOpening(_ScriptDialogOpeningToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2SourceChangedEventArgs> SourceChanged { add { if (privateSourceChanged == null) { try { _nativeICoreWebView2.add_SourceChanged(new CoreWebView2SourceChangedEventHandler(OnSourceChanged), out _SourceChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateSourceChanged = (EventHandler<CoreWebView2SourceChangedEventArgs>)Delegate.Combine(privateSourceChanged, value); } remove { privateSourceChanged = (EventHandler<CoreWebView2SourceChangedEventArgs>)Delegate.Remove(privateSourceChanged, value); if (privateSourceChanged != null) { return; } try { _nativeICoreWebView2.remove_SourceChanged(_SourceChangedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2WebMessageReceivedEventArgs> WebMessageReceived { add { if (privateWebMessageReceived == null) { try { _nativeICoreWebView2.add_WebMessageReceived(new CoreWebView2WebMessageReceivedEventHandler(OnWebMessageReceived), out _WebMessageReceivedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateWebMessageReceived = (EventHandler<CoreWebView2WebMessageReceivedEventArgs>)Delegate.Combine(privateWebMessageReceived, value); } remove { privateWebMessageReceived = (EventHandler<CoreWebView2WebMessageReceivedEventArgs>)Delegate.Remove(privateWebMessageReceived, value); if (privateWebMessageReceived != null) { return; } try { _nativeICoreWebView2.remove_WebMessageReceived(_WebMessageReceivedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2WebResourceRequestedEventArgs> WebResourceRequested { add { if (privateWebResourceRequested == null) { try { _nativeICoreWebView2.add_WebResourceRequested(new CoreWebView2WebResourceRequestedEventHandler(OnWebResourceRequested), out _WebResourceRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateWebResourceRequested = (EventHandler<CoreWebView2WebResourceRequestedEventArgs>)Delegate.Combine(privateWebResourceRequested, value); } remove { privateWebResourceRequested = (EventHandler<CoreWebView2WebResourceRequestedEventArgs>)Delegate.Remove(privateWebResourceRequested, value); if (privateWebResourceRequested != null) { return; } try { _nativeICoreWebView2.remove_WebResourceRequested(_WebResourceRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<object> WindowCloseRequested { add { if (privateWindowCloseRequested == null) { try { _nativeICoreWebView2.add_WindowCloseRequested(new CoreWebView2WindowCloseRequestedEventHandler(OnWindowCloseRequested), out _WindowCloseRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } privateWindowCloseRequested = (EventHandler<object>)Delegate.Combine(privateWindowCloseRequested, value); } remove { privateWindowCloseRequested = (EventHandler<object>)Delegate.Remove(privateWindowCloseRequested, value); if (privateWindowCloseRequested != null) { return; } try { _nativeICoreWebView2.remove_WindowCloseRequested(_WindowCloseRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw new InvalidOperationException("CoreWebView2 members cannot be accessed after the WebView2 control is disposed.", ex2); } throw ex2; } } } public event EventHandler<CoreWebView2BasicAuthenticationRequestedEventArgs> BasicAuthenticationRequested { add { if (privateBasicAuthenticationRequested == null) { try { _nativeICoreWebView2_10.add_BasicAuthenticationRequested(new CoreWebView2BasicAuthenticationRequestedEventHandler(OnBasicAuthenticationRequested), out _BasicAuthenticationRequestedToken); } catch (InvalidCastException ex) { if (ex.HResult == -2147467262) { throw new InvalidOperationException("CoreWebView2 members can only be accessed from the UI thread.", ex); } throw ex; } catch (COMException ex2) { if (ex2.HResult == -2147019873) { throw n
BepInEx/plugins/Microsoft.Web.WebView2.WinForms.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.Web.WebView2.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("Microsoft.Web.WebView2.WinForms.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001005dba207a79aa19b084a6b574c6f8945bd211921eaefa27a8031dd74b31af8094b3945f00288bc93f0751ecc62d3f5ca42681f09ed4ff1716aefc600bee20b042828dd897db022a07459a20a1042d0fcdd4a19610e838f5cfd992bcad1499861e24a28e5884452ce638803b5fac55a9967d92794723d2f4a0b49cc1148ae03dc7")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyConfiguration("Release Stable APIs")] [assembly: AssemblyCopyright("Copyright ©2020")] [assembly: AssemblyFileVersion("1.0.4258.31")] [assembly: AssemblyInformationalVersion("1.0.4258.31")] [assembly: AssemblyProduct("WebView2 Windows Forms Control")] [assembly: AssemblyTitle("Microsoft.Web.WebView2.WinForms")] [assembly: AssemblyVersion("1.0.4258.31")] namespace Microsoft.Web.WebView2.WinForms; public class CoreWebView2CreationProperties { private string _browserExecutableFolder; private string _userDataFolder; private string _language; private string _additionalBrowserArguments; private Task<CoreWebView2Environment> _task; public string BrowserExecutableFolder { get { return _browserExecutableFolder; } set { _browserExecutableFolder = value; _task = null; } } public string UserDataFolder { get { return _userDataFolder; } set { _userDataFolder = value; _task = null; } } public string Language { get { return _language; } set { _language = value; _task = null; } } public string ProfileName { get; set; } public string AdditionalBrowserArguments { get { return _additionalBrowserArguments; } set { _additionalBrowserArguments = value; _task = null; } } public bool? IsInPrivateModeEnabled { get; set; } internal Task<CoreWebView2Environment> CreateEnvironmentAsync() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if (_task == null && (BrowserExecutableFolder != null || UserDataFolder != null || Language != null || AdditionalBrowserArguments != null)) { _task = CoreWebView2Environment.CreateAsync(BrowserExecutableFolder, UserDataFolder, new CoreWebView2EnvironmentOptions(AdditionalBrowserArguments, Language, (string)null, false, (List<CoreWebView2CustomSchemeRegistration>)null)); } return _task ?? Task.FromResult<CoreWebView2Environment>(null); } internal CoreWebView2ControllerOptions CreateCoreWebView2ControllerOptions(CoreWebView2Environment environment) { CoreWebView2ControllerOptions val = null; if (ProfileName != null || IsInPrivateModeEnabled.HasValue) { val = environment.CreateCoreWebView2ControllerOptions(); val.ProfileName = ProfileName; val.IsInPrivateModeEnabled = IsInPrivateModeEnabled == true; } return val; } } public class WebView2 : Control, ISupportInitialize { private static class NativeMethods { [Flags] public enum WS_EX : uint { None = 0u, TRANSPARENT = 0x20u } public enum WM : uint { PAINT = 15u } public struct Rect { public int left; public int top; public int right; public int bottom; } public struct PaintStruct { public IntPtr hdc; public bool fErase; public Rect rcPaint; public bool fRestore; public bool fIncUpdate; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] rgbReserved; } [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr BeginPaint(IntPtr hwnd, out PaintStruct lpPaint); [DllImport("user32.dll", SetLastError = true)] public static extern bool EndPaint(IntPtr hwnd, ref PaintStruct lpPaint); } private const string _designText = "WebView2"; private const int _designBorderWidth = 2; private CoreWebView2CreationProperties _creationProperties; internal Task _initTask; private bool _browserHitTransparent; private bool _isExplicitEnvironment; private bool _isExplicitControllerOptions; private CoreWebView2MoveFocusReason _lastMoveFocusReason; private Form _parentForm; private CoreWebView2Controller _coreWebView2Controller; private double _zoomFactor = 1.0; private bool _allowExternalDrop = true; private bool _inInit; private Uri _source; private Color _defaultBackgroundColor = Color.White; private bool _browserCrashed; private IContainer components; [Browsable(false)] public CoreWebView2CreationProperties CreationProperties { get { return _creationProperties; } set { if (_initTask != null) { throw new InvalidOperationException("CreationProperties cannot be modified after the initialization of CoreWebView2 has begun."); } _creationProperties = value; } } private CoreWebView2Environment Environment { get; set; } private CoreWebView2ControllerOptions ControllerOptions { get; set; } protected override CreateParams CreateParams { get { CreateParams createParams = ((Control)this).CreateParams; createParams.ExStyle |= 0x20; return createParams; } } private bool IsInitialized { get; set; } private bool IsInDesignMode => GetSitedParentSite((Control)(object)this)?.DesignMode ?? false; public CoreWebView2 CoreWebView2 { get { try { CoreWebView2Controller coreWebView2Controller = _coreWebView2Controller; return (coreWebView2Controller != null) ? coreWebView2Controller.CoreWebView2 : null; } catch (Exception innerException) { if (((Control)this).InvokeRequired) { throw new InvalidOperationException("CoreWebView2 can only be accessed from the UI thread.", innerException); } throw; } } } public double ZoomFactor { get { if (_coreWebView2Controller != null) { return _coreWebView2Controller.ZoomFactor; } return _zoomFactor; } set { _zoomFactor = value; if (_coreWebView2Controller != null) { _coreWebView2Controller.ZoomFactor = value; } } } public bool AllowExternalDrop { get { if (_coreWebView2Controller != null) { return _coreWebView2Controller.AllowExternalDrop; } return _allowExternalDrop; } set { _allowExternalDrop = value; if (_coreWebView2Controller != null) { _coreWebView2Controller.AllowExternalDrop = value; } } } [Browsable(true)] public Uri Source { get { return _source; } set { if (value == null) { if (!(_source == null)) { throw new NotImplementedException("Setting Source to null is not implemented yet."); } return; } if (!value.IsAbsoluteUri) { throw new ArgumentException("Only absolute URI is allowed", "Source"); } if (IsInitialized && _source != null && _source.AbsoluteUri == value.AbsoluteUri) { return; } _source = value; if (!_inInit) { if (!IsInitialized) { EnsureCoreWebView2Async(); } else { CoreWebView2.Navigate(value.AbsoluteUri); } } } } [Browsable(false)] public bool CanGoForward { get { CoreWebView2 coreWebView = CoreWebView2; if (coreWebView == null) { return false; } return coreWebView.CanGoForward; } } [Browsable(false)] public bool CanGoBack { get { CoreWebView2 coreWebView = CoreWebView2; if (coreWebView == null) { return false; } return coreWebView.CanGoBack; } } public Color DefaultBackgroundColor { get { if (_coreWebView2Controller != null) { return _coreWebView2Controller.DefaultBackgroundColor; } return _defaultBackgroundColor; } set { if (_coreWebView2Controller != null) { _coreWebView2Controller.DefaultBackgroundColor = value; } else { _defaultBackgroundColor = value; } } } [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public Font Font => ((Control)this).Font; [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public string Text => ((Control)this).Text; [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public bool AllowDrop => ((Control)this).AllowDrop; [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public ContextMenuStrip ContextMenuStrip => ((Control)this).ContextMenuStrip; [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public ContextMenu ContextMenu => ((Control)this).ContextMenu; public event EventHandler<CoreWebView2InitializationCompletedEventArgs> CoreWebView2InitializationCompleted; public event EventHandler<CoreWebView2NavigationStartingEventArgs> NavigationStarting; public event EventHandler<CoreWebView2NavigationCompletedEventArgs> NavigationCompleted; public event EventHandler<CoreWebView2WebMessageReceivedEventArgs> WebMessageReceived; public event EventHandler<CoreWebView2SourceChangedEventArgs> SourceChanged; public event EventHandler<CoreWebView2ContentLoadingEventArgs> ContentLoading; public event EventHandler<EventArgs> ZoomFactorChanged; [ToolboxItem(true)] public WebView2() { InitializeComponent(); ((Control)this).SetStyle((ControlStyles)2, true); ((Control)this).SetStyle((ControlStyles)8192, true); } protected override void Dispose(bool disposing) { if (disposing && !((Control)this).IsDisposed) { if (IsInitialized) { UnsubscribeHandlersAndCloseController(); } if (components != null) { components.Dispose(); } ((Control)this).Dispose(disposing); } } private void UnsubscribeHandlersAndCloseController(bool browserCrashed = false) { IsInitialized = false; _browserCrashed = browserCrashed; ((Control)this).HandleDestroyed -= WebView2_HandleDestroyed; ((Control)this).HandleCreated -= WebView2_HandleCreated; if (_parentForm != null) { ((Control)_parentForm).LocationChanged -= WebView2_WindowPositionChanged; } if (!_browserCrashed) { CoreWebView2.NavigationCompleted -= CoreWebView2_NavigationCompleted; CoreWebView2.NavigationStarting -= CoreWebView2_NavigationStarting; CoreWebView2.SourceChanged -= CoreWebView2_SourceChanged; CoreWebView2.WebMessageReceived -= CoreWebView2_WebMessageReceived; CoreWebView2.ContentLoading -= CoreWebView2_ContentLoading; CoreWebView2.ProcessFailed -= CoreWebView2_ProcessFailed; try { CoreWebView2.Profile.Deleted -= Profile_Deleted; } catch (NotImplementedException) { } _coreWebView2Controller.ZoomFactorChanged -= _coreWebView2Controller_ZoomFactorChanged; _coreWebView2Controller.MoveFocusRequested -= CoreWebView2Controller_MoveFocusRequested; if (!_browserHitTransparent) { _coreWebView2Controller.AcceleratorKeyPressed -= _coreWebView2Controller_AcceleratorKeyPressed; } else { _coreWebView2Controller.KeyPressed -= _coreWebView2Controller_KeyPressed; } _coreWebView2Controller.Close(); } _coreWebView2Controller = null; } protected override void OnPaint(PaintEventArgs e) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown ((Control)this).OnPaint(e); if (IsInDesignMode) { e.Graphics.FillRectangle((Brush)new SolidBrush(((Control)this).BackColor), ((Control)this).ClientRectangle); e.Graphics.DrawRectangle(new Pen((Brush)new SolidBrush(((Control)this).ForeColor), 2f), ((Control)this).ClientRectangle); SizeF sizeF = e.Graphics.MeasureString("WebView2", Font); if (((Control)this).BackgroundImage != null) { e.Graphics.DrawImage(((Control)this).BackgroundImage, new Rectangle(Point.Empty, ((Control)this).ClientSize)); } e.Graphics.DrawString("WebView2", Font, (Brush)new SolidBrush(((Control)this).ForeColor), (float)(((Control)this).ClientSize.Width / 2) - sizeF.Width / 2f, (float)(((Control)this).ClientSize.Height / 2) - sizeF.Height / 2f); } } protected override void WndProc(ref Message m) { if (((Message)(ref m)).Msg == 15 && !IsInDesignMode) { NativeMethods.BeginPaint(((Message)(ref m)).HWnd, out var lpPaint); NativeMethods.EndPaint(((Message)(ref m)).HWnd, ref lpPaint); ((Message)(ref m)).Result = IntPtr.Zero; } else { ((Control)this).WndProc(ref m); } } public Task EnsureCoreWebView2Async(CoreWebView2Environment environment = null, CoreWebView2ControllerOptions controllerOptions = null) { if (IsInDesignMode) { return Task.FromResult(0); } VerifyNotClosedGuard(); VerifyBrowserNotCrashedGuard(); if (((Control)this).InvokeRequired) { throw new InvalidOperationException("The method EnsureCoreWebView2Async can be invoked only from the UI thread."); } if (_initTask == null || _initTask.IsFaulted) { _initTask = InitCoreWebView2Async(environment, controllerOptions); } else { if ((!_isExplicitEnvironment && environment != null) || (_isExplicitEnvironment && environment != null && Environment != environment)) { throw new ArgumentException("WebView2 was already initialized with a different CoreWebView2Environment. Check to see if the Source property was already set or EnsureCoreWebView2Async was previously called with different values."); } if ((!_isExplicitControllerOptions && controllerOptions != null) || (_isExplicitControllerOptions && controllerOptions != null && ControllerOptions != controllerOptions)) { throw new ArgumentException("WebView2 was already initialized with a different CoreWebView2ControllerOptions. Check to see if the Source property was already set or EnsureCoreWebView2Async was previously called with different values."); } } return _initTask; } public Task EnsureCoreWebView2Async(CoreWebView2Environment environment) { return EnsureCoreWebView2Async(environment, null); } private async Task InitCoreWebView2Async(CoreWebView2Environment environment = null, CoreWebView2ControllerOptions controllerOptions = null) { _ = 3; try { if (environment != null) { Environment = environment; _isExplicitEnvironment = true; } else if (CreationProperties != null) { Environment = await CreationProperties.CreateEnvironmentAsync(); } if (Environment == null) { Environment = await CoreWebView2Environment.CreateAsync((string)null, (string)null, (CoreWebView2EnvironmentOptions)null); } if (controllerOptions != null) { ControllerOptions = controllerOptions; _isExplicitControllerOptions = true; } else if (CreationProperties != null) { ControllerOptions = CreationProperties.CreateCoreWebView2ControllerOptions(Environment); } bool shouldSetBackgroundColor = _defaultBackgroundColor != Color.White; string backgroundColorEnvVar = null; if (shouldSetBackgroundColor) { backgroundColorEnvVar = System.Environment.GetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR"); System.Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", Color.FromArgb(DefaultBackgroundColor.ToArgb()).Name); } if (ControllerOptions != null) { _coreWebView2Controller = await Environment.CreateCoreWebView2ControllerAsync(((Control)this).Handle, ControllerOptions); } else { _coreWebView2Controller = await Environment.CreateCoreWebView2ControllerAsync(((Control)this).Handle); } if (shouldSetBackgroundColor) { System.Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", backgroundColorEnvVar); } try { _browserHitTransparent = _coreWebView2Controller.IsBrowserHitTransparent; } catch (NotImplementedException) { } _coreWebView2Controller.ZoomFactor = _zoomFactor; _coreWebView2Controller.DefaultBackgroundColor = _defaultBackgroundColor; _coreWebView2Controller.Bounds = new Rectangle(0, 0, ((Control)this).Width, ((Control)this).Height); _coreWebView2Controller.IsVisible = ((Control)this).Visible; try { _coreWebView2Controller.AllowExternalDrop = _allowExternalDrop; } catch (NotImplementedException) { } _coreWebView2Controller.MoveFocusRequested += CoreWebView2Controller_MoveFocusRequested; if (!_browserHitTransparent) { _coreWebView2Controller.AcceleratorKeyPressed += _coreWebView2Controller_AcceleratorKeyPressed; } else { _coreWebView2Controller.KeyPressed += _coreWebView2Controller_KeyPressed; } _coreWebView2Controller.ZoomFactorChanged += _coreWebView2Controller_ZoomFactorChanged; string environmentVariable = System.Environment.GetEnvironmentVariable("COREWEBVIEW2_FORCED_HOSTING_MODE"); if (environmentVariable != null && environmentVariable.Equals("COREWEBVIEW2_HOSTING_MODE_WINDOW_TO_VISUAL")) { _coreWebView2Controller.GotFocus += _coreWebView2Controller_GotFocus; _coreWebView2Controller.LostFocus += _coreWebView2Controller_LostFocus; } CoreWebView2.NavigationCompleted += CoreWebView2_NavigationCompleted; CoreWebView2.NavigationStarting += CoreWebView2_NavigationStarting; CoreWebView2.SourceChanged += CoreWebView2_SourceChanged; CoreWebView2.WebMessageReceived += CoreWebView2_WebMessageReceived; CoreWebView2.ContentLoading += CoreWebView2_ContentLoading; CoreWebView2.ProcessFailed += CoreWebView2_ProcessFailed; try { CoreWebView2.Profile.Deleted += Profile_Deleted; } catch (NotImplementedException) { } ((Control)this).HandleDestroyed += WebView2_HandleDestroyed; ((Control)this).HandleCreated += WebView2_HandleCreated; if (((Control)this).Focused) { _coreWebView2Controller.MoveFocus((CoreWebView2MoveFocusReason)0); } bool num = _source != null; if (_source == null) { _source = new Uri(CoreWebView2.Source); } IsInitialized = true; this.CoreWebView2InitializationCompleted?.Invoke(this, new CoreWebView2InitializationCompletedEventArgs((Exception)null)); if (num) { CoreWebView2.Navigate(_source.AbsoluteUri); } } catch (Exception ex4) { this.CoreWebView2InitializationCompleted?.Invoke(this, new CoreWebView2InitializationCompletedEventArgs(ex4)); throw; } } private void Profile_Deleted(object sender, object e) { UnsubscribeHandlersAndCloseController(); } private void WebView2_HandleCreated(object sender, EventArgs e) { _coreWebView2Controller.ParentWindow = ((Control)this).Handle; _coreWebView2Controller.IsVisible = ((Control)this).Visible; } private void WebView2_HandleDestroyed(object sender, EventArgs e) { _coreWebView2Controller.IsVisible = false; _coreWebView2Controller.ParentWindow = IntPtr.Zero; } private void WebView2_WindowPositionChanged(object sender, EventArgs e) { CoreWebView2Controller coreWebView2Controller = _coreWebView2Controller; if (coreWebView2Controller != null) { coreWebView2Controller.NotifyParentWindowPositionChanged(); } } private void _coreWebView2Controller_KeyPressed(object sender, CoreWebView2PrivateKeyPressedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown CoreWebView2KeyEventKind keyEventKind = e.KeyEventKind; switch ((int)keyEventKind) { case 0: case 2: { KeyEventArgs e3 = new KeyEventArgs((Keys)(e.VirtualKey | Control.ModifierKeys)); ((Control)this).OnKeyDown(e3); e.Handled = e3.Handled; break; } case 1: case 3: { KeyEventArgs e2 = new KeyEventArgs((Keys)(e.VirtualKey | Control.ModifierKeys)); ((Control)this).OnKeyUp(e2); e.Handled = e2.Handled; break; } } } private void _coreWebView2Controller_AcceleratorKeyPressed(object sender, CoreWebView2AcceleratorKeyPressedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown CoreWebView2KeyEventKind keyEventKind = e.KeyEventKind; switch ((int)keyEventKind) { case 0: case 2: { KeyEventArgs e3 = new KeyEventArgs((Keys)(e.VirtualKey | Control.ModifierKeys)); ((Control)this).OnKeyDown(e3); e.Handled = e3.Handled; break; } case 1: case 3: { KeyEventArgs e2 = new KeyEventArgs((Keys)(e.VirtualKey | Control.ModifierKeys)); ((Control)this).OnKeyUp(e2); e.Handled = e2.Handled; break; } } } private void CoreWebView2Controller_MoveFocusRequested(object sender, CoreWebView2MoveFocusRequestedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) bool flag = (int)e.Reason == 1 || (int)e.Reason == 0; Control val = (Control)(((object)((Control)this).FindForm()) ?? ((object)((Control)this).Parent)); Control val2 = (Control)(object)((val.GetNextControl((Control)(object)this, flag) == ((Control)this).Parent && !flag) ? ((WebView2)(object)((Control)this).Parent) : this); e.Handled = val == null || val.SelectNextControl(val2, flag, true, true, true); if ((int)_lastMoveFocusReason != 0) { _coreWebView2Controller.MoveFocus(_lastMoveFocusReason); _lastMoveFocusReason = (CoreWebView2MoveFocusReason)0; } } protected override void OnVisibleChanged(EventArgs e) { ((Control)this).OnVisibleChanged(e); if (IsInitialized && !_browserCrashed) { _coreWebView2Controller.IsVisible = ((Control)this).Visible; } } protected override void OnSizeChanged(EventArgs e) { ((Control)this).OnSizeChanged(e); if (IsInitialized && !_browserCrashed) { _coreWebView2Controller.Bounds = new Rectangle(0, 0, ((Control)this).Width, ((Control)this).Height); } } protected override void Select(bool directed, bool forward) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (directed) { _lastMoveFocusReason = (CoreWebView2MoveFocusReason)(forward ? 1 : 2); } ((Control)this).Select(directed, forward); } protected override bool ProcessDialogKey(Keys keyData) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if ((keyData & 0x60000) == 0) { Keys val = (Keys)(keyData & 0xFFFF); if ((int)val == 9 || val - 37 <= 3) { return false; } } return ((Control)this).ProcessDialogKey(keyData); } protected override void OnGotFocus(EventArgs e) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) ((Control)this).OnGotFocus(e); if (IsInitialized && !_browserCrashed) { try { _coreWebView2Controller.MoveFocus(_lastMoveFocusReason); } catch (InvalidOperationException ex) { if (ex.InnerException.HResult != -2147019873) { throw ex; } } } _lastMoveFocusReason = (CoreWebView2MoveFocusReason)0; } protected override void OnParentChanged(EventArgs e) { ((Control)this).OnParentChanged(e); Form val = ((Control)this).FindForm(); if (val != null && val != _parentForm) { ((Control)val).LocationChanged += WebView2_WindowPositionChanged; if (_parentForm != null) { ((Control)_parentForm).LocationChanged -= WebView2_WindowPositionChanged; } _parentForm = val; } } private ISite GetSitedParentSite(Control control) { if (control != null) { if (((Component)(object)control).Site == null && control.Parent != null) { return GetSitedParentSite(control.Parent); } return ((Component)(object)control).Site; } throw new ArgumentNullException("control"); } void ISupportInitialize.BeginInit() { _inInit = true; } void ISupportInitialize.EndInit() { _inInit = false; if (!(_source == null)) { if (!IsInitialized) { EnsureCoreWebView2Async(); } else { CoreWebView2.Navigate(_source.AbsoluteUri); } } } private bool ShouldSerializeSource() { return (_source?.AbsoluteUri?.Length).GetValueOrDefault() > 0; } private void ResetSource() { _source = null; } public async Task<string> ExecuteScriptAsync(string script) { VerifyInitializedGuard(); VerifyBrowserNotCrashedGuard(); return await CoreWebView2.ExecuteScriptAsync(script); } public void Reload() { VerifyInitializedGuard(); VerifyBrowserNotCrashedGuard(); CoreWebView2.Reload(); } public void GoForward() { CoreWebView2 coreWebView = CoreWebView2; if (coreWebView != null) { coreWebView.GoForward(); } } public void GoBack() { CoreWebView2 coreWebView = CoreWebView2; if (coreWebView != null) { coreWebView.GoBack(); } } public void NavigateToString(string htmlContent) { VerifyInitializedGuard(); VerifyBrowserNotCrashedGuard(); CoreWebView2.NavigateToString(htmlContent); } public void Stop() { CoreWebView2 coreWebView = CoreWebView2; if (coreWebView != null) { coreWebView.Stop(); } } private void VerifyInitializedGuard() { if (!IsInitialized) { throw new InvalidOperationException("The instance of CoreWebView2 is uninitialized and unable to complete this operation. See EnsureCoreWebView2Async."); } } private void VerifyNotClosedGuard() { if (((Control)this).IsDisposed) { throw new InvalidOperationException("The instance of CoreWebView2 is disposed and unable to complete this operation."); } } private void VerifyBrowserNotCrashedGuard() { if (_browserCrashed) { throw new InvalidOperationException("The instance of CoreWebView2 is no longer valid because the browser process crashed.To work around this, please listen for the ProcessFailed event to explicitly manage the lifetime of the WebView2 control in the event of a browser failure.https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.processfailed"); } } private void CoreWebView2_NavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e) { this.NavigationStarting?.Invoke(this, e); } private void CoreWebView2_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) { this.NavigationCompleted?.Invoke(this, e); } private void CoreWebView2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e) { this.WebMessageReceived?.Invoke(this, e); } private void CoreWebView2_SourceChanged(object sender, CoreWebView2SourceChangedEventArgs e) { _source = new Uri(CoreWebView2.Source); this.SourceChanged?.Invoke(this, e); } private void CoreWebView2_ContentLoading(object sender, CoreWebView2ContentLoadingEventArgs e) { this.ContentLoading?.Invoke(this, e); } private void CoreWebView2_ProcessFailed(object sender, CoreWebView2ProcessFailedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)e.ProcessFailedKind == 0) { UnsubscribeHandlersAndCloseController(browserCrashed: true); } } private void _coreWebView2Controller_ZoomFactorChanged(object sender, object e) { _zoomFactor = _coreWebView2Controller.ZoomFactor; this.ZoomFactorChanged?.Invoke(this, EventArgs.Empty); } private void _coreWebView2Controller_GotFocus(object sender, object e) { ((Control)this).OnGotFocus(new EventArgs()); } private void _coreWebView2Controller_LostFocus(object sender, object e) { ((Control)this).OnLostFocus(new EventArgs()); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); } }
BepInEx/plugins/OnTogetherSchoolScreen.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Pipes; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using PurrNet; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("OnTogetherSchoolScreen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5811986efea5c7bd5c169e74cc042db1d889a6c3")] [assembly: AssemblyProduct("OnTogetherSchoolScreen")] [assembly: AssemblyTitle("OnTogetherSchoolScreen")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace OnTogetherSchoolScreen { internal static class BoardPacketEnvelope { internal const bool IsErase = true; internal const bool IsBigErase = false; internal const int MaximumFirstGroup = 16777215; internal static float EncodeFirstGroup(float value) { if (float.IsNaN(value) || float.IsInfinity(value) || value < 0f || value > 16777215f || (double)value != Math.Truncate(value)) { throw new ArgumentOutOfRangeException("value", "A board payload group must be an unsigned 24-bit integer."); } return 0f - value - 1f; } internal static float DecodeFirstGroup(float value) { if (!(value < 0f)) { return value; } return 0f - value - 1f; } } internal sealed class PlaybackSession { private bool _hasPlayed; public int LoadId { get; private set; } public string VideoId { get; private set; } = ""; public bool HasEnded { get; private set; } public int Begin(string videoId) { LoadId = ((LoadId == int.MaxValue) ? 1 : (LoadId + 1)); VideoId = videoId ?? ""; _hasPlayed = false; HasEnded = false; return LoadId; } public void Clear() { Begin(""); } public void Resume() { if (HasEnded) { _hasPlayed = false; HasEnded = false; } } public bool Observe(string videoId, int loadId, int state) { if (string.IsNullOrEmpty(VideoId) || loadId != LoadId || !string.Equals(videoId, VideoId, StringComparison.Ordinal)) { return false; } if (state == 1) { _hasPlayed = true; HasEnded = false; } if (state == 0 && _hasPlayed) { HasEnded = true; } return true; } public bool ShouldAdvance(bool controlsPlayback, bool startRequested, bool hasQueuedVideos) { if (!controlsPlayback) { return false; } if (!string.IsNullOrEmpty(VideoId)) { return HasEnded; } return startRequested && hasQueuedVideos; } } internal sealed class SavedPlaylistEntry { public string VideoId { get; } public string Title { get; } public SavedPlaylistEntry(string videoId, string title = "") { VideoId = videoId ?? ""; Title = title ?? ""; } } internal sealed class SavedPlaylist { public string Name { get; } public IReadOnlyList<SavedPlaylistEntry> Entries { get; } internal SavedPlaylist(string name, IEnumerable<SavedPlaylistEntry> entries) { Name = name; Entries = new ReadOnlyCollection<SavedPlaylistEntry>(entries.ToList()); } } internal sealed class SavedPlaylistStore { public const int MaxPlaylists = 20; public const int MaxEntries = 30; public const int MaxNameLength = 48; public const int MaxTitleLength = 512; private const int MaxFileBytes = 1048576; private const string FileName = "OnTogetherSchoolScreen.playlists.xml"; private static readonly object StoreLock = new object(); public string FilePath { get; } public SavedPlaylistStore(string configDirectory) { if (string.IsNullOrWhiteSpace(configDirectory)) { throw new ArgumentException("A config directory is required.", "configDirectory"); } FilePath = Path.Combine(Path.GetFullPath(configDirectory), "OnTogetherSchoolScreen.playlists.xml"); } public bool TryLoad(out IReadOnlyList<SavedPlaylist> playlists, out string error) { lock (StoreLock) { if (!TryRead(out var playlists2, out var _, out error)) { playlists = Array.Empty<SavedPlaylist>(); return false; } playlists = new ReadOnlyCollection<SavedPlaylist>(playlists2); return true; } } public bool TrySave(string name, IEnumerable<SavedPlaylistEntry> entries, out string error) { if (!TryNormalizeName(name, out var normalizedName, out error)) { return false; } if (!TryNormalizeEntries(entries, out var normalized, out error)) { return false; } lock (StoreLock) { if (!TryRead(out var playlists, out var original, out error)) { return false; } int num = playlists.FindIndex((SavedPlaylist item) => string.Equals(item.Name, normalizedName, StringComparison.OrdinalIgnoreCase)); SavedPlaylist savedPlaylist = new SavedPlaylist(normalizedName, normalized); if (num >= 0) { playlists[num] = savedPlaylist; } else { if (playlists.Count >= 20) { error = "You can save up to " + 20 + " playlists. Delete one before saving another."; return false; } playlists.Add(savedPlaylist); } return TryWrite(playlists, original, out error); } } public bool TryDelete(string name, out string error) { if (!TryNormalizeName(name, out var normalizedName, out error)) { return false; } lock (StoreLock) { if (!TryRead(out var playlists, out var original, out error)) { return false; } int num = playlists.FindIndex((SavedPlaylist item) => string.Equals(item.Name, normalizedName, StringComparison.OrdinalIgnoreCase)); if (num < 0) { error = "No saved playlist named \"" + normalizedName + "\" was found."; return false; } playlists.RemoveAt(num); return TryWrite(playlists, original, out error); } } private bool TryRead(out List<SavedPlaylist> playlists, out byte[] original, out string error) { playlists = new List<SavedPlaylist>(); original = null; error = ""; try { original = ReadFileBytes(FilePath); if (original == null) { return true; } XmlReaderSettings settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null, MaxCharactersInDocument = 1048576L, IgnoreComments = true, IgnoreProcessingInstructions = true }; XDocument xDocument; using (MemoryStream input = new MemoryStream(original, writable: false)) { using XmlReader reader = XmlReader.Create(input, settings); xDocument = XDocument.Load(reader); } XElement root = xDocument.Root; if (root == null || root.Name != "savedPlaylists" || (string?)root.Attribute("version") != "1" || root.Attributes().Any((XAttribute attribute) => attribute.Name != "version")) { throw new InvalidDataException("The saved-playlist format is not supported."); } RequireElementsOnly(root); foreach (XElement item in root.Elements()) { if (item.Name != "playlist" || item.Attributes().Any((XAttribute attribute) => attribute.Name != "name")) { throw new InvalidDataException("The saved-playlist file contains an unexpected item."); } if (!TryNormalizeName((string?)item.Attribute("name"), out var name, out var error2)) { throw new InvalidDataException(error2); } if (playlists.Any((SavedPlaylist item) => string.Equals(item.Name, name, StringComparison.OrdinalIgnoreCase))) { throw new InvalidDataException("The saved-playlist file contains duplicate playlist names."); } RequireElementsOnly(item); List<SavedPlaylistEntry> list = new List<SavedPlaylistEntry>(); foreach (XElement item2 in item.Elements()) { if (item2.Name != "video" || item2.HasElements || item2.Attributes().Any((XAttribute attribute) => attribute.Name != "id" && attribute.Name != "title") || !string.IsNullOrWhiteSpace(item2.Value)) { throw new InvalidDataException("The saved-playlist file contains an unexpected video item."); } list.Add(new SavedPlaylistEntry((string?)item2.Attribute("id"), (string?)item2.Attribute("title"))); if (list.Count > 30) { throw new InvalidDataException("A saved playlist contains more than " + 30 + " videos."); } } if (!TryNormalizeEntries(list, out var normalized, out error2)) { throw new InvalidDataException(error2); } playlists.Add(new SavedPlaylist(name, normalized)); if (playlists.Count > 20) { throw new InvalidDataException("The file contains more than " + 20 + " saved playlists."); } } return true; } catch (Exception ex) when (IsStorageError(ex)) { playlists.Clear(); error = "Saved playlists could not be read. The existing file was left unchanged: " + ex.Message + " File: " + FilePath; return false; } } private bool TryWrite(List<SavedPlaylist> playlists, byte[] original, out string error) { string text = null; error = ""; try { string? directoryName = Path.GetDirectoryName(FilePath); Directory.CreateDirectory(directoryName); text = Path.Combine(directoryName, "OnTogetherSchoolScreen.playlists.xml." + Guid.NewGuid().ToString("N") + ".tmp"); XElement xElement = new XElement("savedPlaylists", new XAttribute("version", "1"), playlists.Select((SavedPlaylist playlist) => new XElement("playlist", new XAttribute("name", playlist.Name), playlist.Entries.Select((SavedPlaylistEntry entry) => new XElement("video", new XAttribute("id", entry.VideoId), new XAttribute("title", entry.Title)))))); XmlWriterSettings settings = new XmlWriterSettings { Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), Indent = true }; using (FileStream fileStream = new FileStream(text, FileMode.CreateNew, FileAccess.Write, FileShare.None)) { using (XmlWriter xmlWriter = XmlWriter.Create(fileStream, settings)) { new XDocument(xElement).Save(xmlWriter); xmlWriter.Flush(); } fileStream.Flush(flushToDisk: true); if (fileStream.Length > 1048576) { throw new InvalidDataException("The saved-playlist collection is too large to save."); } } byte[] second = ReadFileBytes(FilePath); if (!SameBytes(original, second)) { error = "Saved playlists changed while saving. Reload them and try again."; return false; } if (original == null) { File.Move(text, FilePath); } else { File.Replace(text, FilePath, FilePath + ".bak"); } text = null; return true; } catch (Exception ex) when (IsStorageError(ex)) { error = "Saved playlists could not be saved. Your existing playlists were kept: " + ex.Message + " File: " + FilePath; return false; } finally { if (text != null) { try { File.Delete(text); } catch (IOException) { } catch (UnauthorizedAccessException) { } } } } private static byte[] ReadFileBytes(string path) { try { using FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); if (fileStream.Length > 1048576) { throw new InvalidDataException("The saved-playlist file is too large."); } using MemoryStream memoryStream = new MemoryStream(); byte[] array = new byte[4096]; int num; while ((num = fileStream.Read(array, 0, array.Length)) > 0) { if (memoryStream.Length + num > 1048576) { throw new InvalidDataException("The saved-playlist file is too large."); } memoryStream.Write(array, 0, num); } return memoryStream.ToArray(); } catch (FileNotFoundException) { return null; } catch (DirectoryNotFoundException) { return null; } } private static bool TryNormalizeName(string name, out string normalized, out string error) { normalized = (name ?? "").Trim(); error = ""; if (normalized.Length == 0 || normalized.Length > 48) { error = "Give the playlist a name between 1 and " + 48 + " characters."; return false; } if (normalized.Any(char.IsControl) || !HasValidXmlCharacters(normalized)) { error = "The playlist name contains unsupported characters."; return false; } return true; } private static bool TryNormalizeEntries(IEnumerable<SavedPlaylistEntry> entries, out List<SavedPlaylistEntry> normalized, out string error) { normalized = new List<SavedPlaylistEntry>(); error = ""; if (entries == null) { error = "The playlist videos could not be read."; return false; } foreach (SavedPlaylistEntry entry in entries) { if (entry == null || !IsVideoId(entry.VideoId)) { error = "Every playlist video must have a valid 11-character YouTube video ID."; return false; } string text = entry.Title.Trim(); if (text.Length > 512 || !HasValidXmlCharacters(text)) { error = "A video title is too long or contains unsupported characters."; return false; } normalized.Add(new SavedPlaylistEntry(entry.VideoId, text)); if (normalized.Count > 30) { error = "A saved playlist can contain up to " + 30 + " videos."; return false; } } return true; } private static bool IsVideoId(string value) { if (value != null && value.Length == 11) { return value.All((char character) => (character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9') || character == '_' || character == '-'); } return false; } private static bool HasValidXmlCharacters(string value) { try { XmlConvert.VerifyXmlChars(value); return true; } catch (XmlException) { return false; } } private static void RequireElementsOnly(XElement element) { if (element.Nodes().OfType<XText>().Any((XText text) => !string.IsNullOrWhiteSpace(text.Value))) { throw new InvalidDataException("The saved-playlist file contains unexpected text."); } } private static bool SameBytes(byte[] first, byte[] second) { if (first == null || second == null) { return first == second; } return ((ReadOnlySpan<byte>)first).SequenceEqual((ReadOnlySpan<byte>)second); } private static bool IsStorageError(Exception exception) { if (!(exception is IOException) && !(exception is InvalidDataException) && !(exception is UnauthorizedAccessException) && !(exception is XmlException) && !(exception is ArgumentException) && !(exception is NotSupportedException)) { return exception is SecurityException; } return true; } } [BepInPlugin("codex.ontogether.school-screen", "On-Together School Screen", "0.1.12")] public sealed class SchoolScreenPlugin : BaseUnityPlugin { private sealed class SavedPlaylistSubmittedTrack { public int Index; public string VideoId; } private sealed class LobbyMember { public string Name; public int PeerToken; } private sealed class QueueEntry { public string VideoId; public string Title; public string AddedBy; public int OwnerPeerToken; public string OwnerPlayerKey; public int AdmissionSequence; } private sealed class QueueBatchRequest { public string[] VideoIds; public float StartedAt; } private sealed class VideoThumbnailEntry { public string VideoId; public Texture2D Texture; public bool Fetching; public int Attempts; public float RetryAt; public float LastWantedAt; public long LastUse; } private sealed class VideoThumbnailResult { public string VideoId; public byte[] Bytes; } private const float LibraryWindowWidth = 740f; private const float LibraryWindowHeight = 620f; private const float LibraryFooterY = 534f; private readonly List<Texture2D> _libraryUiTextures = new List<Texture2D>(); private SavedPlaylistStore _savedPlaylistStore; private readonly List<SavedPlaylist> _savedPlaylists = new List<SavedPlaylist>(); private readonly HashSet<int> _selectedSavedTracks = new HashSet<int>(); private string _selectedSavedPlaylistName = ""; private string _savedPlaylistLink = ""; private string _savedPlaylistMessage = ""; private string _savedPlaylistErrorDetail = ""; private bool _savedPlaylistStoreReady; private bool _savedPlaylistShowQueueStatus; private Vector2 _savedCollectionsScroll; private Vector2 _savedTracksScroll; private GUIStyle _savedPlaylistCardTitleStyle; private GUIStyle _savedPlaylistTrackTitleStyle; private GUIStyle _savedPlaylistHintStyle; private GUIStyle _savedPlaylistMessageStyle; private int _savedPlaylistNamePrompt; private string _savedPlaylistNameDraft = ""; private List<SavedPlaylistEntry> _savedPlaylistQueueDraft; private SavedPlaylist _savedPlaylistDeletePrompt; private string _savedPlaylistOverwriteName = ""; private List<SavedPlaylistEntry> _savedPlaylistOverwriteEntries; private SavedPlaylist _savedPlaylistUndo; private float _nextSavedPlaylistTitleRefresh; private string _submittedSavedPlaylistName = ""; private List<SavedPlaylistSubmittedTrack> _submittedSavedPlaylistTracks; private const float BoardCommandMarker = 2f; private const float LegacyBoardCommandMarker = -2f; private const float PeerTokenScale = 1048576f; private const int PeerTokenMask = 1048575; private const int QueueEventSequenceMask = 1048575; private const float NearBoardDistance = 3f; private const float SilentDistance = 18f; private const string HostMemberKey = "__local_host__"; private const int DefaultQueueLimit = 3; private const int DefaultQueueCooldown = 10; private const float QueueAuthorityWait = 1.5f; private const float QueueElectionConflictWindow = 8f; private static SchoolScreenPlugin _instance; private readonly ConcurrentQueue<string> _networkQueue = new ConcurrentQueue<string>(); private readonly ConcurrentQueue<string> _browserQueue = new ConcurrentQueue<string>(); private readonly Dictionary<string, LobbyMember> _moddedPlayers = new Dictionary<string, LobbyMember>(); private readonly HashSet<string> _blockedQueuePlayers = new HashSet<string>(); private readonly HashSet<int> _peerSkipVotes = new HashSet<int>(); private readonly Dictionary<int, float> _peerLastSeen = new Dictionary<int, float>(); private readonly Dictionary<int, string> _peerPlayerKeys = new Dictionary<int, string>(); private readonly HashSet<long> _processedQueueEvents = new HashSet<long>(); private readonly Dictionary<long, int> _queueAdmissionResults = new Dictionary<long, int>(); private readonly Queue<long> _queueAdmissionHistory = new Queue<long>(); private readonly Dictionary<string, float> _queueLastAcceptedAt = new Dictionary<string, float>(StringComparer.Ordinal); private readonly Dictionary<int, string> _queueOwnerKeys = new Dictionary<int, string>(); private readonly Dictionary<int, string> _queueOwnerNames = new Dictionary<int, string>(); private readonly Dictionary<long, QueueBatchRequest> _incomingQueueBatches = new Dictionary<long, QueueBatchRequest>(); private readonly HashSet<long> _processedPlaybackEvents = new HashSet<long>(); private readonly PlaybackSession _playbackSession = new PlaybackSession(); private readonly HashSet<string> _queueTitleLookups = new HashSet<string>(StringComparer.Ordinal); private readonly Dictionary<string, string> _queueTitleCache = new Dictionary<string, string>(StringComparer.Ordinal); private readonly List<QueueEntry> _videoQueue = new List<QueueEntry>(); private readonly object _pipeWriteLock = new object(); private Harmony _harmony; private NamedPipeServerStream _pipe; private Process _browser; private Texture2D _videoTexture; private byte[] _pendingJpeg; private QuadPainterGPU _schoolBoard; private float _nextBoardSearch; private Renderer _schoolRenderer; private Material _schoolMaterial; private bool _panelOpen; private bool _guiInitialized; private volatile bool _pipeConnected; private bool _host; private bool _lobbyIdentityInitialized; private bool _lobbyStateObserved; private bool _observedLobbyActive; private string _observedLobbyCode; private string _status = "Looking for the school whiteboard…"; private string _url = ""; private string _videoId = ""; private Rect _windowRect; private bool _windowPositioned; private GUIStyle _windowStyle; private GUIStyle _titleStyle; private GUIStyle _subtitleStyle; private GUIStyle _sectionStyle; private GUIStyle _statusStyle; private GUIStyle _hintStyle; private GUIStyle _inputStyle; private GUIStyle _placeholderStyle; private GUIStyle _primaryButtonStyle; private GUIStyle _controlButtonStyle; private GUIStyle _seekButtonStyle; private GUIStyle _hostBadgeStyle; private GUIStyle _viewerBadgeStyle; private GUIStyle _closeButtonStyle; private GUIStyle _volumeSliderStyle; private GUIStyle _volumeThumbStyle; private Texture2D _windowTexture; private Texture2D _fieldTexture; private Texture2D _buttonTexture; private Texture2D _buttonHoverTexture; private Texture2D _accentTexture; private Texture2D _accentHoverTexture; private Texture2D _badgeTexture; private Texture2D _statusTexture; private Texture2D _meterBackgroundTexture; private Texture2D _libraryRailTexture; private Texture2D _libraryCardTexture; private GUIStyle _libraryNavStyle; private GUIStyle _librarySelectedNavStyle; private GUIStyle _libraryCardStyle; private GUIStyle _libraryMetaStyle; private GUIStyle _libraryCardTitleStyle; private GUIStyle _libraryRightStyle; private GUIStyle _libraryHeadingStyle; private string _libraryNotice = ""; private float _videoTime; private int _playerState = -1; private float _nextSync; private float _lastFrameTime; private float _nextVolumeUpdate; private float _maximumVolume = 100f; private int _effectiveVolume; private int _lastSentVolume = -1; private bool _muted; private int _activeTab; private bool _localVotedSkip; private float _nextLobbyHeartbeat; private int _reportedModCount; private int _voteCount; private int _votesRequired; private int _localPeerToken; private int _queueEventSequence; private int _playbackControllerToken; private int _moddedHostPeerToken; private int _queueCoordinatorToken; private int _announcedQueueCoordinatorToken; private float _queueAuthorityReadyAt; private float _queueAuthoritySince; private float _queueAuthorityObservedAt; private int _queueSnapshotRevision; private List<QueueEntry> _incomingQueueSnapshot; private int _incomingQueueSource; private int _incomingQueueRevision; private int _incomingQueueExpectedCount; private float _incomingQueueStartedAt; private int _pendingQueueSequence; private List<string> _pendingQueueVideoIds; private string _pendingQueueInput; private bool _pendingQueueClearInput; private float _pendingQueueStartedAt; private float _nextQueueRequestRetry; private int _queueLimit = 3; private int _queueCooldown = 10; private ConfigEntry<int> _configuredQueueLimit; private ConfigEntry<int> _configuredQueueCooldown; private bool _queueStartRequested; private float _nextQueueStartAt; private int _playerVolume; private Vector2 _queueScroll; private Vector2 _accessScroll; private string _videoTitle = ""; private string _queueStatus = ""; private string _pipeName; private const int MaximumThumbnailEntries = 100; private const int MaximumThumbnailBytes = 262144; private const int MaximumThumbnailDownloads = 2; private const int MaximumDurationEntries = 300; private const int MaximumVideoDurationSeconds = 604800; private readonly Dictionary<string, VideoThumbnailEntry> _videoThumbnails = new Dictionary<string, VideoThumbnailEntry>(StringComparer.Ordinal); private readonly Queue<string> _thumbnailRequests = new Queue<string>(); private readonly HashSet<string> _thumbnailRequestsQueued = new HashSet<string>(StringComparer.Ordinal); private readonly ConcurrentQueue<VideoThumbnailResult> _thumbnailResults = new ConcurrentQueue<VideoThumbnailResult>(); private readonly Dictionary<string, int> _videoDurations = new Dictionary<string, int>(StringComparer.Ordinal); private readonly Queue<string> _videoDurationOrder = new Queue<string>(); private readonly CancellationTokenSource _videoMetadataLifetime = new CancellationTokenSource(); private HttpClient _videoThumbnailHttpClient; private int _activeThumbnailDownloads; private long _thumbnailUseSequence; private bool _videoMetadataDisposed; private void CreateLibraryGuiStyles() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_018a: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_021a: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0242: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown //IL_0293: Expected O, but got Unknown //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) _libraryRailTexture = MakeGuiTexture(Color32.op_Implicit(new Color32((byte)17, (byte)21, (byte)32, byte.MaxValue))); _libraryUiTextures.Add(_libraryRailTexture); _libraryCardTexture = MakeLibraryRoundedTexture(new Color32((byte)38, (byte)43, (byte)59, byte.MaxValue)); Texture2D val = MakeLibraryRoundedTexture(new Color32((byte)56, (byte)47, (byte)80, byte.MaxValue)); Texture2D normal = MakeLibraryRoundedTexture(new Color32((byte)39, (byte)44, (byte)60, byte.MaxValue)); Texture2D hover = MakeLibraryRoundedTexture(new Color32((byte)58, (byte)63, (byte)81, byte.MaxValue)); Texture2D normal2 = MakeLibraryRoundedTexture(new Color32((byte)163, (byte)148, byte.MaxValue, byte.MaxValue)); Texture2D hover2 = MakeLibraryRoundedTexture(new Color32((byte)183, (byte)171, byte.MaxValue, byte.MaxValue)); Color color = Color32.op_Implicit(new Color32((byte)238, (byte)241, (byte)251, byte.MaxValue)); Color color2 = Color32.op_Implicit(new Color32((byte)182, (byte)191, (byte)213, byte.MaxValue)); _primaryButtonStyle = MakeButtonStyle(13, (FontStyle)1, normal2, hover2, Color32.op_Implicit(new Color32((byte)30, (byte)22, (byte)63, byte.MaxValue))); _controlButtonStyle = MakeButtonStyle(12, (FontStyle)1, normal, hover, color); _seekButtonStyle = MakeButtonStyle(11, (FontStyle)0, normal, hover, color2); GUIStyle primaryButtonStyle = _primaryButtonStyle; GUIStyle controlButtonStyle = _controlButtonStyle; GUIStyle seekButtonStyle = _seekButtonStyle; RectOffset val2 = new RectOffset(9, 9, 9, 9); RectOffset val3 = val2; seekButtonStyle.border = val2; RectOffset border = (controlButtonStyle.border = val3); primaryButtonStyle.border = border; _libraryNavStyle = MakeButtonStyle(12, (FontStyle)1, _libraryRailTexture, hover, color2); _librarySelectedNavStyle = MakeButtonStyle(12, (FontStyle)1, val, val, Color32.op_Implicit(new Color32((byte)178, (byte)163, byte.MaxValue, byte.MaxValue))); GUIStyle libraryNavStyle = _libraryNavStyle; GUIStyle librarySelectedNavStyle = _librarySelectedNavStyle; TextAnchor alignment = (TextAnchor)3; librarySelectedNavStyle.alignment = (TextAnchor)3; libraryNavStyle.alignment = alignment; GUIStyle libraryNavStyle2 = _libraryNavStyle; GUIStyle librarySelectedNavStyle2 = _librarySelectedNavStyle; RectOffset val5 = new RectOffset(13, 8, 4, 4); border = val5; librarySelectedNavStyle2.padding = val5; libraryNavStyle2.padding = border; GUIStyle libraryNavStyle3 = _libraryNavStyle; GUIStyle librarySelectedNavStyle3 = _librarySelectedNavStyle; RectOffset val6 = new RectOffset(9, 9, 9, 9); border = val6; librarySelectedNavStyle3.border = val6; libraryNavStyle3.border = border; GUIStyle val7 = new GUIStyle(GUI.skin.box); val7.normal.background = _libraryCardTexture; val7.border = new RectOffset(9, 9, 9, 9); val7.padding = new RectOffset(10, 10, 8, 8); _libraryCardStyle = val7; _libraryMetaStyle = MakeLabelStyle(11, (FontStyle)0, color2, (TextAnchor)3); _libraryMetaStyle.wordWrap = true; _libraryRightStyle = MakeLabelStyle(11, (FontStyle)0, color2, (TextAnchor)5); _libraryHeadingStyle = MakeLabelStyle(23, (FontStyle)1, color, (TextAnchor)3); _libraryCardTitleStyle = MakeLabelStyle(13, (FontStyle)1, color, (TextAnchor)0); _libraryCardTitleStyle.wordWrap = true; _libraryCardTitleStyle.clipping = (TextClipping)1; _statusStyle.wordWrap = true; _hintStyle.fontSize = 11; } private Texture2D MakeLibraryRoundedTexture(Color32 color, bool tracked = true) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) Color32[] array = (Color32[])(object)new Color32[576]; for (int i = 0; i < 24; i++) { for (int j = 0; j < 24; j++) { float num = (float)j + 0.5f; float num2 = (float)i + 0.5f; float num3 = Mathf.Clamp(num, 9f, 15f); float num4 = Mathf.Clamp(num2, 9f, 15f); float num5 = Mathf.Clamp01(9.5f - Mathf.Sqrt((num - num3) * (num - num3) + (num2 - num4) * (num2 - num4))); Color32 val = color; val.a = (byte)Mathf.RoundToInt((float)(int)color.a * num5); array[i * 24 + j] = val; } } Texture2D val2 = new Texture2D(24, 24, (TextureFormat)4, false) { hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; val2.SetPixels32(array); val2.Apply(false, true); if (tracked) { _libraryUiTextures.Add(val2); } return val2; } private void DrawLibraryControlPanel(int windowId) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(0f, 0f, 150f, 534f), (Texture)(object)_libraryRailTexture); GUI.DrawTexture(new Rect(150f, 0f, 1f, 534f), (Texture)(object)_badgeTexture); GUI.Label(new Rect(18f, 22f, 116f, 53f), "Study\nscreen", _titleStyle); string[] array = new string[4] { "Now playing", "Lobby queue", "Playlists", "Access" }; for (int i = 0; i < array.Length; i++) { if (GUI.Button(new Rect(12f, (float)(111 + i * 46), 126f, 37f), array[i], (_activeTab == i) ? _librarySelectedNavStyle : _libraryNavStyle)) { _activeTab = i; _libraryNotice = ""; } } GUI.Box(new Rect(18f, 460f, 81f, 23f), _host ? "HOST" : "VIEWER", _host ? _hostBadgeStyle : _viewerBadgeStyle); GUI.Label(new Rect(18f, 490f, 120f, 20f), "F9 · Open / close", _libraryMetaStyle); if (GUI.Button(new Rect(701f, 12f, 24f, 26f), "X", _closeButtonStyle)) { _panelOpen = false; } Rect area = default(Rect); ((Rect)(ref area))..ctor(174f, 26f, 544f, 490f); DrawLibraryPlayerFooter(); if (_activeTab == 0) { DrawLibraryNowPlaying(area); } else if (_activeTab == 1) { DrawLibraryQueue(area); } else if (_activeTab == 2) { DrawLibraryPlaylists(area); } else { DrawLibraryAccess(area); } DrawLibraryTooltip(); GUI.DragWindow(new Rect(0f, 0f, 690f, 63f)); } private void DrawLibraryNowPlaying(Rect area) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, ((Rect)(ref area)).width - 42f, 30f), "Now playing", _libraryHeadingStyle); bool flag = !string.IsNullOrEmpty(_videoId); string text = ((!flag) ? "Choose a video or browse your playlists." : (string.IsNullOrWhiteSpace(_videoTitle) ? "Loading video title…" : _videoTitle)); GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 38f, ((Rect)(ref area)).width, 39f), new GUIContent(text, flag ? text : ""), _libraryCardTitleStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref area)).x, ((Rect)(ref area)).y + 83f, ((Rect)(ref area)).width, 230f); DrawVideoThumbnail(val, _videoId); bool flag2 = _pipeConnected && (Object)(object)_videoTexture != (Object)null && ((Texture)_videoTexture).width > 2 && Time.unscaledTime - _lastFrameTime < 4f; if (flag2) { GUI.DrawTexture(val, (Texture)(object)_videoTexture, (ScaleMode)2); } GUI.Label(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 81f, ((Rect)(ref val)).width - 40f, 32f), (!flag && !flag2) ? "School screen" : "", _libraryHeadingStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 119f, ((Rect)(ref val)).width - 40f, 27f), (flag || flag2) ? "" : (IsBoardNetworkReady(_schoolBoard) ? "Ready to watch together" : "Connecting to the school whiteboard…"), _libraryMetaStyle); bool enabled = GUI.enabled; bool flag3 = IsBoardNetworkReady(_schoolBoard); GUI.enabled = enabled && flag3 && flag; if (GUI.Button(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 326f, 119f, 35f), (_playerState == 2) ? "Play" : "Pause", _primaryButtonStyle)) { Control((_playerState == 2) ? "PLAY" : "PAUSE"); } if (GUI.Button(new Rect(((Rect)(ref area)).x + 126f, ((Rect)(ref area)).y + 326f, 152f, 35f), _host ? "Skip now" : (_localVotedSkip ? "Remove my vote" : "Vote to skip"), _controlButtonStyle)) { if (_host) { SkipCurrentVideo(); } else { ToggleSkipVote(); } } GUI.enabled = enabled && flag3 && flag && _host; if (GUI.Button(new Rect(((Rect)(ref area)).x + 285f, ((Rect)(ref area)).y + 326f, 80f, 35f), "Stop", _controlButtonStyle)) { Control("CLEAR"); } if (GUI.Button(new Rect(((Rect)(ref area)).x + 372f, ((Rect)(ref area)).y + 326f, 82f, 35f), "−15 sec", _seekButtonStyle)) { Seek(-15f); } if (GUI.Button(new Rect(((Rect)(ref area)).x + 461f, ((Rect)(ref area)).y + 326f, 83f, 35f), "+15 sec", _seekButtonStyle)) { Seek(15f); } GUI.enabled = enabled; string text2 = (flag ? GetVideoDurationText(_videoId) : "--"); string text3 = (flag ? (FormatLibraryTime(_videoTime) + ((text2 == "--") ? "" : (" / " + text2))) : ""); GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 367f, 165f, 20f), text3, _libraryMetaStyle); string text4 = ((!_host && flag) ? (_voteCount + "/" + _votesRequired + " skip votes · " + _reportedModCount + " modded viewers") : ""); GUI.Label(new Rect(((Rect)(ref area)).x + 168f, ((Rect)(ref area)).y + 367f, ((Rect)(ref area)).width - 168f, 20f), text4, _libraryRightStyle); DrawLibraryAddVideo(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 408f, ((Rect)(ref area)).width, 36f), !flag && _videoQueue.Count == 0); string text5 = ((_status.StartsWith("WebView2 error", StringComparison.Ordinal) || _status.StartsWith("Could not start", StringComparison.Ordinal) || !_pipeConnected) ? _status : ((!string.IsNullOrWhiteSpace(_queueStatus)) ? _queueStatus : _libraryNotice)); GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 451f, ((Rect)(ref area)).width, 36f), text5, _libraryMetaStyle); } private void DrawLibraryAddVideo(Rect rect, bool firstVideo = false) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) float num = 146f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - num - 8f, ((Rect)(ref rect)).height); _url = GUI.TextField(val, _url, _inputStyle); if (string.IsNullOrEmpty(_url)) { GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 7f, ((Rect)(ref val)).width - 20f, ((Rect)(ref val)).height - 14f), "Paste a YouTube link or video ID", _placeholderStyle); } bool enabled = GUI.enabled; GUI.enabled = enabled && IsBoardNetworkReady(_schoolBoard) && _pendingQueueSequence == 0; if (GUI.Button(new Rect(((Rect)(ref rect)).xMax - num, ((Rect)(ref rect)).y, num, ((Rect)(ref rect)).height), (_pendingQueueSequence != 0) ? "ADDING…" : (firstVideo ? "PLAY ON THE BOARD" : "ADD TO QUEUE"), _primaryButtonStyle)) { AddVideoToQueue(); } GUI.enabled = enabled; } private void DrawLibraryQueue(Rect area) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, 345f, 30f), "Lobby queue", _libraryHeadingStyle); DrawSaveQueueShortcut(new Rect(((Rect)(ref area)).xMax - 103f, ((Rect)(ref area)).y + 1f, 103f, 31f)); int num = CountPendingQueueEntries(GetQueueOwnerKey(_localPeerToken)); GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 34f, ((Rect)(ref area)).width, 20f), "Up next · " + _videoQueue.Count + " | Your videos · " + num + " / " + _queueLimit, _libraryMetaStyle); DrawLibraryAddVideo(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 62f, ((Rect)(ref area)).width, 35f)); GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 104f, ((Rect)(ref area)).width, 35f), _queueStatus, _libraryMetaStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref area)).x, ((Rect)(ref area)).y + 146f, ((Rect)(ref area)).width, 280f); float num2 = 90f; float num3 = ((Rect)(ref val)).width - 18f; _queueScroll = GUI.BeginScrollView(val, _queueScroll, new Rect(0f, 0f, num3, Mathf.Max(((Rect)(ref val)).height, (float)_videoQueue.Count * num2))); if (_videoQueue.Count == 0) { GUI.Label(new Rect(8f, 30f, num3 - 16f, 65f), "The queue is empty.\nAdd a link or choose a saved video from Playlists.", _libraryMetaStyle); } for (int i = 0; i < _videoQueue.Count; i++) { QueueEntry queueEntry = _videoQueue[i]; float num4 = (float)i * num2; GUI.Box(new Rect(0f, num4, num3, 82f), GUIContent.none, _libraryCardStyle); GUI.Label(new Rect(8f, num4 + 29f, 20f, 23f), (i + 1).ToString(), _hintStyle); DrawVideoThumbnail(new Rect(34f, num4 + 10f, 100f, 56f), queueEntry.VideoId); string text = ((!string.IsNullOrWhiteSpace(queueEntry.Title) && queueEntry.Title != queueEntry.VideoId) ? queueEntry.Title : "Loading video title…"); float num5 = num3 - 149f - (float)(_host ? 92 : 10); GUI.Label(new Rect(147f, num4 + 10f, num5, 43f), new GUIContent(ShortTitle(text, 110), text), _libraryCardTitleStyle); string videoDurationText = GetVideoDurationText(queueEntry.VideoId); string text2 = (string.IsNullOrWhiteSpace(queueEntry.AddedBy) ? "Added by a viewer" : ("Added by " + queueEntry.AddedBy)); GUI.Label(new Rect(147f, num4 + 57f, num5, 20f), (videoDurationText == "--") ? text2 : (videoDurationText + " · " + text2), _libraryMetaStyle); if (_host) { bool enabled = GUI.enabled; GUI.enabled = enabled && IsBoardNetworkReady(_schoolBoard); if (GUI.Button(new Rect(num3 - 83f, num4 + 9f, 74f, 28f), "Play now", _controlButtonStyle)) { GUI.enabled = enabled; PlayQueuedVideo(i); break; } if (GUI.Button(new Rect(num3 - 83f, num4 + 44f, 74f, 28f), "Remove", _seekButtonStyle)) { GUI.enabled = enabled; RemoveQueuedVideo(i); break; } GUI.enabled = enabled; } } GUI.EndScrollView(); bool enabled2 = GUI.enabled; GUI.enabled = enabled2 && IsBoardNetworkReady(_schoolBoard); if (!string.IsNullOrEmpty(_videoId)) { if (GUI.Button(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 442f, 165f, 35f), _host ? "SKIP NOW" : (_localVotedSkip ? "REMOVE MY VOTE" : "VOTE TO SKIP"), _host ? _primaryButtonStyle : _controlButtonStyle)) { if (_host) { SkipCurrentVideo(); } else { ToggleSkipVote(); } } GUI.Label(new Rect(((Rect)(ref area)).x + 180f, ((Rect)(ref area)).y + 440f, ((Rect)(ref area)).width - 180f, 39f), _host ? "Host can skip any time" : (_voteCount + "/" + _votesRequired + " votes · " + _reportedModCount + " modded viewers"), _libraryRightStyle); } else if (_videoQueue.Count > 0 && GUI.Button(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 442f, 165f, 35f), "PLAY NEXT", _primaryButtonStyle)) { RequestQueueStart(); } GUI.enabled = enabled2; } private void DrawLibraryAccess(Rect area) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Expected O, but got Unknown //IL_0563: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, ((Rect)(ref area)).width - 42f, 30f), "Access", _libraryHeadingStyle); if (!_host) { GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 48f, ((Rect)(ref area)).width, 60f), "Queue access is managed by the lobby host.\nEveryone can add videos unless the host blocks them.", _libraryMetaStyle); GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 116f, ((Rect)(ref area)).width, 35f), "Queue limits · " + _queueLimit + " waiting videos per person, " + _queueCooldown + " seconds between additions", _libraryMetaStyle); return; } GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 39f, ((Rect)(ref area)).width, 28f), "Manage who can add videos to this lobby.", _libraryMetaStyle); bool flag = false; GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 81f, 242f, 30f), "Waiting videos per person", _libraryMetaStyle); if (GUI.Button(new Rect(((Rect)(ref area)).x + 340f, ((Rect)(ref area)).y + 80f, 31f, 31f), "−", _controlButtonStyle)) { _configuredQueueLimit.Value = Math.Max(1, _configuredQueueLimit.Value - 1); flag = true; } GUI.Label(new Rect(((Rect)(ref area)).x + 378f, ((Rect)(ref area)).y + 82f, 80f, 26f), _configuredQueueLimit.Value.ToString(), _hintStyle); if (GUI.Button(new Rect(((Rect)(ref area)).x + 470f, ((Rect)(ref area)).y + 80f, 31f, 31f), "+", _controlButtonStyle)) { _configuredQueueLimit.Value = Math.Min(30, _configuredQueueLimit.Value + 1); flag = true; } GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 123f, 260f, 30f), "Seconds between additions", _libraryMetaStyle); if (GUI.Button(new Rect(((Rect)(ref area)).x + 340f, ((Rect)(ref area)).y + 122f, 31f, 31f), "−", _controlButtonStyle)) { _configuredQueueCooldown.Value = Math.Max(0, _configuredQueueCooldown.Value - 5); flag = true; } GUI.Label(new Rect(((Rect)(ref area)).x + 378f, ((Rect)(ref area)).y + 124f, 80f, 26f), _configuredQueueCooldown.Value + " sec", _hintStyle); if (GUI.Button(new Rect(((Rect)(ref area)).x + 470f, ((Rect)(ref area)).y + 122f, 31f, 31f), "+", _controlButtonStyle)) { _configuredQueueCooldown.Value = Math.Min(300, _configuredQueueCooldown.Value + 5); flag = true; } if (flag) { _queueLimit = _configuredQueueLimit.Value; _queueCooldown = _configuredQueueCooldown.Value; ((BaseUnityPlugin)this).Config.Save(); BroadcastQueueSnapshot(); } GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y + 174f, ((Rect)(ref area)).width, 20f), "MODDED VIEWERS", _sectionStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref area)).x, ((Rect)(ref area)).y + 205f, ((Rect)(ref area)).width, 278f); float num = ((Rect)(ref val)).width - 18f; List<string> list = new List<string>(_moddedPlayers.Keys); list.Sort(StringComparer.Ordinal); _accessScroll = GUI.BeginScrollView(val, _accessScroll, new Rect(0f, 0f, num, Mathf.Max(((Rect)(ref val)).height, (float)list.Count * 51f))); for (int i = 0; i < list.Count; i++) { string text = list[i]; LobbyMember lobbyMember = _moddedPlayers[text]; float num2 = (float)i * 51f; GUI.Box(new Rect(0f, num2, num, 43f), GUIContent.none, _libraryCardStyle); GUI.Label(new Rect(12f, num2 + 8f, num - 155f, 28f), new GUIContent(lobbyMember.Name + ((text == "__local_host__") ? " (you)" : ""), lobbyMember.Name), _statusStyle); if (text == "__local_host__") { continue; } bool flag2 = _blockedQueuePlayers.Contains(text); if (GUI.Button(new Rect(num - 130f, num2 + 6f, 119f, 31f), flag2 ? "Allow videos" : "Block videos", flag2 ? _primaryButtonStyle : _controlButtonStyle)) { if (flag2) { _blockedQueuePlayers.Remove(text); } else { _blockedQueuePlayers.Add(text); } } } GUI.EndScrollView(); } private void DrawLibraryPlayerFooter() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(0f, 534f, 740f, 1f), (Texture)(object)_badgeTexture); GUI.DrawTexture(new Rect(1f, 535f, 738f, 84f), (Texture)(object)_buttonTexture); DrawVideoThumbnail(new Rect(18f, 554f, 75f, 44f), _videoId); GUI.Label(new Rect(105f, 547f, 275f, 16f), string.IsNullOrEmpty(_videoId) ? "SCHOOL SCREEN" : "NOW PLAYING", _sectionStyle); string text = (string.IsNullOrEmpty(_videoId) ? "Ready to watch together" : (string.IsNullOrWhiteSpace(_videoTitle) ? "Loading video title…" : _videoTitle)); GUI.Label(new Rect(105f, 569f, 274f, 38f), new GUIContent(ShortTitle(text, 80), text), _libraryCardTitleStyle); bool enabled = GUI.enabled; GUI.enabled = enabled && IsBoardNetworkReady(_schoolBoard) && !string.IsNullOrEmpty(_videoId); if (GUI.Button(new Rect(390f, 561f, 61f, 33f), (_playerState == 2) ? "Play" : "Pause", _controlButtonStyle)) { Control((_playerState == 2) ? "PLAY" : "PAUSE"); } GUI.enabled = enabled; GUI.Label(new Rect(467f, 547f, 95f, 20f), "Volume", _libraryMetaStyle); GUI.Label(new Rect(569f, 547f, 61f, 20f), Mathf.RoundToInt(_maximumVolume) + "%", _libraryRightStyle); float num = GUI.HorizontalSlider(new Rect(467f, 577f, 163f, 18f), _maximumVolume, 0f, 200f, _volumeSliderStyle, _volumeThumbStyle); if (Mathf.Abs(num - _maximumVolume) > 0.1f) { _maximumVolume = num; UpdateLocalVolume(force: true); } GUI.Label(new Rect(466f, 594f, 35f, 17f), "0%", _libraryMetaStyle); GUI.Label(new Rect(594f, 594f, 36f, 17f), "200%", _libraryRightStyle); if (GUI.Button(new Rect(641f, 561f, 79f, 33f), _muted ? "Unmute" : "Mute", _controlButtonStyle)) { _muted = !_muted; UpdateLocalVolume(force: true); } } private void DrawLibraryTooltip() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(GUI.tooltip)) { Vector2 mousePosition = Event.current.mousePosition; float num = Mathf.Min(380f, 710f); float num2 = Mathf.Clamp(_libraryMetaStyle.CalcHeight(new GUIContent(GUI.tooltip), num - 22f) + 18f, 39f, 92f); float num3 = Mathf.Clamp(mousePosition.x + 15f, 8f, 740f - num - 8f); float num4 = Mathf.Clamp(mousePosition.y + 19f, 8f, 620f - num2 - 8f); GUI.Box(new Rect(num3, num4, num, num2), GUIContent.none, _libraryCardStyle); GUI.Label(new Rect(num3 + 11f, num4 + 8f, num - 22f, num2 - 16f), GUI.tooltip, _libraryMetaStyle); } } private static string FormatLibraryTime(float seconds) { int num = Mathf.Max(0, Mathf.FloorToInt(seconds)); if (num < 3600) { return num / 60 + ":" + (num % 60).ToString("00"); } return num / 3600 + ":" + (num / 60 % 60).ToString("00") + ":" + (num % 60).ToString("00"); } private void DisposeLibraryGuiTextures() { for (int i = 0; i < _libraryUiTextures.Count; i++) { DestroyGuiTexture(_libraryUiTextures[i]); } _libraryUiTextures.Clear(); } private void InitializeSavedPlaylists() { try { _savedPlaylistStore = new SavedPlaylistStore(Paths.ConfigPath); ReloadSavedPlaylists(""); } catch (Exception ex) { ReportSavedPlaylistError("Saved playlists could not be opened. Your existing file is unchanged.", ex.Message); } } private void DrawLibraryPlaylists(Rect area) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) EnsureSavedPlaylistGuiStyles(); RefreshSavedPlaylistCachedTitles(); GUI.BeginGroup(area); try { float width = ((Rect)(ref area)).width; GUI.Label(new Rect(0f, 0f, width - 126f, 28f), "Your playlists", _libraryHeadingStyle ?? _titleStyle); SavedPlaylist savedPlaylist = FindSavedPlaylist(_selectedSavedPlaylistName); string text = ((savedPlaylist == null) ? (_savedPlaylists.Count + " / " + 20 + " playlists") : (savedPlaylist.Entries.Count + " / " + 30 + " videos")); GUI.Label(new Rect(0f, 31f, width, 18f), "Saved privately on this computer · " + text, _savedPlaylistHintStyle); if (GUI.Button(new Rect(width - 110f, 1f, 110f, 29f), "RELOAD", _seekButtonStyle) && ReloadSavedPlaylists(_selectedSavedPlaylistName)) { SetSavedPlaylistMessage("Library refreshed."); } if (_savedPlaylistNamePrompt != 0) { DrawSavedPlaylistNamePrompt(width, ((Rect)(ref area)).height); return; } if (_savedPlaylistDeletePrompt != null) { DrawSavedPlaylistDeletePrompt(width, ((Rect)(ref area)).height); return; } if (_savedPlaylistOverwriteEntries != null) { DrawSavedPlaylistOverwritePrompt(width, ((Rect)(ref area)).height); return; } SavedPlaylist savedPlaylist2 = FindSavedPlaylist(_selectedSavedPlaylistName); if (savedPlaylist2 == null) { DrawSavedPlaylistCollections(width, ((Rect)(ref area)).height); } else { DrawSavedPlaylistTracks(savedPlaylist2, width, ((Rect)(ref area)).height); } DrawSavedPlaylistFooter(width, ((Rect)(ref area)).height); } finally { GUI.EndGroup(); } } private void EnsureSavedPlaylistGuiStyles() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown if (_savedPlaylistCardTitleStyle == null) { _savedPlaylistCardTitleStyle = new GUIStyle(_statusStyle) { fontSize = 13, fontStyle = (FontStyle)1, wordWrap = false, clipping = (TextClipping)1 }; _savedPlaylistTrackTitleStyle = new GUIStyle(_statusStyle) { wordWrap = true, clipping = (TextClipping)1, alignment = (TextAnchor)0 }; _savedPlaylistHintStyle = new GUIStyle(_hintStyle) { alignment = (TextAnchor)3 }; _savedPlaylistMessageStyle = new GUIStyle(_hintStyle) { alignment = (TextAnchor)3, wordWrap = true, clipping = (TextClipping)1 }; } } private void DrawSavedPlaylistCollections(float width, float height) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) bool enabled = GUI.enabled; GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null; if (GUI.Button(new Rect(0f, 61f, (width - 8f) / 2f, 34f), "NEW PLAYLIST", _primaryButtonStyle)) { _savedPlaylistNamePrompt = 1; _savedPlaylistNameDraft = ""; ClearSavedPlaylistMessage(); } GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null && _videoQueue.Count > 0; if (GUI.Button(new Rect((width + 8f) / 2f, 61f, (width - 8f) / 2f, 34f), "SAVE QUEUE", _controlButtonStyle)) { BeginSaveQueuePlaylistPrompt(); } GUI.enabled = enabled; if (_savedPlaylists.Count == 0) { GUI.DrawTexture(new Rect(0f, 110f, width, Math.Max(130f, height - 166f)), (Texture)(object)_fieldTexture); GUI.Label(new Rect(20f, 145f, width - 40f, 30f), "Build your study collection", _titleStyle); GUI.Label(new Rect(20f, 186f, width - 40f, 56f), _savedPlaylistStoreReady ? "Create a playlist and add YouTube videos, or save the lobby's current queue." : "Your saved playlists could not be loaded. Reload after checking the BepInEx log.", _savedPlaylistMessageStyle); return; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 107f, width, Math.Max(90f, height - 154f)); int num = ((width >= 510f) ? 3 : 2); float num2 = (((Rect)(ref val)).width - 18f - 8f * (float)(num - 1)) / (float)num; int num3 = (_savedPlaylists.Count + num - 1) / num; _savedCollectionsScroll = GUI.BeginScrollView(val, _savedCollectionsScroll, new Rect(0f, 0f, width - 18f, Math.Max(((Rect)(ref val)).height, (float)num3 * 155f))); Rect val2 = default(Rect); Rect val3 = default(Rect); for (int i = 0; i < _savedPlaylists.Count; i++) { SavedPlaylist savedPlaylist = _savedPlaylists[i]; ((Rect)(ref val2))..ctor((float)(i % num) * (num2 + 8f), (float)(i / num) * 155f, num2, 145f); bool num4 = GUI.Button(val2, GUIContent.none, _controlButtonStyle); ((Rect)(ref val3))..ctor(((Rect)(ref val2)).x + 8f, ((Rect)(ref val2)).y + 8f, ((Rect)(ref val2)).width - 16f, 91f); if (savedPlaylist.Entries.Count > 0) { DrawVideoThumbnail(val3, savedPlaylist.Entries[0].VideoId); RequestQueueTitle(savedPlaylist.Entries[0].VideoId); } else { GUI.DrawTexture(val3, (Texture)(object)_fieldTexture); GUI.Label(new Rect(((Rect)(ref val3)).x + 12f, ((Rect)(ref val3)).y + 27f, ((Rect)(ref val3)).width - 24f, 32f), "A fresh collection", _savedPlaylistHintStyle); } GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 105f, ((Rect)(ref val2)).width - 20f, 22f), new GUIContent(ShortTitle(savedPlaylist.Name, Math.Max(12, Mathf.FloorToInt((((Rect)(ref val2)).width - 20f) / 7f))), savedPlaylist.Name), _savedPlaylistCardTitleStyle); GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 126f, ((Rect)(ref val2)).width - 20f, 15f), savedPlaylist.Entries.Count + ((savedPlaylist.Entries.Count == 1) ? " video" : " videos"), _savedPlaylistHintStyle); if (num4) { SelectSavedPlaylist(savedPlaylist.Name); } } GUI.EndScrollView(); } private void DrawSavedPlaylistTracks(SavedPlaylist playlist, float width, float height) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Expected O, but got Unknown //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Expected O, but got Unknown bool enabled = GUI.enabled; if (GUI.Button(new Rect(0f, 60f, 61f, 30f), "BACK", _seekButtonStyle)) { _selectedSavedPlaylistName = ""; _selectedSavedTracks.Clear(); return; } GUI.Label(new Rect(71f, 59f, width - 159f, 31f), new GUIContent(playlist.Name, playlist.Name), _savedPlaylistCardTitleStyle); GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null; if (GUI.Button(new Rect(width - 80f, 60f, 80f, 30f), "DELETE", _seekButtonStyle)) { _savedPlaylistDeletePrompt = playlist; ClearSavedPlaylistMessage(); } GUI.enabled = enabled && _selectedSavedTracks.Count > 0 && _pendingQueueSequence == 0 && IsBoardNetworkReady(_schoolBoard); if (GUI.Button(new Rect(0f, 100f, width - 174f, 34f), (_pendingQueueSequence != 0) ? "ADDING…" : ("QUEUE SELECTED (" + _selectedSavedTracks.Count + ")"), _primaryButtonStyle)) { List<int> list = new List<int>(); for (int i = 0; i < playlist.Entries.Count; i++) { if (_selectedSavedTracks.Contains(i)) { list.Add(i); } } QueueSavedPlaylistIndexes(playlist, list); } GUI.enabled = enabled; if (GUI.Button(new Rect(width - 166f, 100f, 91f, 34f), "SELECT ALL", _seekButtonStyle)) { SelectAllSavedTracks(playlist); } if (GUI.Button(new Rect(width - 67f, 100f, 67f, 34f), "CLEAR", _seekButtonStyle)) { _selectedSavedTracks.Clear(); } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 145f, width - 102f, 33f); GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null; _savedPlaylistLink = GUI.TextField(val, _savedPlaylistLink, 2048, _inputStyle); if (string.IsNullOrEmpty(_savedPlaylistLink)) { GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 7f, ((Rect)(ref val)).width - 20f, 20f), "Paste a YouTube link to save here", _placeholderStyle); } GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null && playlist.Entries.Count < 30; if (GUI.Button(new Rect(width - 94f, 145f, 94f, 33f), "SAVE VIDEO", _controlButtonStyle)) { AddLinkToSavedPlaylist(playlist); } GUI.enabled = enabled; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 188f, width, Math.Max(80f, height - 234f)); float num = ((Rect)(ref val2)).width - 18f; _savedTracksScroll = GUI.BeginScrollView(val2, _savedTracksScroll, new Rect(0f, 0f, num, Math.Max(((Rect)(ref val2)).height, (float)playlist.Entries.Count * 65f))); if (playlist.Entries.Count == 0) { GUI.Label(new Rect(12f, 15f, num - 24f, 52f), "This playlist is empty. Paste a video link above to get started.", _savedPlaylistMessageStyle); } for (int j = 0; j < playlist.Entries.Count; j++) { SavedPlaylistEntry savedPlaylistEntry = playlist.Entries[j]; float num2 = (float)j * 65f; GUI.DrawTexture(new Rect(0f, num2, num, 60f), (Texture)(object)_fieldTexture); if (GUI.Button(new Rect(4f, num2 + 19f, 23f, 23f), _selectedSavedTracks.Contains(j) ? "✓" : "", _seekButtonStyle) && !_selectedSavedTracks.Add(j)) { _selectedSavedTracks.Remove(j); } DrawVideoThumbnail(new Rect(34f, num2 + 7f, 80f, 45f), savedPlaylistEntry.VideoId); string savedVideoTitle = GetSavedVideoTitle(savedPlaylistEntry); GUI.Label(new Rect(123f, num2 + 10f, Math.Max(70f, num - 243f), 40f), new GUIContent(savedVideoTitle, savedVideoTitle), _savedPlaylistTrackTitleStyle); GUI.enabled = enabled && _pendingQueueSequence == 0 && IsBoardNetworkReady(_schoolBoard); if (GUI.Button(new Rect(num - 112f, num2 + 15f, 71f, 30f), "QUEUE", _controlButtonStyle)) { QueueSavedPlaylistIndexes(playlist, new int[1] { j }); } GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null; if (GUI.Button(new Rect(num - 33f, num2 + 15f, 29f, 30f), new GUIContent("×", "Remove from this playlist"), _seekButtonStyle)) { RemoveSavedPlaylistTrack(playlist, j); break; } GUI.enabled = enabled; } GUI.EndScrollView(); GUI.enabled = enabled; } private void DrawSavedPlaylistFooter(float width, float height) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) string text = (_savedPlaylistShowQueueStatus ? _queueStatus : _savedPlaylistMessage); float num = ((_savedPlaylistUndo == null) ? width : (width - 82f)); GUI.Label(new Rect(0f, height - 39f, num, 37f), new GUIContent(text ?? "", _savedPlaylistErrorDetail), _savedPlaylistMessageStyle); if (_savedPlaylistUndo != null) { bool enabled = GUI.enabled; GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null; if (GUI.Button(new Rect(width - 74f, height - 36f, 74f, 30f), "UNDO", _seekButtonStyle)) { UndoSavedPlaylistChange(); } GUI.enabled = enabled; } } private void DrawSaveQueueShortcut(Rect buttonRect) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) bool enabled = GUI.enabled; GUI.enabled = enabled && _savedPlaylistStoreReady && _submittedSavedPlaylistTracks == null && _videoQueue.Count > 0; if (GUI.Button(buttonRect, "SAVE QUEUE", _seekButtonStyle)) { BeginSaveQueuePlaylistPrompt(); } GUI.enabled = enabled; } private void BeginSaveQueuePlaylistPrompt() { if (_videoQueue.Count == 0) { SetSavedPlaylistMessage("Add videos to the queue before saving it."); return; } _savedPlaylistQueueDraft = new List<SavedPlaylistEntry>(); for (int i = 0; i < _videoQueue.Count && i < 30; i++) { QueueEntry queueEntry = _videoQueue[i]; _savedPlaylistQueueDraft.Add(new SavedPlaylistEntry(queueEntry.VideoId, GetCachedSavedTitle(queueEntry.VideoId, queueEntry.Title))); } _savedPlaylistNameDraft = ""; _savedPlaylistNamePrompt = 2; ClearSavedPlaylistMessage(); _activeTab = 2; } private void DrawSavedPlaylistNamePrompt(float width, float height) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) bool flag = _savedPlaylistNamePrompt == 2; GUI.DrawTexture(new Rect(0f, 70f, width, 246f), (Texture)(object)_fieldTexture); GUI.DrawTexture(new Rect(0f, 70f, width, 2f), (Texture)(object)_accentTexture); GUI.Label(new Rect(18f, 84f, width - 36f, 30f), flag ? "Save your queue" : "Create a playlist", _titleStyle); GUI.Label(new Rect(18f, 119f, width - 36f, 35f), flag ? (((_savedPlaylistQueueDraft != null) ? _savedPlaylistQueueDraft.Count : 0) + " queued videos will be saved in order.") : "Start a collection, then add the videos you want to keep.", _savedPlaylistMessageStyle); GUI.Label(new Rect(18f, 159f, width - 36f, 18f), "PLAYLIST NAME", _sectionStyle); _savedPlaylistNameDraft = GUI.TextField(new Rect(18f, 184f, width - 36f, 36f), _savedPlaylistNameDraft, 48, _inputStyle); bool enabled = GUI.enabled; GUI.enabled = enabled && _savedPlaylistStoreReady; if (GUI.Button(new Rect(18f, 239f, (width - 44f) / 2f, 35f), flag ? "SAVE PLAYLIST" : "CREATE", _primaryButtonStyle)) { CommitSavedPlaylistNamePrompt(); } GUI.enabled = enabled; if (GUI.Button(new Rect((width + 8f) / 2f, 239f, (width - 44f) / 2f, 35f), "CANCEL", _controlButtonStyle)) { _savedPlaylistNamePrompt = 0; _savedPlaylistQueueDraft = null; ClearSavedPlaylistMessage(); } DrawSavedPlaylistFooter(width, height); } private void CommitSavedPlaylistNamePrompt() { string text = (_savedPlaylistNameDraft ?? "").Trim(); if (text.Length == 0) { SetSavedPlaylistMessage("Give your playlist a name first."); return; } SavedPlaylist savedPlaylist = FindSavedPlaylist(text); if (_savedPlaylistNamePrompt == 1) { if (savedPlaylist != null) { SetSavedPlaylistMessage("That name is already in your library. Choose a different name."); return; } if (!SaveLocalPlaylist(text, new List<SavedPlaylistEntry>(), "Playlist created. Paste a video link to add your first track.")) { return; } } else { if (_savedPlaylistQueueDraft == null || _savedPlaylistQueueDraft.Count == 0) { SetSavedPlaylistMessage("This queue has no videos to save."); return; } if (savedPlaylist != null) { _savedPlaylistOverwriteName = text; _savedPlaylistOverwriteEntries = _savedPlaylistQueueDraft; _savedPlaylistNamePrompt = 0; ClearSavedPlaylistMessage(); return; } if (!SaveLocalPlaylist(text, _savedPlaylistQueueDraft, "Queue saved as a playlist.")) { return; } } _savedPlaylistNamePrompt = 0; _savedPlaylistQueueDraft = null; } private void DrawSavedPlaylistDeletePrompt(float width, float height) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(0f, 78f, width, 227f), (Texture)(object)_fieldTexture); GUI.Label(new Rect(18f, 94f, width - 36f, 32f), "Delete this playlist?", _titleStyle); GUI.Label(new Rect(18f, 139f, width - 36f, 60f), "“" + _savedPlaylistDeletePrompt.Name + "” will be removed from your library. You can undo this after deleting.", _savedPlaylistMessageStyle); if (GUI.Button(new Rect(18f, 232f, (width - 44f) / 2f, 35f), "DELETE PLAYLIST", _primaryButtonStyle)) { SavedPlaylist savedPlaylistDeletePrompt = _savedPlaylistDeletePrompt; if (_savedPlaylistStore.TryDelete(savedPlaylistDeletePrompt.Name, out var error)) { _savedPlaylistDeletePrompt = null; _savedPlaylistUndo = savedPlaylistDeletePrompt; if (ReloadSavedPlaylists("")) { SetSavedPlaylistMessage("Playlist deleted. Use Undo to restore it."); } } else { ReportSavedPlaylistError("The playlist could not be deleted. Your library is unchanged.", error); } } if (GUI.Button(new Rect((width + 8f) / 2f, 232f, (width - 44f) / 2f, 35f), "CANCEL", _controlButtonStyle)) { _savedPlaylistDeletePrompt = null; ClearSavedPlaylistMessage(); } DrawSavedPlaylistFooter(width, height); } private void DrawSavedPlaylistOverwritePrompt(float width, float height) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(0f, 78f, width, 227f), (Texture)(object)_fieldTexture); GUI.Label(new Rect(18f, 94f, width - 36f, 32f), "Replace this playlist?", _titleStyle); GUI.Label(new Rect(18f, 139f, width - 36f, 60f), "“" + _savedPlaylistOverwriteName + "” already exists. Replace its videos with this saved queue?", _savedPlaylistMessageStyle); if (GUI.Button(new Rect(18f, 232f, (width - 44f) / 2f, 35f), "REPLACE", _primaryButtonStyle)) { SavedPlaylist savedPlaylistUndo = FindSavedPlaylist(_savedPlaylistOverwriteName); if (SaveLocalPlaylist(_savedPlaylistOverwriteName, _savedPlaylistOverwriteEntries, "Playlist replaced. Use Undo to restore its previous videos.")) { _savedPlaylistUndo = savedPlaylistUndo; _savedPlaylistOverwriteEntries = null; _savedPlaylistOverwriteName = ""; _savedPlaylistQueueDraft = null; } } if (GUI.Button(new Rect((width + 8f) / 2f, 232f, (width - 44f) / 2f, 35f), "CANCEL", _controlButtonStyle)) { _savedPlaylistOverwriteEntries = null; _savedPlaylistOverwriteName = ""; _savedPlaylistQueueDraft = null; ClearSavedPlaylistMessage(); } DrawSavedPlaylistFooter(width, height); } private void AddLinkToSavedPlaylist(SavedPlaylist playlist) { string text = ParseVideoId(_savedPlaylistLink); if (string.IsNullOrEmpty(text)) { SetSavedPlaylistMessage("Paste a valid YouTube link or video ID."); return; } List<SavedPlaylistEntry> list = CopySavedPlaylistEntries(playlist); list.Add(new SavedPlaylistEntry(text, GetCachedSavedTitle(text, ""))); if (SaveLocalPlaylist(playlist.Name, list, "Video saved to your playlist.")) { _savedPlaylistLink = ""; RequestQueueTitle(text); } } private void RemoveSavedPlaylistTrack(SavedPlaylist playlist, int index) { List<SavedPlaylistEntry> list = CopySavedPlaylistEntries(playlist); if (index >= 0 && index < list.Count) { list.RemoveAt(index); if (SaveLocalPlaylist(playlist.Name, list, "Video removed. Use Undo to restore it.")) { _savedPlaylistUndo = playlist; } } } private bool SaveLocalPlaylist(string name, IEnumerable<SavedPlaylistEntry> entries, string successMessage) { if (_savedPlaylistStore == null) { return false; } if (!_savedPlaylistStore.TrySave(name, entries, out var error)) { SetSavedPlaylistMessage(error); _savedPlaylistErrorDetail = error; return false; } _savedPlaylistUndo = null; if (!ReloadSavedPlaylists(name)) { return false; } SetSavedPlaylistMessage(successMessage); return true; } private void UndoSavedPlaylistChange() { SavedPlaylist savedPlaylistUndo = _savedPlaylistUndo; if (savedPlaylistUndo != null && SaveLocalPlaylist(savedPlaylistUndo.Name, savedPlaylistUndo.Entries, "Playlist restored.")) { _savedPlaylistUndo = null; } } private bool ReloadSavedPlaylists(string selectedName) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (_savedPlaylistStore == null) { return false; } if (!_savedPlaylistStore.TryLoad(out var playlists, out var error)) { ReportSavedPlaylistError("Saved playlists could not be loaded. Your existing file is unchanged. See the BepInEx log.", error); return false; } _savedPlaylists.Clear(); for (int i = 0; i < playlists.Count; i++) { _savedPlaylists.Add(playlists[i]); } _savedPlaylistStoreReady = true; _savedPlaylistErrorDetail = ""; _selectedSavedPlaylistName = ""; _selectedSavedTracks.Clear(); if (FindSavedPlaylist(selectedName) != null) { SelectSavedPlaylist(selectedName); } else { _savedTracksScroll = Vector2.zero; } return true; } private SavedPlaylist FindSavedPlaylist(string name) { if (string.IsNullOrEmpty(name)) { return null; } for (int i = 0; i < _savedPlaylists.Count; i++) { if (string.Equals(_savedPlaylists[i].Name, name, StringComparison.OrdinalIgnoreCase)) { return _savedPlaylists[i]; } } return null; } private void SelectSavedPlaylist(string name) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) SavedPlaylist savedPlaylist = FindSavedPlaylist(name); if (savedPlaylist != null) { _selectedSavedPlaylistName = savedPlaylist.Name; _savedTracksScroll = Vector2.zero; _savedPlaylistLink = ""; SelectAllSavedTracks(savedPlaylist); for (int i = 0; i < savedPlaylist.Entries.Count; i++) { RequestQueueTitle(savedPlaylist.Entries[i].VideoId); } } } private void SelectAllSavedTracks(SavedPlaylist playlist) { _selectedSavedTracks.Clear(); for (int i = 0; i < playlist.Entries.Count && i < 30; i++) { _selectedSavedTracks.Add(i); } } private List<SavedPlaylistEntry> CopySavedPlaylistEntries(SavedPlaylist playlist) { List<SavedPlaylistEntry> list = new List<SavedPlaylistEntry>(); for (int i = 0; i < playlist.Entries.Count; i++) { SavedPlaylistEntry savedPlaylistEntry = playlist.Entries[i]; list.Add(new SavedPlaylistEntry(savedPlaylistEntry.VideoId, GetCachedSavedTitle(savedPlaylistEntry.VideoId, savedPlaylistEntry.Title))); } return list; } private string GetSavedVideoTitle(SavedPlaylistEntry entry) { string cachedSavedTitle = GetCachedSavedTitle(entry.VideoId, entry.Title); if (!string.IsNullOrWhiteSpace(cachedSavedTitle) && !string.Equals(cachedSavedTitle, entry.VideoId, StringComparison.Ordinal)) { return cachedSavedTitle; } RequestQueueTitle(entry.VideoId); if (!_pipeConnected) { return "YouTube video"; } return "Loading video title…"; } private void RefreshSavedPlaylistCachedTitles() { if (!_savedPlaylistStoreReady || _savedPlaylistStore == null || Time.unscaledTime < _nextSavedPlaylistTitleRefresh) { return; } _nextSavedPlaylistTitleRefresh = Time.unscaledTime + 5f; for (int i = 0; i < _savedPlaylists.Count; i++) { SavedPlaylist savedPlaylist = _savedPlaylists[i]; bool flag = false; List<SavedPlaylistEntry> list = new List<SavedPlaylistEntry>(); for (int j = 0; j < savedPlaylist.Entries.Count; j++) { SavedPlaylistEntry savedPlaylistEntry = savedPlaylist.Entries[j]; string cachedSavedTitle = GetCachedSavedTitle(savedPlaylistEntry.VideoId, savedPlaylistEntry.Title); flag |= !string.Equals(cachedSavedTitle, savedPlaylistEntry.Title, StringComparison.Ordinal); list.Add(new SavedPlaylistEntry(savedPlaylistEntry.VideoId, cachedSavedTitle)); } if (flag) { if (!_savedPlaylistStore.TrySave(savedPlaylist.Name, list, out var error)) { ReportSavedPlaylistError("Saved video titles could not be updated. Your existing playlists were kept.", error); break; } _savedPlaylists[i] = new SavedPlaylist(savedPlaylist.Name, list); } } } private string GetCachedSavedTitle(string videoId, string fallback) { string value; string text = ((_queueTitleCache.TryGetValue(videoId, out value) && !string.IsNullOrWhiteSpace(value) && !string.Equals(value, videoId, StringComparison.Ordinal)) ? value : (fallback ?? "")); if (text.Length <= 512) { return text; } int num = 512; if (char.IsHighSurrogate(text[num - 1])) { num--; } return text.Substring(0, num); } private void QueueSavedPlaylistIndexes(SavedPlaylist playlist, IEnumerable<int> indexes) { List<string> list = new List<string>(); List<SavedPlaylistSubmittedTrack> list2 = new List<SavedPlaylistSubmittedTrack>(); foreach (int index in indexes) { if (index >= 0 && index < playlist.Entries.Count && list2.Count < 30) { string videoId = playlist.Entries[index].VideoId; list.Add(videoId); list2.Add(new SavedPlaylistSubmittedTrack { Index = index, VideoId = videoId }); } } _submittedSavedPlaylistName = playlist.Name; _submittedSavedPlaylistTracks = list2; if (!QueueSavedVideos(list)) { OnPlaylistQueueAdmission(0); } _savedPlaylistShowQueueStatus = true; _savedPlaylistErrorDetail = ""; } private void OnPlaylistQueueAdmission(int acceptedCount) { List<SavedPlaylistSubmittedTrack> submittedSavedPlaylistTracks = _submittedSavedPlaylistTracks; string submittedSavedPlaylistName = _submittedSavedPlaylistName; _submittedSavedPlaylistTracks = null; _submittedSavedPlaylistName = ""; if (submittedSavedPlaylistTracks == null || acceptedCount <= 0 || !string.Equals(submittedSavedPlaylistName, _selectedSavedPlaylistName, StringComparison.OrdinalIgnoreCase)) { return; } SavedPlaylist savedPlaylist = FindSavedPlaylist(submittedSavedPlaylistName); if (savedPlaylist == null) { return; } for (int i = 0; i < acceptedCount && i < submittedSavedPlaylistTracks.Count; i++) { SavedPlaylistSubmittedTrack savedPlaylistSubmittedTrack = submittedSavedPlaylistTracks[i]; if (savedPlaylistSubmittedTrack.Index < savedPlaylist.Entries.Count && string.Equals(savedPlaylist.Entries[savedPlaylistSubmittedTrack.Index].VideoId, savedPlaylistSubmittedTrack.VideoId, StringComparison.Ordinal)) { _selectedSavedTracks.Remove(savedPlaylistSubmittedTrack.Index); } } } private void SetSavedPlaylistMessage(string message) { _savedPlaylistMessage = message ?? ""; _savedPlaylistShowQueueStatus = false; _savedPlaylistErrorDetail = ""; } private void ClearSavedPlaylistMessage() { SetSavedPlaylistMessage(""); } private void ReportSavedPlaylistError(string message, string detail) { _savedPlaylistStoreReady = false; SetSavedPlaylistMessage(message); _savedPlaylistErrorDetail = detail ?? ""; ((BaseUnityPlugin)this).Logger.LogWarning((object)(detail ?? message)); } private void Awake() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown _instance = this; _localPeerToken = CreatePeerToken(); _queueAuthorityReadyAt = Time.unscaledTime + 1.5f; _queueAuthoritySince = Time.unscaledTime; _queueAuthorityObservedAt = Time.unscaledTime; _configuredQueueLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Queue", "MaxPendingPerPlayer", 3, new ConfigDescription("Maximum pending videos per player when you host the lobby. The playing video does not count.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 30), Array.Empty<object>())); _configuredQueueCooldown = ((BaseUnityPlugin)this).Config.Bind<int>("Queue", "AddCooldownSeconds", 10, new ConfigDescription("Seconds between accepted queue additions per player when you host the lobby.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>())); InitializeSavedPlaylists(); _harmony = new Harmony("codex.ontogether.school-screen"); bool num = TryPatch(AccessTools.Method(typeof(QuadPainterGPU), "LateUpdate", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(SchoolScreenPlugin), "AfterBoardUpdate", (Type[])null)); bool flag = TryPatch(AccessTools.Method(typeof(QuadPainterGPU), "FillTheBlanksRPC_Original_2", (Type[])null, (Type[])null), new HarmonyMethod(typeof(SchoolScreenPlugin), "ReceiveBoardCommand", (Type[])null)); if (num && flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Installed school screen board handlers."); } _videoTexture = new Texture2D(2, 2, (TextureFormat)4, false, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; _status = "Find the whiteboard in the school building."; ((BaseUnityPlugin)this).Logger.LogInfo((object)"On-Together School Screen loaded."); } private bool TryPatch(MethodBase original, HarmonyMethod prefix = null, HarmonyMethod postfix = null) { if (original == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find a game method required by the school screen mod; skipping that patch."); return false; } try { _harmony.Patch(original, prefix, postfix, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); return true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Skipped incompatible patch for " + original.DeclaringType.FullName + "." + original.Name + ": " + ex.GetBaseException().Message)); return false; } } private void Update() { if (Input.GetKeyDown((KeyCode)290)) { _panelOpen = !_panelOpen; } PumpVideoMetadata(); UpdateHostState(); if (_lobbyStateObserved && !_observedLobbyActive) { return; } FindSchoolBoard(); PumpQueues(); UpdateLobbyPresence(); UpdateQueueCoordination(); UpdatePendingQueueRequest(); UpdateQueuePlayback(); if (Time.unscaledTime >= _nextVolumeUpdate) { _nextVolumeUpdate = Time.unscaledTime + 0.25f; UpdateLocalVolume(force: false); } if (_pendingJpeg != null && Time.unscaledTime - _lastFrameTime >= 1f / 30f) { byte[] array = Interlocked.Exchange(ref _pendingJpeg, null); if (array != null && ImageConversion.LoadImage(_videoTexture, array, false)) { _lastFrameTime = Time.unscaledTime; ApplyTexture(); } } if (IsBoardNetworkReady(_schoolBoard) && !string.IsNullOrEmpty(_videoId) && IsLocalPlaybackCoordinator() && Time.unscaledTime >= _nextSync) { _nextSync = Time.unscaledTime + 10f; SendBoardCommand("SYNC", _videoId, _videoTime, _playerState); } } private void FindSchoolBoard() { if (IsBoardNetworkReady(_schoolBoard) && (Object)(object)_schoolRenderer != (Object)null && (Object)(object)((Component)_schoolRenderer).gameObject != (Object)null) { return; } _schoolBoard = null; _schoolRenderer = null; _schoolMaterial = null; if (Time.unscaledTime < _nextBoardSearch) { return; } _nextBoardSearch = Time.unscaledTime + 0.5f; QuadPainterGPU[] array = Resources.FindObjectsOfTypeAll<QuadPainterGPU>(); foreach (QuadPainterGPU val in array) { if (!IsBoardNetworkReady(val) || !string.Equals(((Object)((Component)val).gameObject).name, "DrawingBoard", StringComparison.Ordinal)) { continue; } Transform val2 = ((Component)val).transform; bool flag = false; while ((Object)(object)val2 != (Object)null) { if (((Object)val2).name == "MD_SchoolInterior") { flag = true; break; } val2 = val2.parent; } if (flag) { Renderer component = ((Component)val).GetComponent<Renderer>(); if (!((Object)(object)component == (Object)null)) { _schoolBoard = val; _schoolRenderer = component; _schoolMaterial = _schoolRenderer.material; _status = "School whiteboard found. Press F9 to open controls."; StartBrowser(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Attached to the network-spawned DrawingBoard inside MD_SchoolInterior."); break; } } } } private static bool IsBoardNetworkReady(QuadPainterGPU board) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)board != (Object)null) { Scene scene = ((Component)board).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Component)board).gameObject.activeInHierarchy && ((NetworkIdentity)board).isSpawned && ((NetworkIdentity)board).id.HasValue && (Object)(object)((NetworkIdentity)board).networkManager != (Object)null && board.PaintColors != null) { return board.PaintColors.Length != 0; } } return false; } private void StartBrowser() { if (_browser != null || _pipe != null) { return; } string directoryName = Path.GetDirectoryName(typeof(SchoolScreenPlugin).Assembly.Location); string text = Path.Combine(directoryName, "SchoolScreenBrowser.exe"); if (!File.Exists(text)) { _status = "Browser helper is missing beside the plugin."; return; } _pipeName = "OTSchoolScreen_" + Guid.NewGuid().ToString("N"); _pipe = new NamedPipeServerStream(_pipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 65536, 65536); Task.Run(delegate { PipeWorker(_pipe); }); try { _browser = Process.Start(new ProcessStartInfo(text, _pipeName) { UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = directoryName }); _status = "Starting local browser…"; } catch (Exception ex) { _status = "Could not start browser: " + ex.Message; } } private void PipeWorker(NamedPipeServerStream pipe) { try { pipe.WaitForConnection(); _pipeConnected = true; _browserQueue.Enqueue("STATUS|WebView2 connected"); using BinaryReader binaryReader = new BinaryReader(pipe, Encoding.UTF8, leaveOpen: true); while (pipe.IsConnected) { byte b = binaryReader.ReadByte(); int num = binaryReader.ReadInt32(); if (num >= 0 && num <= 4194304) { byte[] array = binaryReader.ReadBytes(num); if (array.Length == num) { switch (b) { case 70: Interlocked.Exchange(ref _pendingJpeg, array); break; case 83: _browserQueue.Enqueue(Encoding.UTF8.GetString(array)); break; case 69: _browserQueue.Enqueue("ERROR|" + Encoding.UTF8.GetString(array)); break; } continue; } break; } break; } } catch (Exception ex) { _browserQueue.Enqueue("ERROR|" + ex.GetBaseException().Message); } finally { _pipeConnected = false; } } private void PumpQueues() { string result; while (_networkQueue.TryDequeue(out result)) { HandleNetworkCommand(result); } while (_browserQueue.TryDequeue(out result)) { HandleBrowserMessage(result); } } private void HandleBrowserMessage(string message) { if (HandleVideoMetadataMessage(message)) { return
BepInEx/plugins/SchoolScreenBrowser.exe
Decompiled 2 months agousing System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Globalization; using System.IO; using System.IO.Pipes; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.CodeAnalysis; using Microsoft.Web.WebView2.Core; using Microsoft.Web.WebView2.WinForms; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SchoolScreenBrowser")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5811986efea5c7bd5c169e74cc042db1d889a6c3")] [assembly: AssemblyProduct("SchoolScreenBrowser")] [assembly: AssemblyTitle("SchoolScreenBrowser")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SchoolScreenBrowser { internal sealed class BrowserForm : Form { private readonly string _pipeName; private readonly WebView2 _webView; private NamedPipeClientStream _pipe; private BinaryWriter _writer; private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1); private readonly CancellationTokenSource _cancel = new CancellationTokenSource(); private readonly ConcurrentQueue<string> _pendingCommands = new ConcurrentQueue<string>(); private bool _webReady; private bool _capturing; protected override bool ShowWithoutActivation => true; protected override CreateParams CreateParams { get { CreateParams createParams = ((Form)this).CreateParams; createParams.ExStyle |= 0x80; createParams.ExStyle |= 0x8000000; createParams.ExStyle &= -262145; return createParams; } } public BrowserForm(string pipeName) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown _pipeName = pipeName; ((Control)this).Text = "On-Together School Screen"; ((Form)this).FormBorderStyle = (FormBorderStyle)0; ((Form)this).ShowInTaskbar = false; ((Form)this).StartPosition = (FormStartPosition)0; ((Form)this).Location = new Point(-1200, -1200); ((Form)this).ClientSize = new Size(768, 384); _webView = new WebView2 { Dock = (DockStyle)5 }; ((Control)this).Controls.Add((Control)(object)_webView); ((Form)this).Shown += async delegate { await InitializeAsync(); }; ((Form)this).FormClosing += (FormClosingEventHandler)delegate { _cancel.Cancel(); }; } private async Task InitializeAsync() { _ = 2; try { _pipe = new NamedPipeClientStream(".", _pipeName, PipeDirection.InOut, PipeOptions.Asynchronous); await _pipe.ConnectAsync(15000); _writer = new BinaryWriter(_pipe, Encoding.UTF8, leaveOpen: true); Task.Run((Func<Task?>)ReadCommandsAsync); string www = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "www"); if (!File.Exists(Path.Combine(www, "index.html"))) { throw new FileNotFoundException("The school screen player page is missing. Reinstall the complete mod package."); } string text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "OnTogetherSchoolScreen", "WebView2"); Directory.CreateDirectory(text); CoreWebView2EnvironmentOptions val = new CoreWebView2EnvironmentOptions("--autoplay-policy=no-user-gesture-required --disable-background-timer-throttling", (string)null, (string)null, false, (List<CoreWebView2CustomSchemeRegistration>)null); CoreWebView2Environment val2 = await CoreWebView2Environment.CreateAsync((string)null, text, val); await _webView.EnsureCoreWebView2Async(val2); _webView.CoreWebView2.SetVirtualHostNameToFolderMapping("schoolvideo.local", www, (CoreWebView2HostResourceAccessKind)1); _webView.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false; _webView.CoreWebView2.Settings.AreDevToolsEnabled = false; _webView.CoreWebView2.NavigationCompleted += delegate(object _, CoreWebView2NavigationCompletedEventArgs e) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) _webReady = e.IsSuccess; if (!_webReady) { SendPacket(69, Encoding.UTF8.GetBytes("The player page could not load: " + ((object)e.WebErrorStatus/*cast due to .constrained prefix*/).ToString())); } else { SendPacket(83, Encoding.UTF8.GetBytes("READY|page")); string result; while (_webReady && _pendingCommands.TryDequeue(out result)) { _ = ExecuteCommandAsync(result); } } }; _webView.CoreWebView2.WebMessageReceived += delegate(object _, CoreWebView2WebMessageReceivedEventArgs e) { try { SendPacket(83, Encoding.UTF8.GetBytes(e.TryGetWebMessageAsString())); } catch { } }; _webView.Source = new Uri("https://schoolvideo.local/index.html"); CaptureLoopAsync(); } catch (Exception ex) { try { SendPacket(69, Encoding.UTF8.GetBytes(ex.GetBaseException().Message)); } catch { } CloseAfterDelay(); } } private async void CloseAfterDelay() { await Task.Delay(10000); if (!((Control)this).IsDisposed) { ((Control)this).BeginInvoke((Delegate)new Action(base.Close)); } } private async Task ReadCommandsAsync() { _ = 1; try { using StreamReader reader = new StreamReader(_pipe, Encoding.UTF8, detectEncodingFromByteOrderMarks: false, 1024, leaveOpen: true); while (!_cancel.IsCancellationRequested && _pipe.IsConnected) { string text = await reader.ReadLineAsync(); if (text != null) { if (text == "CLOSE") { ((Control)this).BeginInvoke((Delegate)new Action(base.Close)); break; } await ExecuteCommandOnUiThreadAsync(text); continue; } break; } } catch { } } private Task ExecuteCommandOnUiThreadAsync(string command) { TaskCompletionSource<bool> completion = new TaskCompletionSource<bool>(); if (((Control)this).IsDisposed || !((Control)this).IsHandleCreated) { completion.TrySetResult(result: false); return completion.Task; } ((Control)this).BeginInvoke((Delegate)(Action)async delegate { try { if (_webReady) { await ExecuteCommandAsync(command); } else { _pendingCommands.Enqueue(command); } completion.TrySetResult(result: true); } catch (Exception exception) { completion.TrySetException(exception); } }); return completion.Task; } private async Task ExecuteCommandAsync(string command) { string[] array = command.Split(new char[1] { '\t' }); string text = array[0]; string text2; if (text == "OPEN" && array.Length >= 3) { text2 = "schoolScreenCommand('open'," + JsString(array[1]) + "," + Number(array[2]) + "," + ((array.Length >= 4) ? Number(array[3]) : "0") + ");"; } else { switch (text) { case "PLAY": text2 = "schoolScreenCommand('play');"; break; case "PAUSE": text2 = "schoolScreenCommand('pause');"; break; case "SEEK": if (array.Length >= 2) { text2 = "schoolScreenCommand('seek'," + Number(array[1]) + ");"; break; } goto default; default: if (text == "VOLUME" && array.Length >= 2) { text2 = "schoolScreenCommand('volume'," + Number(array[1]) + ");"; break; } if (text == "LOOKUP" && array.Length >= 2) { text2 = "schoolScreenLookupTitle(" + JsString(array[1]) + ");"; break; } if (text == "RESET_LOOKUPS") { text2 = "schoolScreenResetTitleLookups();"; break; } if (text == "CLEAR") { text2 = "schoolScreenCommand('clear');"; break; } return; } } if (_webView.CoreWebView2 != null) { await _webView.CoreWebView2.ExecuteScriptAsync(text2); } } private async Task CaptureLoopAsync() { long framePeriod = Stopwatch.Frequency / 30; long nextFrame = Stopwatch.GetTimestamp(); while (!_cancel.IsCancellationRequested && !((Control)this).IsDisposed) { try { if (!_capturing && _webView.CoreWebView2 != null && ((Control)_webView).IsHandleCreated) { _capturing = true; using (MemoryStream stream = new MemoryStream()) { await _webView.CoreWebView2.CapturePreviewAsync((CoreWebView2CapturePreviewImageFormat)1, (Stream)stream); SendPacket(70, stream.ToArray()); } _capturing = false; } } catch { _capturing = false; } nextFrame += framePeriod; long num = nextFrame - Stopwatch.GetTimestamp(); if (num <= 0) { nextFrame = Stopwatch.GetTimestamp(); } else { await Task.Delay(Math.Max(1, (int)Math.Ceiling((double)num * 1000.0 / (double)Stopwatch.Frequency)), _cancel.Token).ContinueWith(delegate { }); } } } private void SendPacket(byte type, byte[] payload) { if (_writer == null || payload == null || payload.Length > 4194304) { return; } _writeLock.Wait(); try { _writer.Write(type); _writer.Write(payload.Length); _writer.Write(payload); _writer.Flush(); } catch { } finally { _writeLock.Release(); } } private static string Number(string value) { if (!double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return "0"; } return result.ToString("0.0", CultureInfo.InvariantCulture); } private static string JsString(string value) { return "'" + value.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\r", "") .Replace("\n", "") + "'"; } } internal static class Program { [STAThread] private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string text = ((args.Length != 0) ? args[0] : string.Empty); if (!string.IsNullOrWhiteSpace(text)) { Application.Run((Form)(object)new BrowserForm(text)); } } } }