Decompiled source of MoreSettings v0.2.0
lib/Accessibility.dll
Decompiled 8 months agousing System; using System.Diagnostics; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; [assembly: AssemblyDescription("Accessibility.dll")] [assembly: ComVisible(true)] [assembly: CLSCompliant(true)] [assembly: AllowPartiallyTrustedCallers] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: ImportedFromTypeLib("Accessibility")] [assembly: AssemblyFileVersion("4.7.3056.0")] [assembly: AssemblyTitle("Accessibility.dll")] [assembly: CompilationRelaxations(8)] [assembly: AssemblyProduct("Microsoft® .NET Framework")] [assembly: AssemblyDefaultAlias("Accessibility.dll")] [assembly: SatelliteContractVersion("4.0.0.0")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: TypeLibVersion(1, 1)] [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] [assembly: SecurityRules(SecurityRuleSet.Level2, SkipVerificationInFullTrust = true)] [assembly: AssemblyDelaySign(true)] [assembly: Guid("1EA4DBF0-3C3B-11CF-810C-00AA00389B71")] [assembly: AssemblyInformationalVersion("4.7.3056.0")] [assembly: AssemblyKeyFile("f:\\dd\\tools\\devdiv\\FinalPublicKey.snk")] [assembly: AssemblyVersion("4.0.0.0")] namespace Accessibility; [ComImport] [ComConversionLoss] [Guid("6E26E776-04F0-495D-80E4-3330352E3169")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IAccPropServices { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetPropValue([In] ref byte pIDString, [In] uint dwIDStringLen, [In] Guid idProp, [In][MarshalAs(UnmanagedType.Struct)] object var); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetPropServer([In] ref byte pIDString, [In] uint dwIDStringLen, [In] ref Guid paProps, [In] int cProps, [In][MarshalAs(UnmanagedType.Interface)] IAccPropServer pServer, [In] AnnoScope AnnoScope); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void ClearProps([In] ref byte pIDString, [In] uint dwIDStringLen, [In] ref Guid paProps, [In] int cProps); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetHwndProp([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.Struct)] object var); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetHwndPropStr([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.LPWStr)] string str); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetHwndPropServer([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] ref Guid paProps, [In] int cProps, [In][MarshalAs(UnmanagedType.Interface)] IAccPropServer pServer, [In] AnnoScope AnnoScope); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void ClearHwndProps([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] ref Guid paProps, [In] int cProps); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void ComposeHwndIdentityString([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [Out] IntPtr ppIDString, out uint pdwIDStringLen); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void DecomposeHwndIdentityString([In] ref byte pIDString, [In] uint dwIDStringLen, [Out][ComAliasName("Accessibility.wireHWND")] IntPtr phwnd, out uint pidObject, out uint pidChild); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetHmenuProp([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.Struct)] object var); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetHmenuPropStr([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.LPWStr)] string str); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetHmenuPropServer([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] ref Guid paProps, [In] int cProps, [In][MarshalAs(UnmanagedType.Interface)] IAccPropServer pServer, [In] AnnoScope AnnoScope); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void ClearHmenuProps([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] ref Guid paProps, [In] int cProps); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void ComposeHmenuIdentityString([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [Out] IntPtr ppIDString, out uint pdwIDStringLen); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void DecomposeHmenuIdentityString([In] ref byte pIDString, [In] uint dwIDStringLen, [Out][ComAliasName("Accessibility.wireHMENU")] IntPtr phmenu, out uint pidChild); } [ComImport] [Guid("76C0DBBB-15E0-4E7B-B61B-20EEEA2001E0")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IAccPropServer { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void GetPropValue([In] ref byte pIDString, [In] uint dwIDStringLen, [In] Guid idProp, [MarshalAs(UnmanagedType.Struct)] out object pvarValue, out int pfHasProp); } public enum AnnoScope { ANNO_THIS, ANNO_CONTAINER } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct _RemotableHandle { public int fContext; public __MIDL_IWinTypes_0009 u; } [ComImport] [Guid("6E26E776-04F0-495D-80E4-3330352E3169")] [CoClass(typeof(CAccPropServicesClass))] public interface CAccPropServices : IAccPropServices { } [ComImport] [Guid("B5F8350B-0548-48B1-A6EE-88BD00B4A5E7")] [ClassInterface(ClassInterfaceType.None)] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ComConversionLoss] public class CAccPropServicesClass : IAccPropServices, CAccPropServices { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetPropValue([In] ref byte pIDString, [In] uint dwIDStringLen, [In] Guid idProp, [In][MarshalAs(UnmanagedType.Struct)] object var); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetPropServer([In] ref byte pIDString, [In] uint dwIDStringLen, [In] ref Guid paProps, [In] int cProps, [In][MarshalAs(UnmanagedType.Interface)] IAccPropServer pServer, [In] AnnoScope AnnoScope); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void ClearProps([In] ref byte pIDString, [In] uint dwIDStringLen, [In] ref Guid paProps, [In] int cProps); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetHwndProp([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.Struct)] object var); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetHwndPropStr([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.LPWStr)] string str); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetHwndPropServer([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] ref Guid paProps, [In] int cProps, [In][MarshalAs(UnmanagedType.Interface)] IAccPropServer pServer, [In] AnnoScope AnnoScope); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void ClearHwndProps([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [In] ref Guid paProps, [In] int cProps); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void ComposeHwndIdentityString([In][ComAliasName("Accessibility.wireHWND")] ref _RemotableHandle hwnd, [In] uint idObject, [In] uint idChild, [Out] IntPtr ppIDString, out uint pdwIDStringLen); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void DecomposeHwndIdentityString([In] ref byte pIDString, [In] uint dwIDStringLen, [Out][ComAliasName("Accessibility.wireHWND")] IntPtr phwnd, out uint pidObject, out uint pidChild); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetHmenuProp([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.Struct)] object var); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetHmenuPropStr([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] Guid idProp, [In][MarshalAs(UnmanagedType.LPWStr)] string str); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void SetHmenuPropServer([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] ref Guid paProps, [In] int cProps, [In][MarshalAs(UnmanagedType.Interface)] IAccPropServer pServer, [In] AnnoScope AnnoScope); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void ClearHmenuProps([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [In] ref Guid paProps, [In] int cProps); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void ComposeHmenuIdentityString([In][ComAliasName("Accessibility.wireHMENU")] ref _RemotableHandle hmenu, [In] uint idChild, [Out] IntPtr ppIDString, out uint pdwIDStringLen); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] public virtual extern void DecomposeHmenuIdentityString([In] ref byte pIDString, [In] uint dwIDStringLen, [Out][ComAliasName("Accessibility.wireHMENU")] IntPtr phmenu, out uint pidChild); } [StructLayout(LayoutKind.Explicit, Pack = 4, Size = 4)] public struct __MIDL_IWinTypes_0009 { [FieldOffset(0)] public int hInproc; [FieldOffset(0)] public int hRemote; } [ComImport] [Guid("618736E0-3C3D-11CF-810C-00AA00389B71")] [TypeLibType(TypeLibTypeFlags.FHidden | TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable)] public interface IAccessible { [DispId(-5000)] object accParent { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5000)] [return: MarshalAs(UnmanagedType.IDispatch)] get; } [DispId(-5001)] int accChildCount { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5001)] get; } [DispId(-5002)] object accChild { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5002)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.IDispatch)] get; } [DispId(-5003)] string accName { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5003)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.BStr)] get; [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5003)] [param: In] [param: MarshalAs(UnmanagedType.BStr)] set; } [DispId(-5004)] string accValue { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5004)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.BStr)] get; [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5004)] [param: In] [param: MarshalAs(UnmanagedType.BStr)] set; } [DispId(-5005)] string accDescription { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5005)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.BStr)] get; } [DispId(-5006)] object accRole { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5006)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.Struct)] get; } [DispId(-5007)] object accState { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5007)] [return: MarshalAs(UnmanagedType.Struct)] get; } [DispId(-5008)] string accHelp { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5008)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.BStr)] get; } [DispId(-5009)] int accHelpTopic { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5009)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] get; } [DispId(-5010)] string accKeyboardShortcut { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5010)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [return: MarshalAs(UnmanagedType.BStr)] get; } [DispId(-5011)] object accFocus { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5011)] [return: MarshalAs(UnmanagedType.Struct)] get; } [DispId(-5012)] object accSelection { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5012)] [return: MarshalAs(UnmanagedType.Struct)] get; } [DispId(-5013)] string accDefaultAction { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5013)] [return: MarshalAs(UnmanagedType.BStr)] get; } [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5014)] void accSelect([In] int flagsSelect, [Optional][In][MarshalAs(UnmanagedType.Struct)] object varChild); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5015)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] void accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, [Optional][In][MarshalAs(UnmanagedType.Struct)] object varChild); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5016)] [return: MarshalAs(UnmanagedType.Struct)] object accNavigate([In] int navDir, [Optional][In][MarshalAs(UnmanagedType.Struct)] object varStart); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] [DispId(-5017)] [return: MarshalAs(UnmanagedType.Struct)] object accHitTest([In] int xLeft, [In] int yTop); [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [DispId(-5018)] [TypeLibFunc(TypeLibFuncFlags.FHidden)] void accDoDefaultAction([Optional][In][MarshalAs(UnmanagedType.Struct)] object varChild); } [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [TypeLibType(TypeLibTypeFlags.FHidden | TypeLibTypeFlags.FOleAutomation)] [Guid("03022430-ABC4-11D0-BDE2-00AA001A1953")] public interface IAccessibleHandler { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void AccessibleObjectFromID([In] int hwnd, [In] int lObjectID, [MarshalAs(UnmanagedType.Interface)] out IAccessible pIAccessible); } [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("7852B78D-1CFD-41C1-A615-9C0C85960B5F")] [ComConversionLoss] public interface IAccIdentity { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void GetIdentityString([In] uint dwIDChild, [Out] IntPtr ppIDString, out uint pdwIDStringLen); }
lib/Ookii.Dialogs.WinForms.dll
Decompiled 8 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Drawing; using System.Drawing.Design; using System.Drawing.Drawing2D; using System.Globalization; using System.IO; using System.Net; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Threading; using System.Windows.Forms; using System.Windows.Forms.VisualStyles; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using Ookii.Dialogs.WinForms.Interop; using Ookii.Dialogs.WinForms.Properties; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: CLSCompliant(true)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: ComVisible(false)] [assembly: Guid("16078df2-e2d1-4754-9864-84c288a1e9bd")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("Ookii Dialogs Contributors")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) 2009-2021 Ookii Dialogs Contributors")] [assembly: AssemblyDescription("Ookii.Dialogs.WinForms is a class library for .NET applications providing several common dialogs. Included are classes for task dialogs, credential dialog, progress dialog, input dialog, folder browser dialog, and more.")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0+9a29825f2a6a902478225f63197f1e9b558e1da2")] [assembly: AssemblyProduct("Ookii.Dialogs.WinForms")] [assembly: AssemblyTitle("Ookii.Dialogs.WinForms")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ookii-dialogs/ookii-dialogs-winforms.git")] [assembly: AssemblyVersion("4.0.0.0")] namespace Ookii.Dialogs.WinForms { public static class AdditionalVisualStyleElements { public static class TextStyle { private const string _className = "TEXTSTYLE"; private static VisualStyleElement _mainInstruction; private static VisualStyleElement _bodyText; public static VisualStyleElement MainInstruction => _mainInstruction ?? (_mainInstruction = VisualStyleElement.CreateElement("TEXTSTYLE", 1, 0)); public static VisualStyleElement BodyText => _bodyText ?? (_bodyText = VisualStyleElement.CreateElement("TEXTSTYLE", 4, 0)); } public static class TaskDialog { private const string _className = "TASKDIALOG"; private static VisualStyleElement _primaryPanel; private static VisualStyleElement _secondaryPanel; public static VisualStyleElement PrimaryPanel => _primaryPanel ?? (_primaryPanel = VisualStyleElement.CreateElement("TASKDIALOG", 1, 0)); public static VisualStyleElement SecondaryPanel => _secondaryPanel ?? (_secondaryPanel = VisualStyleElement.CreateElement("TASKDIALOG", 8, 0)); } } public sealed class AnimationResource { public string ResourceFile { get; private set; } public int ResourceId { get; private set; } public AnimationResource(string resourceFile, int resourceId) { if (resourceFile == null) { throw new ArgumentNullException("resourceFile"); } ResourceFile = resourceFile; ResourceId = resourceId; } public static AnimationResource GetShellAnimation(ShellAnimation animation) { if (!Enum.IsDefined(typeof(ShellAnimation), animation)) { throw new ArgumentOutOfRangeException("animation"); } return new AnimationResource("shell32.dll", (int)animation); } internal SafeModuleHandle LoadLibrary() { SafeModuleHandle safeModuleHandle = NativeMethods.LoadLibraryEx(ResourceFile, IntPtr.Zero, NativeMethods.LoadLibraryExFlags.LoadLibraryAsDatafile); if (safeModuleHandle.IsInvalid) { int lastWin32Error = Marshal.GetLastWin32Error(); if (lastWin32Error == 2) { throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.FileNotFoundFormat, ResourceFile)); } throw new Win32Exception(lastWin32Error); } return safeModuleHandle; } } public enum ButtonType { Custom = 0, Ok = 1, Yes = 6, No = 7, Cancel = 2, Retry = 4, Close = 8 } internal sealed class ComCtlv6ActivationContext : IDisposable { private IntPtr _cookie; private static NativeMethods.ACTCTX _enableThemingActivationContext; private static ActivationContextSafeHandle _activationContext; private static bool _contextCreationSucceeded; private static readonly object _contextCreationLock = new object(); public ComCtlv6ActivationContext(bool enable) { if (enable && NativeMethods.IsWindowsXPOrLater && EnsureActivateContextCreated() && !NativeMethods.ActivateActCtx(_activationContext, out _cookie)) { _cookie = IntPtr.Zero; } } ~ComCtlv6ActivationContext() { Dispose(disposing: false); } public void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { if (_cookie != IntPtr.Zero && NativeMethods.DeactivateActCtx(0u, _cookie)) { _cookie = IntPtr.Zero; } } private static bool EnsureActivateContextCreated() { lock (_contextCreationLock) { if (_contextCreationSucceeded) { return _contextCreationSucceeded; } string text; using (Stream stream = typeof(ComCtlv6ActivationContext).Assembly.GetManifestResourceStream("Ookii.Dialogs.XPThemes.manifest")) { if (stream == null) { throw new InvalidOperationException("Unable to retrieve Ookii.Dialogs.XPThemes.manifest embedded resource"); } text = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); using FileStream destination = new FileStream(text, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete); stream.CopyTo(destination); } NativeMethods.ACTCTX enableThemingActivationContext = default(NativeMethods.ACTCTX); enableThemingActivationContext.cbSize = Marshal.SizeOf(typeof(NativeMethods.ACTCTX)); enableThemingActivationContext.lpSource = text; _enableThemingActivationContext = enableThemingActivationContext; _activationContext = NativeMethods.CreateActCtx(ref _enableThemingActivationContext); _contextCreationSucceeded = !_activationContext.IsInvalid; try { File.Delete(text); } catch (Exception) { } return _contextCreationSucceeded; } } } [DefaultProperty("MainInstruction")] [DefaultEvent("UserNameChanged")] [Description("Allows access to credential UI for generic credentials.")] public class CredentialDialog : Component { private string _confirmTarget; private NetworkCredential _credentials = new NetworkCredential(); private bool _isSaveChecked; private byte[] _additionalEntropy; private string _target; private static readonly Dictionary<string, NetworkCredential> _applicationInstanceCredentialCache = new Dictionary<string, NetworkCredential>(); private string _caption; private string _text; private string _windowTitle; private IContainer components; [Category("Behavior")] [Description("Indicates whether to use the application instance credential cache.")] [DefaultValue(false)] public bool UseApplicationInstanceCredentialCache { get; set; } [Category("Appearance")] [Description("Indicates whether the \"Save password\" checkbox is checked.")] [DefaultValue(false)] public bool IsSaveChecked { get { return _isSaveChecked; } set { _confirmTarget = null; _isSaveChecked = value; } } [Browsable(false)] public string Password { get { return _credentials.Password; } private set { _confirmTarget = null; _credentials.Password = value; OnPasswordChanged(EventArgs.Empty); } } [Browsable(false)] public byte[] AdditionalEntropy { get { return _additionalEntropy; } set { _additionalEntropy = value; } } [Browsable(false)] public NetworkCredential Credentials => _credentials; [Browsable(false)] public string UserName { get { return _credentials.UserName ?? string.Empty; } private set { _confirmTarget = null; _credentials.UserName = value; OnUserNameChanged(EventArgs.Empty); } } [Category("Behavior")] [Description("The target for the credentials, typically the server name prefixed by an application-specific identifier.")] [DefaultValue("")] public string Target { get { return _target ?? string.Empty; } set { _target = value; _confirmTarget = null; } } [Localizable(true)] [Category("Appearance")] [Description("The title of the credentials dialog.")] [DefaultValue("")] public string WindowTitle { get { return _windowTitle ?? string.Empty; } set { _windowTitle = value; } } [Localizable(true)] [Category("Appearance")] [Description("A brief message that will be displayed in the dialog box.")] [DefaultValue("")] public string MainInstruction { get { return _caption ?? string.Empty; } set { _caption = value; } } [Localizable(true)] [Category("Appearance")] [Description("Additional text to display in the dialog.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string Content { get { return _text ?? string.Empty; } set { _text = value; } } [Localizable(true)] [Category("Appearance")] [Description("Indicates how the text of the MainInstruction and Content properties is displayed on Windows XP.")] [DefaultValue(DownlevelTextMode.MainInstructionAndContent)] public DownlevelTextMode DownlevelTextMode { get; set; } [Category("Appearance")] [Description("Indicates whether a check box is shown on the dialog that allows the user to choose whether to save the credentials or not.")] [DefaultValue(false)] public bool ShowSaveCheckBox { get; set; } [Category("Behavior")] [Description("Indicates whether the dialog should be displayed even when saved credentials exist for the specified target.")] [DefaultValue(false)] public bool ShowUIForSavedCredentials { get; set; } public bool IsStoredCredential { get; private set; } [Category("Property Changed")] [Description("Event raised when the value of the UserName property changes.")] public event EventHandler UserNameChanged; [Category("Property Changed")] [Description("Event raised when the value of the Password property changes.")] public event EventHandler PasswordChanged; public CredentialDialog() { InitializeComponent(); } public CredentialDialog(IContainer container) { container?.Add(this); InitializeComponent(); } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public DialogResult ShowDialog() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return ShowDialog(null); } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public DialogResult ShowDialog(IntPtr owner) { if (string.IsNullOrEmpty(_target)) { throw new InvalidOperationException(Resources.CredentialEmptyTargetError); } UserName = ""; Password = ""; IsStoredCredential = false; if (RetrieveCredentialsFromApplicationInstanceCache()) { IsStoredCredential = true; _confirmTarget = Target; return (DialogResult)1; } bool storedCredentials = false; if (ShowSaveCheckBox && RetrieveCredentials()) { IsSaveChecked = true; if (!ShowUIForSavedCredentials) { IsStoredCredential = true; _confirmTarget = Target; return (DialogResult)1; } storedCredentials = true; } IntPtr owner2 = ((owner == IntPtr.Zero) ? NativeMethods.GetActiveWindow() : owner); if ((!NativeMethods.IsWindowsVistaOrLater) ? PromptForCredentialsCredUI(owner2, storedCredentials) : PromptForCredentialsCredUIWin(owner2, storedCredentials)) { return (DialogResult)1; } return (DialogResult)2; } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public DialogResult ShowDialog(IWin32Window owner) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) IntPtr owner2 = ((owner != null) ? owner.Handle : NativeMethods.GetActiveWindow()); return ShowDialog(owner2); } public void ConfirmCredentials(bool confirm) { if (_confirmTarget == null || _confirmTarget != Target) { throw new InvalidOperationException(Resources.CredentialPromptNotCalled); } _confirmTarget = null; if (!(IsSaveChecked && confirm)) { return; } if (UseApplicationInstanceCredentialCache) { lock (_applicationInstanceCredentialCache) { _applicationInstanceCredentialCache[Target] = new NetworkCredential(UserName, Password); } } StoreCredential(Target, Credentials, AdditionalEntropy); } public static void StoreCredential(string target, NetworkCredential credential, byte[] additionalEntropy = null) { if (target == null) { throw new ArgumentNullException("target"); } if (target.Length == 0) { throw new ArgumentException(Resources.CredentialEmptyTargetError, "target"); } if (credential == null) { throw new ArgumentNullException("credential"); } NativeMethods.CREDENTIAL Credential = default(NativeMethods.CREDENTIAL); Credential.UserName = credential.UserName; Credential.TargetName = target; Credential.Persist = NativeMethods.CredPersist.Enterprise; byte[] array = EncryptPassword(credential.Password, additionalEntropy); Credential.CredentialBlob = Marshal.AllocHGlobal(array.Length); try { Marshal.Copy(array, 0, Credential.CredentialBlob, array.Length); Credential.CredentialBlobSize = (uint)array.Length; Credential.Type = NativeMethods.CredTypes.CRED_TYPE_GENERIC; if (!NativeMethods.CredWrite(ref Credential, 0)) { throw new CredentialException(Marshal.GetLastWin32Error()); } } finally { Marshal.FreeCoTaskMem(Credential.CredentialBlob); } } public static NetworkCredential RetrieveCredential(string target, byte[] additionalEntropy = null) { if (target == null) { throw new ArgumentNullException("target"); } if (target.Length == 0) { throw new ArgumentException(Resources.CredentialEmptyTargetError, "target"); } NetworkCredential networkCredential = RetrieveCredentialFromApplicationInstanceCache(target); if (networkCredential != null) { return networkCredential; } IntPtr Credential; bool num = NativeMethods.CredRead(target, NativeMethods.CredTypes.CRED_TYPE_GENERIC, 0, out Credential); int lastWin32Error = Marshal.GetLastWin32Error(); if (num) { try { NativeMethods.CREDENTIAL obj = (NativeMethods.CREDENTIAL)Marshal.PtrToStructure(Credential, typeof(NativeMethods.CREDENTIAL)); byte[] array = new byte[obj.CredentialBlobSize]; Marshal.Copy(obj.CredentialBlob, array, 0, array.Length); return new NetworkCredential(obj.UserName, DecryptPassword(array, additionalEntropy)); } finally { NativeMethods.CredFree(Credential); } } if (lastWin32Error == 1168) { return null; } throw new CredentialException(lastWin32Error); } public static NetworkCredential RetrieveCredentialFromApplicationInstanceCache(string target) { if (target == null) { throw new ArgumentNullException("target"); } if (target.Length == 0) { throw new ArgumentException(Resources.CredentialEmptyTargetError, "target"); } lock (_applicationInstanceCredentialCache) { if (_applicationInstanceCredentialCache.TryGetValue(target, out var value)) { return value; } } return null; } public static bool DeleteCredential(string target) { if (target == null) { throw new ArgumentNullException("target"); } if (target.Length == 0) { throw new ArgumentException(Resources.CredentialEmptyTargetError, "target"); } bool result = false; lock (_applicationInstanceCredentialCache) { result = _applicationInstanceCredentialCache.Remove(target); } if (NativeMethods.CredDelete(target, NativeMethods.CredTypes.CRED_TYPE_GENERIC, 0)) { result = true; } else { int lastWin32Error = Marshal.GetLastWin32Error(); if (lastWin32Error != 1168) { throw new CredentialException(lastWin32Error); } } return result; } protected virtual void OnUserNameChanged(EventArgs e) { if (this.UserNameChanged != null) { this.UserNameChanged(this, e); } } protected virtual void OnPasswordChanged(EventArgs e) { if (this.PasswordChanged != null) { this.PasswordChanged(this, e); } } private bool PromptForCredentialsCredUI(IntPtr owner, bool storedCredentials) { NativeMethods.CREDUI_INFO pUiInfo = CreateCredUIInfo(owner, downlevelText: true); NativeMethods.CREDUI_FLAGS cREDUI_FLAGS = NativeMethods.CREDUI_FLAGS.DO_NOT_PERSIST | NativeMethods.CREDUI_FLAGS.ALWAYS_SHOW_UI | NativeMethods.CREDUI_FLAGS.GENERIC_CREDENTIALS; if (ShowSaveCheckBox) { cREDUI_FLAGS |= NativeMethods.CREDUI_FLAGS.SHOW_SAVE_CHECK_BOX; } StringBuilder stringBuilder = new StringBuilder(513); stringBuilder.Append(UserName); StringBuilder stringBuilder2 = new StringBuilder(256); stringBuilder2.Append(Password); NativeMethods.CredUIReturnCodes credUIReturnCodes = NativeMethods.CredUIPromptForCredentials(ref pUiInfo, Target, IntPtr.Zero, 0, stringBuilder, 513u, stringBuilder2, 256u, ref _isSaveChecked, cREDUI_FLAGS); switch (credUIReturnCodes) { case NativeMethods.CredUIReturnCodes.NO_ERROR: UserName = stringBuilder.ToString(); Password = stringBuilder2.ToString(); if (ShowSaveCheckBox) { _confirmTarget = Target; if (storedCredentials && !IsSaveChecked) { DeleteCredential(Target); } } return true; case NativeMethods.CredUIReturnCodes.ERROR_CANCELLED: return false; default: throw new CredentialException((int)credUIReturnCodes); } } private bool PromptForCredentialsCredUIWin(IntPtr owner, bool storedCredentials) { NativeMethods.CREDUI_INFO pUiInfo = CreateCredUIInfo(owner, downlevelText: false); NativeMethods.CredUIWinFlags credUIWinFlags = NativeMethods.CredUIWinFlags.Generic; if (ShowSaveCheckBox) { credUIWinFlags |= NativeMethods.CredUIWinFlags.Checkbox; } IntPtr intPtr = IntPtr.Zero; IntPtr ppvOutAuthBuffer = IntPtr.Zero; try { uint pcbPackedCredentials = 0u; if (UserName.Length > 0) { NativeMethods.CredPackAuthenticationBuffer(0u, UserName, Password, IntPtr.Zero, ref pcbPackedCredentials); if (pcbPackedCredentials != 0) { intPtr = Marshal.AllocCoTaskMem((int)pcbPackedCredentials); if (!NativeMethods.CredPackAuthenticationBuffer(0u, UserName, Password, intPtr, ref pcbPackedCredentials)) { throw new CredentialException(Marshal.GetLastWin32Error()); } } } uint pulAuthPackage = 0u; uint pulOutAuthBufferSize; NativeMethods.CredUIReturnCodes credUIReturnCodes = NativeMethods.CredUIPromptForWindowsCredentials(ref pUiInfo, 0u, ref pulAuthPackage, intPtr, pcbPackedCredentials, out ppvOutAuthBuffer, out pulOutAuthBufferSize, ref _isSaveChecked, credUIWinFlags); switch (credUIReturnCodes) { case NativeMethods.CredUIReturnCodes.NO_ERROR: { StringBuilder stringBuilder = new StringBuilder(513); StringBuilder stringBuilder2 = new StringBuilder(256); uint pcchMaxUserName = (uint)stringBuilder.Capacity; uint pcchMaxPassword = (uint)stringBuilder2.Capacity; uint pcchMaxDomainName = 0u; if (!NativeMethods.CredUnPackAuthenticationBuffer(0u, ppvOutAuthBuffer, pulOutAuthBufferSize, stringBuilder, ref pcchMaxUserName, null, ref pcchMaxDomainName, stringBuilder2, ref pcchMaxPassword)) { throw new CredentialException(Marshal.GetLastWin32Error()); } UserName = stringBuilder.ToString(); Password = stringBuilder2.ToString(); if (ShowSaveCheckBox) { _confirmTarget = Target; if (storedCredentials && !IsSaveChecked) { DeleteCredential(Target); } } return true; } case NativeMethods.CredUIReturnCodes.ERROR_CANCELLED: return false; default: throw new CredentialException((int)credUIReturnCodes); } } finally { if (intPtr != IntPtr.Zero) { Marshal.FreeCoTaskMem(intPtr); } if (ppvOutAuthBuffer != IntPtr.Zero) { Marshal.FreeCoTaskMem(ppvOutAuthBuffer); } } } private NativeMethods.CREDUI_INFO CreateCredUIInfo(IntPtr owner, bool downlevelText) { NativeMethods.CREDUI_INFO cREDUI_INFO = default(NativeMethods.CREDUI_INFO); cREDUI_INFO.cbSize = Marshal.SizeOf(cREDUI_INFO); cREDUI_INFO.hwndParent = owner; if (downlevelText) { cREDUI_INFO.pszCaptionText = WindowTitle; switch (DownlevelTextMode) { case DownlevelTextMode.MainInstructionAndContent: if (MainInstruction.Length == 0) { cREDUI_INFO.pszMessageText = Content; } else if (Content.Length == 0) { cREDUI_INFO.pszMessageText = MainInstruction; } else { cREDUI_INFO.pszMessageText = MainInstruction + Environment.NewLine + Environment.NewLine + Content; } break; case DownlevelTextMode.MainInstructionOnly: cREDUI_INFO.pszMessageText = MainInstruction; break; case DownlevelTextMode.ContentOnly: cREDUI_INFO.pszMessageText = Content; break; } } else { cREDUI_INFO.pszMessageText = Content; cREDUI_INFO.pszCaptionText = MainInstruction; } return cREDUI_INFO; } private bool RetrieveCredentials() { NetworkCredential networkCredential = RetrieveCredential(Target, AdditionalEntropy); if (networkCredential != null) { UserName = networkCredential.UserName; Password = networkCredential.Password; return true; } return false; } private static byte[] EncryptPassword(string password, byte[] additionalEntropy) { return ProtectedData.Protect(Encoding.UTF8.GetBytes(password), additionalEntropy, (DataProtectionScope)0); } private static string DecryptPassword(byte[] encrypted, byte[] additionalEntropy) { try { return Encoding.UTF8.GetString(ProtectedData.Unprotect(encrypted, additionalEntropy, (DataProtectionScope)0)); } catch (CryptographicException) { return string.Empty; } } private bool RetrieveCredentialsFromApplicationInstanceCache() { if (UseApplicationInstanceCredentialCache) { NetworkCredential networkCredential = RetrieveCredentialFromApplicationInstanceCache(Target); if (networkCredential != null) { UserName = networkCredential.UserName; Password = networkCredential.Password; return true; } } return false; } protected override void Dispose(bool disposing) { try { if (disposing && components != null) { components.Dispose(); } } finally { base.Dispose(disposing); } } private void InitializeComponent() { components = new Container(); } } [Serializable] public class CredentialException : Win32Exception { [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public CredentialException() : base(Resources.CredentialError) { } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public CredentialException(int error) : base(error) { } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public CredentialException(string message) : base(message) { } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public CredentialException(int error, string message) : base(error, message) { } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public CredentialException(string message, Exception innerException) : base(message, innerException) { } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] protected CredentialException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal static class DialogHelper { public static bool IsTaskDialogThemeSupported { get { if (NativeMethods.IsWindowsVistaOrLater && VisualStyleRenderer.IsSupported) { return Application.RenderWithVisualStyles; } return false; } } public static int GetTextHeight(IDeviceContext dc, string mainInstruction, string content, Font mainInstructionFallbackFont, Font contentFallbackFont, int width) { Point location = Point.Empty; DrawText(dc, mainInstruction, content, ref location, mainInstructionFallbackFont, contentFallbackFont, measureOnly: true, width); return location.Y; } public static Size SizeDialog(IDeviceContext dc, string mainInstruction, string content, Screen screen, Font mainInstructionFallbackFont, Font contentFallbackFont, int horizontalSpacing, int verticalSpacing, int minimumWidth, int textMinimumHeight) { int num = minimumWidth - horizontalSpacing; int num2; for (num2 = GetTextHeight(dc, mainInstruction, content, mainInstructionFallbackFont, contentFallbackFont, num); num2 > num; num2 = GetTextHeight(dc, mainInstruction, content, mainInstructionFallbackFont, contentFallbackFont, num)) { num = (int)(Math.Sqrt(num2 * num) * 1.1); } if (num2 < textMinimumHeight) { num2 = textMinimumHeight; } int num3 = num + horizontalSpacing; int num4 = num2 + verticalSpacing; Rectangle workingArea = screen.WorkingArea; if ((double)num4 > 0.9 * (double)workingArea.Height) { int num5 = num2 * num; num4 = (int)(0.9 * (double)workingArea.Height); num2 = num4 - verticalSpacing; num = num5 / num2; num3 = num + horizontalSpacing; } if ((double)num3 > 0.9 * (double)workingArea.Width) { num3 = (int)(0.9 * (double)workingArea.Width); } return new Size(num3, num4); } public static void DrawText(IDeviceContext dc, string text, VisualStyleElement element, Font fallbackFont, ref Point location, bool measureOnly, int width) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003f: 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) //IL_0083: 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) Rectangle rectangle = new Rectangle(location.X, location.Y, width, NativeMethods.IsWindowsXPOrLater ? int.MaxValue : 100000); TextFormatFlags val = (TextFormatFlags)16; if (IsTaskDialogThemeSupported) { VisualStyleRenderer val2 = new VisualStyleRenderer(element); Rectangle textExtent = val2.GetTextExtent(dc, rectangle, text, val); location += new Size(0, textExtent.Height); if (!measureOnly) { val2.DrawText(dc, textExtent, text, false, val); } } else { if (!measureOnly) { TextRenderer.DrawText(dc, text, fallbackFont, rectangle, SystemColors.WindowText, val); } location += new Size(0, TextRenderer.MeasureText(dc, text, fallbackFont, new Size(rectangle.Width, rectangle.Height), val).Height); } } public static void DrawText(IDeviceContext dc, string mainInstruction, string content, ref Point location, Font mainInstructionFallbackFont, Font contentFallbackFont, bool measureOnly, int width) { if (!string.IsNullOrEmpty(mainInstruction)) { DrawText(dc, mainInstruction, AdditionalVisualStyleElements.TextStyle.MainInstruction, mainInstructionFallbackFont, ref location, measureOnly, width); } if (!string.IsNullOrEmpty(content)) { if (!string.IsNullOrEmpty(mainInstruction)) { content = Environment.NewLine + content; } DrawText(dc, content, AdditionalVisualStyleElements.TextStyle.BodyText, contentFallbackFont, ref location, measureOnly, width); } } } public enum DownlevelTextMode { MainInstructionAndContent, MainInstructionOnly, ContentOnly } public class ExpandButtonClickedEventArgs : EventArgs { private bool _expanded; public bool Expanded => _expanded; public ExpandButtonClickedEventArgs(bool expanded) { _expanded = expanded; } } public class ExtendedForm : Form { private bool _useSystemFont; private Padding _glassMargin; private bool _allowGlassDragging = true; [Category("Appearance")] [DefaultValue(false)] [Description("Indicates whether or not the form automatically uses the system default font.")] public bool UseSystemFont { get { return _useSystemFont; } set { _useSystemFont = value; } } [Category("Appearance")] [Description("The glass margins of the form.")] public Padding GlassMargin { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _glassMargin; } set { //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_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) if (_glassMargin != value) { _glassMargin = value; EnableGlass(); } } } [Category("Behavior")] [Description("Indicates whether the form can be dragged by the glass areas inside the client area.")] [DefaultValue(true)] public bool AllowGlassDragging { get { return _allowGlassDragging; } set { _allowGlassDragging = value; } } public event EventHandler DwmCompositionChanged; protected virtual void OnDwmCompositionChanged(EventArgs e) { this.DwmCompositionChanged?.Invoke(this, e); } protected override void OnLoad(EventArgs e) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (!((Component)this).DesignMode && _useSystemFont) { ((Control)this).Font = SystemFonts.IconTitleFont; SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged); } ((Form)this).OnLoad(e); } protected override void OnFormClosed(FormClosedEventArgs e) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown ((Form)this).OnFormClosed(e); SystemEvents.UserPreferenceChanged -= new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged); } protected override void OnPaintBackground(PaintEventArgs pevent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (((Component)this).DesignMode || Glass.IsDwmCompositionEnabled) { if (((Component)this).DesignMode) { HatchBrush val = new HatchBrush((HatchStyle)51, Color.SkyBlue, ((Control)this).BackColor); try { PaintGlassArea(pevent, (Brush)(object)val); return; } finally { ((IDisposable)val)?.Dispose(); } } PaintGlassArea(pevent, Brushes.Black); } else { ((ScrollableControl)this).OnPaintBackground(pevent); } } protected override void OnResize(EventArgs e) { ((Form)this).OnResize(e); if (((Padding)(ref _glassMargin)).All != 0) { ((Control)this).Invalidate(); } } protected override void OnHandleCreated(EventArgs e) { EnableGlass(); ((Form)this).OnHandleCreated(e); } [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] protected override void WndProc(ref Message m) { ((Form)this).WndProc(ref m); switch (((Message)(ref m)).Msg) { case 132: { if (!_allowGlassDragging || !(((Message)(ref m)).Result == new IntPtr(1)) || !Glass.IsDwmCompositionEnabled) { break; } if (((Padding)(ref _glassMargin)).Left == -1 && ((Padding)(ref _glassMargin)).Top == -1 && ((Padding)(ref _glassMargin)).Right == -1 && ((Padding)(ref _glassMargin)).Bottom == -1) { ((Message)(ref m)).Result = new IntPtr(2); break; } Point point = new Point((int)((Message)(ref m)).LParam & 0xFFFF, (int)((Message)(ref m)).LParam >> 16); point = ((Control)this).PointToClient(point); if (point.X < ((Padding)(ref _glassMargin)).Left || point.X > ((Form)this).ClientSize.Width - ((Padding)(ref _glassMargin)).Right || point.Y < ((Padding)(ref _glassMargin)).Top || point.Y > ((Form)this).ClientSize.Height - ((Padding)(ref _glassMargin)).Bottom) { ((Message)(ref m)).Result = new IntPtr(2); } break; } case 798: if (((Padding)(ref _glassMargin)).All != 0) { EnableGlass(); } OnDwmCompositionChanged(EventArgs.Empty); ((Message)(ref m)).Result = IntPtr.Zero; break; } } protected override void ScaleControl(SizeF factor, BoundsSpecified specified) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) float width = factor.Width; Padding glassMargin = GlassMargin; if (width != 1f) { if (((Padding)(ref glassMargin)).Left > 0) { ((Padding)(ref glassMargin)).Left = (int)Math.Round((float)((Padding)(ref glassMargin)).Left * width); } if (((Padding)(ref glassMargin)).Right > 0) { ((Padding)(ref glassMargin)).Right = (int)Math.Round((float)((Padding)(ref glassMargin)).Right * width); } } float height = factor.Height; if (height != 1f) { if (((Padding)(ref glassMargin)).Top > 0) { ((Padding)(ref glassMargin)).Top = (int)Math.Round((float)((Padding)(ref glassMargin)).Top * height); } if (((Padding)(ref glassMargin)).Bottom > 0) { ((Padding)(ref glassMargin)).Bottom = (int)Math.Round((float)((Padding)(ref glassMargin)).Bottom * height); } } GlassMargin = glassMargin; ((Form)this).ScaleControl(factor, specified); } private void EnableGlass() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!((Component)this).DesignMode && Glass.IsDwmCompositionEnabled) { ((IWin32Window)(object)this).ExtendFrameIntoClientArea(GlassMargin); ((Control)this).Invalidate(); } } private void PaintGlassArea(PaintEventArgs pevent, Brush brush) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown if (((Padding)(ref _glassMargin)).Left == -1 && ((Padding)(ref _glassMargin)).Top == -1 && ((Padding)(ref _glassMargin)).Right == -1 && ((Padding)(ref _glassMargin)).Bottom == -1) { pevent.Graphics.FillRectangle(brush, pevent.ClipRectangle); return; } Rectangle rectangle = new Rectangle(((Padding)(ref _glassMargin)).Left, ((Padding)(ref _glassMargin)).Top, ((Form)this).ClientSize.Width - ((Padding)(ref _glassMargin)).Right, ((Form)this).ClientSize.Height - ((Padding)(ref _glassMargin)).Bottom); pevent.Graphics.FillRectangle((Brush)new SolidBrush(((Control)this).BackColor), rectangle); if (((Padding)(ref _glassMargin)).Left != 0) { pevent.Graphics.FillRectangle(brush, new Rectangle(0, 0, ((Padding)(ref _glassMargin)).Left, ((Form)this).ClientSize.Height)); } if (((Padding)(ref _glassMargin)).Right != 0) { pevent.Graphics.FillRectangle(brush, new Rectangle(((Form)this).ClientSize.Width - ((Padding)(ref _glassMargin)).Right, 0, ((Form)this).ClientSize.Width, ((Form)this).ClientSize.Height)); } if (((Padding)(ref _glassMargin)).Top != 0) { pevent.Graphics.FillRectangle(brush, new Rectangle(0, 0, ((Form)this).ClientSize.Width, ((Padding)(ref _glassMargin)).Top)); } if (((Padding)(ref _glassMargin)).Bottom != 0) { pevent.Graphics.FillRectangle(brush, new Rectangle(0, ((Form)this).ClientSize.Height - ((Padding)(ref _glassMargin)).Bottom, ((Form)this).ClientSize.Width, ((Form)this).ClientSize.Height)); } } private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)e.Category == 12 && _useSystemFont) { ((Control)this).Font = SystemFonts.IconTitleFont; } } } public static class Glass { public static bool OSSupportsDwmComposition => NativeMethods.IsWindowsVistaOrLater; public static bool IsDwmCompositionEnabled { get { if (OSSupportsDwmComposition) { return NativeMethods.DwmIsCompositionEnabled(); } return false; } } public static void ExtendFrameIntoClientArea(this IWin32Window window, Padding glassMargin) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!IsDwmCompositionEnabled) { throw new NotSupportedException(Resources.GlassNotSupportedError); } if (window == null) { throw new ArgumentNullException("window"); } NativeMethods.MARGINS pMarInset = new NativeMethods.MARGINS(glassMargin); NativeMethods.DwmExtendFrameIntoClientArea(window.Handle, ref pMarInset); } public static void DrawCompositedText(IDeviceContext dc, string text, Font font, Rectangle bounds, Padding padding, Color foreColor, int glowSize, TextFormatFlags textFormat) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected I4, but got Unknown if (!IsDwmCompositionEnabled) { throw new NotSupportedException(Resources.GlassNotSupportedError); } if (dc == null) { throw new ArgumentNullException("dc"); } if (text == null) { throw new ArgumentNullException("text"); } if (font == null) { throw new ArgumentNullException("font"); } IntPtr hdc = dc.GetHdc(); try { using SafeDeviceHandle safeDeviceHandle = NativeMethods.CreateCompatibleDC(hdc); using SafeGDIHandle hObject = new SafeGDIHandle(font.ToHfont(), ownsHandle: true); using (NativeMethods.CreateDib(bounds, hdc, safeDeviceHandle)) { NativeMethods.SelectObject(safeDeviceHandle, hObject); VisualStyleRenderer val = new VisualStyleRenderer(Caption.Active); NativeMethods.DTTOPTS pOptions = new NativeMethods.DTTOPTS { dwSize = Marshal.SizeOf(typeof(NativeMethods.DTTOPTS)), dwFlags = (NativeMethods.DrawThemeTextFlags.TextColor | NativeMethods.DrawThemeTextFlags.GlowSize | NativeMethods.DrawThemeTextFlags.Composited), crText = ColorTranslator.ToWin32(foreColor), iGlowSize = glowSize }; NativeMethods.RECT pRect = new NativeMethods.RECT(((Padding)(ref padding)).Left, ((Padding)(ref padding)).Top, bounds.Width - ((Padding)(ref padding)).Right, bounds.Height - ((Padding)(ref padding)).Bottom); NativeMethods.DrawThemeTextEx(val.Handle, safeDeviceHandle, 0, 0, text, text.Length, (int)textFormat, ref pRect, ref pOptions); NativeMethods.BitBlt(hdc, bounds.Left, bounds.Top, bounds.Width, bounds.Height, safeDeviceHandle, 0, 0, 13369376u); } } finally { dc.ReleaseHdc(); } } public static Size MeasureCompositedText(IDeviceContext dc, string text, Font font, TextFormatFlags textFormat) { //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_00a7: Expected I4, but got Unknown if (!IsDwmCompositionEnabled) { throw new NotSupportedException(Resources.GlassNotSupportedError); } if (dc == null) { throw new ArgumentNullException("dc"); } if (text == null) { throw new ArgumentNullException("text"); } if (font == null) { throw new ArgumentNullException("font"); } IntPtr hdc = dc.GetHdc(); try { Rectangle rectangle = new Rectangle(0, 0, int.MaxValue, int.MaxValue); using SafeDeviceHandle safeDeviceHandle = NativeMethods.CreateCompatibleDC(hdc); using SafeGDIHandle hObject = new SafeGDIHandle(font.ToHfont(), ownsHandle: true); using (NativeMethods.CreateDib(rectangle, hdc, safeDeviceHandle)) { NativeMethods.SelectObject(safeDeviceHandle, hObject); VisualStyleRenderer val = new VisualStyleRenderer(Caption.Active); NativeMethods.RECT bounds = new NativeMethods.RECT(rectangle); NativeMethods.GetThemeTextExtent(val.Handle, safeDeviceHandle, 0, 0, text, text.Length, (int)textFormat, ref bounds, out var rect); return new Size(rect.Right - rect.Left, rect.Bottom - rect.Top); } } finally { dc.ReleaseHdc(); } } } public class HyperlinkClickedEventArgs : EventArgs { private string _href; public string Href => _href; public HyperlinkClickedEventArgs(string href) { _href = href; } } [DefaultProperty("MainInstruction")] [DefaultEvent("ButtonClicked")] [Description("A dialog that allows the user to input a single text value.")] public class InputDialog : Component, IBindableComponent, IComponent, IDisposable { private string _mainInstruction; private string _content; private string _windowTitle; private string _input; private int _maxLength = 32767; private bool _usePasswordMasking; private bool _multiLine; private BindingContext _context; private ControlBindingsCollection _bindings; private IContainer components; [Localizable(true)] [Category("Appearance")] [Description("The dialog's main instruction.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string MainInstruction { get { return _mainInstruction ?? string.Empty; } set { _mainInstruction = (string.IsNullOrEmpty(value) ? null : value); } } [Localizable(true)] [Category("Appearance")] [Description("The dialog's primary content.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string Content { get { return _content ?? string.Empty; } set { _content = (string.IsNullOrEmpty(value) ? null : value); } } [Localizable(true)] [Category("Appearance")] [Description("The window title of the task dialog.")] [DefaultValue("")] public string WindowTitle { get { return _windowTitle ?? string.Empty; } set { _windowTitle = (string.IsNullOrEmpty(value) ? null : value); } } [Localizable(true)] [Category("Appearance")] [Description("The text specified by the user.")] [DefaultValue("")] public string Input { get { return _input ?? string.Empty; } set { _input = (value = (string.IsNullOrEmpty(value) ? null : value)); OnInputChanged(EventArgs.Empty); } } [Localizable(true)] [Category("Behavior")] [Description("The maximum number of characters that can be entered into the input field of the dialog.")] [DefaultValue(32767)] public int MaxLength { get { return _maxLength; } set { _maxLength = value; } } [Category("Behavior")] [Description("Indicates whether the input will be masked using the system password character.")] [DefaultValue(false)] public bool UsePasswordMasking { get { return _usePasswordMasking; } set { _usePasswordMasking = value; } } [Category("Behavior")] [Description("Indicates whether the input field will have multiline support.")] [DefaultValue(false)] public bool Multiline { get { return _multiLine; } set { _multiLine = value; } } [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [EditorBrowsable(EditorBrowsableState.Advanced)] public BindingContext BindingContext { get { //IL_000b: 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_0012: Expected O, but got Unknown //IL_0017: Expected O, but got Unknown BindingContext obj = _context; if (obj == null) { BindingContext val = new BindingContext(); BindingContext val2 = val; _context = val; obj = val2; } return obj; } set { _context = value; } } [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Category("Data")] [RefreshProperties(RefreshProperties.All)] [ParenthesizePropertyName(true)] public ControlBindingsCollection DataBindings { get { //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_0013: Expected O, but got Unknown //IL_0018: Expected O, but got Unknown ControlBindingsCollection obj = _bindings; if (obj == null) { ControlBindingsCollection val = new ControlBindingsCollection((IBindableComponent)(object)this); ControlBindingsCollection val2 = val; _bindings = val; obj = val2; } return obj; } } [Category("Property Changed")] [Description("Event raised when the value of the Input property changes.")] public event EventHandler InputChanged; [Category("Action")] [Description("Event raised when the user clicks the OK button on the dialog.")] public event EventHandler<OkButtonClickedEventArgs> OkButtonClicked; public InputDialog() { InitializeComponent(); } public InputDialog(IContainer container) { container?.Add(this); InitializeComponent(); } protected virtual void OnInputChanged(EventArgs e) { if (this.InputChanged != null) { this.InputChanged(this, e); } } protected virtual void OnOkButtonClicked(OkButtonClickedEventArgs e) { if (this.OkButtonClicked != null) { this.OkButtonClicked(this, e); } } public DialogResult ShowDialog() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return ShowDialog(null); } public DialogResult ShowDialog(IWin32Window owner) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) InputDialogForm inputDialogForm = new InputDialogForm(); try { inputDialogForm.MainInstruction = MainInstruction; inputDialogForm.Content = Content; ((Control)inputDialogForm).Text = WindowTitle; inputDialogForm.Input = Input; inputDialogForm.UsePasswordMasking = UsePasswordMasking; inputDialogForm.MaxLength = MaxLength; inputDialogForm.Multiline = Multiline; inputDialogForm.OkButtonClicked += InputBoxForm_OkButtonClicked; DialogResult val = ((Form)inputDialogForm).ShowDialog(owner); if ((int)val == 1) { Input = inputDialogForm.Input; } return val; } finally { ((IDisposable)inputDialogForm)?.Dispose(); } } private void InputBoxForm_OkButtonClicked(object sender, OkButtonClickedEventArgs e) { OnOkButtonClicked(e); } protected override void Dispose(bool disposing) { try { if (disposing && components != null) { components.Dispose(); } } finally { base.Dispose(disposing); } } private void InitializeComponent() { components = new Container(); } } internal class InputDialogForm : ExtendedForm { private SizeF _textMargin = new SizeF(12f, 9f); private string _mainInstruction; private string _content; private IContainer components; private Panel _primaryPanel; private Panel _secondaryPanel; private Button _cancelButton; private Button _okButton; private TextBox _inputTextBox; public string MainInstruction { get { return _mainInstruction; } set { _mainInstruction = value; } } public string Content { get { return _content; } set { _content = value; } } public string Input { get { return ((Control)_inputTextBox).Text; } set { ((Control)_inputTextBox).Text = value; } } public int MaxLength { get { return ((TextBoxBase)_inputTextBox).MaxLength; } set { ((TextBoxBase)_inputTextBox).MaxLength = value; } } public bool UsePasswordMasking { get { return _inputTextBox.UseSystemPasswordChar; } set { _inputTextBox.UseSystemPasswordChar = value; } } public bool Multiline { get { return ((TextBoxBase)_inputTextBox).Multiline; } set { if (value != ((TextBoxBase)_inputTextBox).Multiline) { ((TextBoxBase)_inputTextBox).Multiline = value; if (value) { ((Form)this).AcceptButton = null; int num = ((Control)_inputTextBox).Height * 2; TextBox inputTextBox = _inputTextBox; ((Control)inputTextBox).Top = ((Control)inputTextBox).Top - num; TextBox inputTextBox2 = _inputTextBox; ((Control)inputTextBox2).Height = ((Control)inputTextBox2).Height + num; ((Control)this).Height = ((Control)this).Height + num; } else { ((Form)this).AcceptButton = (IButtonControl)(object)_okButton; int num = ((Control)_inputTextBox).Height / 3 * 2; ((Control)this).Height = ((Control)this).Height - num; TextBox inputTextBox3 = _inputTextBox; ((Control)inputTextBox3).Top = ((Control)inputTextBox3).Top + num; TextBox inputTextBox4 = _inputTextBox; ((Control)inputTextBox4).Height = ((Control)inputTextBox4).Height - num; } } } } public event EventHandler<OkButtonClickedEventArgs> OkButtonClicked; public InputDialogForm() { InitializeComponent(); } public DialogResult ShowDialog(IntPtr owner) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //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) //IL_0031: Unknown result type (might be due to invalid IL or missing references) IntPtr intPtr = ((owner == (IntPtr)0) ? NativeMethods.GetActiveWindow() : owner); NativeWindow val = new NativeWindow(); val.AssignHandle(intPtr); try { return ((Form)this).ShowDialog((IWin32Window)(object)val); } finally { val.ReleaseHandle(); } } protected virtual void OnOkButtonClicked(OkButtonClickedEventArgs e) { if (this.OkButtonClicked != null) { this.OkButtonClicked(this, e); } } protected override void ScaleControl(SizeF factor, BoundsSpecified specified) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) _textMargin = new SizeF(_textMargin.Width * factor.Width, _textMargin.Height * factor.Height); base.ScaleControl(factor, specified); } private void SizeDialog() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown int horizontalSpacing = (int)_textMargin.Width * 2; int verticalSpacing = ((Form)this).ClientSize.Height - ((Control)_inputTextBox).Top + (int)_textMargin.Height * 3; Graphics val = ((Control)_primaryPanel).CreateGraphics(); try { ((Form)this).ClientSize = DialogHelper.SizeDialog((IDeviceContext)(object)val, MainInstruction, Content, Screen.FromControl((Control)(object)this), new Font(((Control)this).Font, (FontStyle)1), ((Control)this).Font, horizontalSpacing, verticalSpacing, ((Form)this).ClientSize.Width, 0); } finally { ((IDisposable)val)?.Dispose(); } } private static void DrawThemeBackground(IDeviceContext dc, VisualStyleElement element, Rectangle bounds, Rectangle clipRectangle) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (DialogHelper.IsTaskDialogThemeSupported) { new VisualStyleRenderer(element).DrawBackground(dc, bounds, clipRectangle); } } private void DrawText(IDeviceContext dc, ref Point location, bool measureOnly, int width) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown DialogHelper.DrawText(dc, MainInstruction, Content, ref location, new Font(((Control)this).Font, (FontStyle)1), ((Control)this).Font, measureOnly, width); } private void _primaryPanel_Paint(object sender, PaintEventArgs e) { DrawThemeBackground((IDeviceContext)(object)e.Graphics, AdditionalVisualStyleElements.TaskDialog.PrimaryPanel, ((Control)_primaryPanel).ClientRectangle, e.ClipRectangle); Point location = new Point((int)_textMargin.Width, (int)_textMargin.Height); DrawText((IDeviceContext)(object)e.Graphics, ref location, measureOnly: false, ((Form)this).ClientSize.Width - (int)_textMargin.Width * 2); } private void _secondaryPanel_Paint(object sender, PaintEventArgs e) { DrawThemeBackground((IDeviceContext)(object)e.Graphics, AdditionalVisualStyleElements.TaskDialog.SecondaryPanel, ((Control)_secondaryPanel).ClientRectangle, e.ClipRectangle); } private void NewInputBoxForm_Load(object sender, EventArgs e) { SizeDialog(); ((Form)this).CenterToScreen(); } private void _okButton_Click(object sender, EventArgs e) { OkButtonClickedEventArgs okButtonClickedEventArgs = new OkButtonClickedEventArgs(((Control)_inputTextBox).Text, (IWin32Window)(object)this); OnOkButtonClicked(okButtonClickedEventArgs); if (!okButtonClickedEventArgs.Cancel) { ((Form)this).DialogResult = (DialogResult)1; } } protected override void Dispose(bool disposing) { if (disposing && components != null) { components.Dispose(); } ((Form)this).Dispose(disposing); } private void InitializeComponent() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(InputDialogForm)); _primaryPanel = new Panel(); _inputTextBox = new TextBox(); _secondaryPanel = new Panel(); _cancelButton = new Button(); _okButton = new Button(); ((Control)_primaryPanel).SuspendLayout(); ((Control)_secondaryPanel).SuspendLayout(); ((Control)this).SuspendLayout(); ((Control)_primaryPanel).Controls.Add((Control)(object)_inputTextBox); componentResourceManager.ApplyResources(_primaryPanel, "_primaryPanel"); ((Control)_primaryPanel).Name = "_primaryPanel"; ((Control)_primaryPanel).Paint += new PaintEventHandler(_primaryPanel_Paint); componentResourceManager.ApplyResources(_inputTextBox, "_inputTextBox"); ((Control)_inputTextBox).Name = "_inputTextBox"; ((Control)_secondaryPanel).Controls.Add((Control)(object)_cancelButton); ((Control)_secondaryPanel).Controls.Add((Control)(object)_okButton); componentResourceManager.ApplyResources(_secondaryPanel, "_secondaryPanel"); ((Control)_secondaryPanel).Name = "_secondaryPanel"; ((Control)_secondaryPanel).Paint += new PaintEventHandler(_secondaryPanel_Paint); componentResourceManager.ApplyResources(_cancelButton, "_cancelButton"); _cancelButton.DialogResult = (DialogResult)2; ((Control)_cancelButton).Name = "_cancelButton"; ((ButtonBase)_cancelButton).UseVisualStyleBackColor = true; componentResourceManager.ApplyResources(_okButton, "_okButton"); ((Control)_okButton).Name = "_okButton"; ((ButtonBase)_okButton).UseVisualStyleBackColor = true; ((Control)_okButton).Click += _okButton_Click; ((Form)this).AcceptButton = (IButtonControl)(object)_okButton; componentResourceManager.ApplyResources(this, "$this"); ((ContainerControl)this).AutoScaleMode = (AutoScaleMode)1; ((Form)this).CancelButton = (IButtonControl)(object)_cancelButton; ((Control)this).Controls.Add((Control)(object)_primaryPanel); ((Control)this).Controls.Add((Control)(object)_secondaryPanel); ((Form)this).FormBorderStyle = (FormBorderStyle)3; ((Form)this).MaximizeBox = false; ((Form)this).MinimizeBox = false; ((Control)this).Name = "InputDialogForm"; ((Form)this).ShowInTaskbar = false; base.UseSystemFont = true; ((Form)this).Load += NewInputBoxForm_Load; ((Control)_primaryPanel).ResumeLayout(false); ((Control)_primaryPanel).PerformLayout(); ((Control)_secondaryPanel).ResumeLayout(false); ((Control)this).ResumeLayout(false); } } internal static class NativeMethods { [Flags] public enum LoadLibraryExFlags : uint { DontResolveDllReferences = 1u, LoadLibraryAsDatafile = 2u, LoadWithAlteredSearchPath = 8u, LoadIgnoreCodeAuthzLevel = 0x10u } public delegate uint TaskDialogCallback(IntPtr hwnd, uint uNotification, IntPtr wParam, IntPtr lParam, IntPtr dwRefData); public enum TaskDialogNotifications { Created, Navigated, ButtonClicked, HyperlinkClicked, Timer, Destroyed, RadioButtonClicked, DialogConstructed, VerificationClicked, Help, ExpandoButtonClicked } [Flags] public enum TaskDialogCommonButtonFlags { OkButton = 1, YesButton = 2, NoButton = 4, CancelButton = 8, RetryButton = 0x10, CloseButton = 0x20 } [Flags] public enum TaskDialogFlags { EnableHyperLinks = 1, UseHIconMain = 2, UseHIconFooter = 4, AllowDialogCancellation = 8, UseCommandLinks = 0x10, UseCommandLinksNoIcon = 0x20, ExpandFooterArea = 0x40, ExpandedByDefault = 0x80, VerificationFlagChecked = 0x100, ShowProgressBar = 0x200, ShowMarqueeProgressBar = 0x400, CallbackTimer = 0x800, PositionRelativeToWindow = 0x1000, RtlLayout = 0x2000, NoDefaultRadioButton = 0x4000, CanBeMinimized = 0x8000 } public enum TaskDialogMessages { NavigatePage = 1125, ClickButton = 1126, SetMarqueeProgressBar = 1127, SetProgressBarState = 1128, SetProgressBarRange = 1129, SetProgressBarPos = 1130, SetProgressBarMarquee = 1131, SetElementText = 1132, ClickRadioButton = 1134, EnableButton = 1135, EnableRadioButton = 1136, ClickVerification = 1137, UpdateElementText = 1138, SetButtonElevationRequiredState = 1139, UpdateIcon = 1140 } public enum TaskDialogElements { Content, ExpandedInformation, Footer, MainInstruction } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct TASKDIALOG_BUTTON { public int nButtonID; [MarshalAs(UnmanagedType.LPWStr)] public string pszButtonText; } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct TASKDIALOGCONFIG { public uint cbSize; public IntPtr hwndParent; public IntPtr hInstance; public TaskDialogFlags dwFlags; public TaskDialogCommonButtonFlags dwCommonButtons; [MarshalAs(UnmanagedType.LPWStr)] public string pszWindowTitle; public IntPtr hMainIcon; [MarshalAs(UnmanagedType.LPWStr)] public string pszMainInstruction; [MarshalAs(UnmanagedType.LPWStr)] public string pszContent; public uint cButtons; public IntPtr pButtons; public int nDefaultButton; public uint cRadioButtons; public IntPtr pRadioButtons; public int nDefaultRadioButton; [MarshalAs(UnmanagedType.LPWStr)] public string pszVerificationText; [MarshalAs(UnmanagedType.LPWStr)] public string pszExpandedInformation; [MarshalAs(UnmanagedType.LPWStr)] public string pszExpandedControlText; [MarshalAs(UnmanagedType.LPWStr)] public string pszCollapsedControlText; public IntPtr hFooterIcon; [MarshalAs(UnmanagedType.LPWStr)] public string pszFooterText; [MarshalAs(UnmanagedType.FunctionPtr)] public TaskDialogCallback pfCallback; public IntPtr lpCallbackData; public uint cxWidth; } public struct ACTCTX { public int cbSize; public uint dwFlags; public string lpSource; public ushort wProcessorArchitecture; public ushort wLangId; public string lpAssemblyDirectory; public string lpResourceName; public string lpApplicationName; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] internal struct COMDLG_FILTERSPEC { [MarshalAs(UnmanagedType.LPWStr)] internal string pszName; [MarshalAs(UnmanagedType.LPWStr)] internal string pszSpec; } internal enum FDAP { FDAP_BOTTOM, FDAP_TOP } internal enum FDE_SHAREVIOLATION_RESPONSE { FDESVR_DEFAULT, FDESVR_ACCEPT, FDESVR_REFUSE } internal enum FDE_OVERWRITE_RESPONSE { FDEOR_DEFAULT, FDEOR_ACCEPT, FDEOR_REFUSE } internal enum SIATTRIBFLAGS { SIATTRIBFLAGS_AND = 1, SIATTRIBFLAGS_OR, SIATTRIBFLAGS_APPCOMPAT } internal enum SIGDN : uint { SIGDN_NORMALDISPLAY = 0u, SIGDN_PARENTRELATIVEPARSING = 2147581953u, SIGDN_DESKTOPABSOLUTEPARSING = 2147647488u, SIGDN_PARENTRELATIVEEDITING = 2147684353u, SIGDN_DESKTOPABSOLUTEEDITING = 2147794944u, SIGDN_FILESYSPATH = 2147844096u, SIGDN_URL = 2147909632u, SIGDN_PARENTRELATIVEFORADDRESSBAR = 2147991553u, SIGDN_PARENTRELATIVE = 2148007937u } [Flags] internal enum FOS : uint { FOS_OVERWRITEPROMPT = 2u, FOS_STRICTFILETYPES = 4u, FOS_NOCHANGEDIR = 8u, FOS_PICKFOLDERS = 0x20u, FOS_FORCEFILESYSTEM = 0x40u, FOS_ALLNONSTORAGEITEMS = 0x80u, FOS_NOVALIDATE = 0x100u, FOS_ALLOWMULTISELECT = 0x200u, FOS_PATHMUSTEXIST = 0x800u, FOS_FILEMUSTEXIST = 0x1000u, FOS_CREATEPROMPT = 0x2000u, FOS_SHAREAWARE = 0x4000u, FOS_NOREADONLYRETURN = 0x8000u, FOS_NOTESTFILECREATE = 0x10000u, FOS_HIDEMRUPLACES = 0x20000u, FOS_HIDEPINNEDPLACES = 0x40000u, FOS_NODEREFERENCELINKS = 0x100000u, FOS_DONTADDTORECENT = 0x2000000u, FOS_FORCESHOWHIDDEN = 0x10000000u, FOS_DEFAULTNOMINIMODE = 0x20000000u } internal enum CDCONTROLSTATE { CDCS_INACTIVE, CDCS_ENABLED, CDCS_VISIBLE } internal enum FFFP_MODE { FFFP_EXACTMATCH, FFFP_NEARESTPARENTMATCH } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] internal struct KNOWNFOLDER_DEFINITION { internal KF_CATEGORY category; [MarshalAs(UnmanagedType.LPWStr)] internal string pszName; [MarshalAs(UnmanagedType.LPWStr)] internal string pszCreator; [MarshalAs(UnmanagedType.LPWStr)] internal string pszDescription; internal Guid fidParent; [MarshalAs(UnmanagedType.LPWStr)] internal string pszRelativePath; [MarshalAs(UnmanagedType.LPWStr)] internal string pszParsingName; [MarshalAs(UnmanagedType.LPWStr)] internal string pszToolTip; [MarshalAs(UnmanagedType.LPWStr)] internal string pszLocalizedName; [MarshalAs(UnmanagedType.LPWStr)] internal string pszIcon; [MarshalAs(UnmanagedType.LPWStr)] internal string pszSecurity; internal uint dwAttributes; internal KF_DEFINITION_FLAGS kfdFlags; internal Guid ftidType; } internal enum KF_CATEGORY { KF_CATEGORY_VIRTUAL = 1, KF_CATEGORY_FIXED, KF_CATEGORY_COMMON, KF_CATEGORY_PERUSER } [Flags] internal enum KF_DEFINITION_FLAGS { KFDF_PERSONALIZE = 1, KFDF_LOCAL_REDIRECT_ONLY = 2, KFDF_ROAMABLE = 4 } [StructLayout(LayoutKind.Sequential, Pack = 4)] internal struct PROPERTYKEY { internal Guid fmtid; internal uint pid; } [Flags] public enum FormatMessageFlags { FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x100, FORMAT_MESSAGE_IGNORE_INSERTS = 0x200, FORMAT_MESSAGE_FROM_STRING = 0x400, FORMAT_MESSAGE_FROM_HMODULE = 0x800, FORMAT_MESSAGE_FROM_SYSTEM = 0x1000, FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x2000 } public enum HitTestResult { Error = -2, Transparent = -1, Nowhere = 0, Client = 1, Caption = 2, SysMenu = 3, GrowBox = 4, Size = 4, Menu = 5, HScroll = 6, VScroll = 7, MinButton = 8, MaxButton = 9, Left = 10, Right = 11, Top = 12, TopLeft = 13, TopRight = 14, Bottom = 15, BottomLeft = 16, BottomRight = 17, Border = 18, Reduce = 8, Zoom = 9, SizeFirst = 10, SizeLast = 17, Object = 19, Close = 20, Help = 21 } public struct MARGINS { public int Left; public int Right; public int Top; public int Bottom; public MARGINS(Padding value) { Left = ((Padding)(ref value)).Left; Right = ((Padding)(ref value)).Right; Top = ((Padding)(ref value)).Top; Bottom = ((Padding)(ref value)).Bottom; } } public struct DTTOPTS { public int dwSize; [MarshalAs(UnmanagedType.U4)] public DrawThemeTextFlags dwFlags; public int crText; public int crBorder; public int crShadow; public int iTextShadowType; public Point ptShadowOffset; public int iBorderSize; public int iFontPropId; public int iColorPropId; public int iStateId; public bool fApplyOverlay; public int iGlowSize; public int pfnDrawTextCallback; public IntPtr lParam; } [Flags] public enum DrawThemeTextFlags { TextColor = 1, BorderColor = 2, ShadowColor = 4, ShadowType = 8, ShadowOffset = 0x10, BorderSize = 0x20, FontProp = 0x40, ColorProp = 0x80, StateId = 0x100, CalcRect = 0x200, ApplyOverlay = 0x400, GlowSize = 0x800, Callback = 0x1000, Composited = 0x2000 } [StructLayout(LayoutKind.Sequential)] public class BITMAPINFO { public int biSize; public int biWidth; public int biHeight; public short biPlanes; public short biBitCount; public int biCompression; public int biSizeImage; public int biXPelsPerMeter; public int biYPelsPerMeter; public int biClrUsed; public int biClrImportant; public byte bmiColors_rgbBlue; public byte bmiColors_rgbGreen; public byte bmiColors_rgbRed; public byte bmiColors_rgbReserved; } public struct RECT { public int Left; public int Top; public int Right; public int Bottom; public RECT(int left, int top, int right, int bottom) { Left = left; Top = top; Right = right; Bottom = bottom; } public RECT(Rectangle rectangle) { Left = rectangle.X; Top = rectangle.Y; Right = rectangle.Right; Bottom = rectangle.Bottom; } public override string ToString() { return "Left: " + Left + ", Top: " + Top + ", Right: " + Right + ", Bottom: " + Bottom; } } [Flags] public enum CREDUI_FLAGS { INCORRECT_PASSWORD = 1, DO_NOT_PERSIST = 2, REQUEST_ADMINISTRATOR = 4, EXCLUDE_CERTIFICATES = 8, REQUIRE_CERTIFICATE = 0x10, SHOW_SAVE_CHECK_BOX = 0x40, ALWAYS_SHOW_UI = 0x80, REQUIRE_SMARTCARD = 0x100, PASSWORD_ONLY_OK = 0x200, VALIDATE_USERNAME = 0x400, COMPLETE_USERNAME = 0x800, PERSIST = 0x1000, SERVER_CREDENTIAL = 0x4000, EXPECT_CONFIRMATION = 0x20000, GENERIC_CREDENTIALS = 0x40000, USERNAME_TARGET_CREDENTIALS = 0x80000, KEEP_USERNAME = 0x100000 } [Flags] public enum CredUIWinFlags { Generic = 1, Checkbox = 2, AutoPackageOnly = 0x10, InCredOnly = 0x20, EnumerateAdmins = 0x100, EnumerateCurrentUser = 0x200, SecurePrompt = 0x1000, Pack32Wow = 0x10000000 } internal enum CredUIReturnCodes { NO_ERROR = 0, ERROR_CANCELLED = 1223, ERROR_NO_SUCH_LOGON_SESSION = 1312, ERROR_NOT_FOUND = 1168, ERROR_INVALID_ACCOUNT_NAME = 1315, ERROR_INSUFFICIENT_BUFFER = 122, ERROR_INVALID_PARAMETER = 87, ERROR_INVALID_FLAGS = 1004 } internal enum CredTypes { CRED_TYPE_GENERIC = 1, CRED_TYPE_DOMAIN_PASSWORD, CRED_TYPE_DOMAIN_CERTIFICATE, CRED_TYPE_DOMAIN_VISIBLE_PASSWORD } internal enum CredPersist { Session = 1, LocalMachine, Enterprise } internal struct CREDUI_INFO { public int cbSize; public IntPtr hwndParent; [MarshalAs(UnmanagedType.LPWStr)] public string pszMessageText; [MarshalAs(UnmanagedType.LPWStr)] public string pszCaptionText; public IntPtr hbmBanner; } public struct CREDENTIAL { public int Flags; public CredTypes Type; [MarshalAs(UnmanagedType.LPWStr)] public string TargetName; [MarshalAs(UnmanagedType.LPWStr)] public string Comment; public long LastWritten; public uint CredentialBlobSize; public IntPtr CredentialBlob; [MarshalAs(UnmanagedType.U4)] public CredPersist Persist; public int AttributeCount; public IntPtr Attributes; [MarshalAs(UnmanagedType.LPWStr)] public string TargetAlias; [MarshalAs(UnmanagedType.LPWStr)] public string UserName; } public const int ErrorFileNotFound = 2; public const int WM_USER = 1024; public const int WM_GETICON = 127; public const int WM_SETICON = 128; public const int ICON_SMALL = 0; public const int ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 4; public const int WM_NCHITTEST = 132; public const int WM_DWMCOMPOSITIONCHANGED = 798; internal const int CREDUI_MAX_USERNAME_LENGTH = 513; internal const int CREDUI_MAX_PASSWORD_LENGTH = 256; public static bool IsWindowsVistaOrLater { get { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { return Environment.OSVersion.Version >= new Version(6, 0, 6000); } return false; } } public static bool IsWindowsXPOrLater { get { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { return Environment.OSVersion.Version >= new Version(5, 1, 2600); } return false; } } [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)] public static extern SafeModuleHandle LoadLibraryEx(string lpFileName, IntPtr hFile, LoadLibraryExFlags dwFlags); [DllImport("kernel32", SetLastError = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool FreeLibrary(IntPtr hModule); [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern IntPtr GetActiveWindow(); [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern bool EnableWindow(IntPtr hwnd, bool bEnable); [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern int GetCurrentThreadId(); [DllImport("comctl32.dll", PreserveSig = false)] public static extern void TaskDialogIndirect([In] ref TASKDIALOGCONFIG pTaskConfig, out int pnButton, out int pnRadioButton, [MarshalAs(UnmanagedType.Bool)] out bool pfVerificationFlagChecked); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam); [DllImport("Kernel32.dll", SetLastError = true)] public static extern ActivationContextSafeHandle CreateActCtx(ref ACTCTX actctx); [DllImport("kernel32.dll")] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static extern void ReleaseActCtx(IntPtr hActCtx); [DllImport("Kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ActivateActCtx(ActivationContextSafeHandle hActCtx, out IntPtr lpCookie); [DllImport("Kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool DeactivateActCtx(uint dwFlags, IntPtr lpCookie); [DllImport("shell32.dll", CharSet = CharSet.Unicode)] public static extern int SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr pbc, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); public static IShellItem CreateItemFromParsingName(string path) { Guid riid = new Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe"); object ppv; int num = SHCreateItemFromParsingName(path, IntPtr.Zero, ref riid, out ppv); if (num != 0) { throw new Win32Exception(num); } return (IShellItem)ppv; } [DllImport("user32.dll", BestFitMapping = false, CharSet = CharSet.Auto, SetLastError = true, ThrowOnUnmappableChar = true)] public static extern int LoadString(SafeModuleHandle hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax); [DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern uint FormatMessage([MarshalAs(UnmanagedType.U4)] FormatMessageFlags dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer, uint nSize, string[] Arguments); [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, [In] ref MARGINS pMarInset); [DllImport("dwmapi.dll", PreserveSig = false)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool DwmIsCompositionEnabled(); [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] public static extern SafeDeviceHandle CreateCompatibleDC(IntPtr hDC); [DllImport("gdi32.dll", ExactSpelling = true)] public static extern IntPtr SelectObject(SafeDeviceHandle hDC, SafeGDIHandle hObject); [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool DeleteObject(IntPtr hObject); [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool DeleteDC(IntPtr hdc); [DllImport("gdi32.dll")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, SafeDeviceHandle hdcSrc, int nXSrc, int nYSrc, uint dwRop); [DllImport("UxTheme.dll", CharSet = CharSet.Unicode, PreserveSig = false)] public static extern void DrawThemeTextEx(IntPtr hTheme, SafeDeviceHandle hdc, int iPartId, int iStateId, string text, int iCharCount, int dwFlags, ref RECT pRect, ref DTTOPTS pOptions); [DllImport("gdi32.dll")] public static extern SafeGDIHandle CreateDIBSection(IntPtr hdc, BITMAPINFO pbmi, uint iUsage, IntPtr ppvBits, IntPtr hSection, uint dwOffset); [DllImport("UxTheme.dll", CharSet = CharSet.Unicode, PreserveSig = false)] public static extern void GetThemeTextExtent(IntPtr hTheme, SafeDeviceHandle hdc, int iPartId, int iStateId, string text, int iCharCount, int dwTextFlags, [In] ref RECT bounds, out RECT rect); public static SafeGDIHandle CreateDib(Rectangle bounds, IntPtr primaryHdc, SafeDeviceHandle memoryHdc) { BITMAPINFO bITMAPINFO = new BITMAPINFO(); bITMAPINFO.biSize = Marshal.SizeOf(bITMAPINFO); bITMAPINFO.biWidth = bounds.Width; bITMAPINFO.biHeight = -bounds.Height; bITMAPINFO.biPlanes = 1; bITMAPINFO.biBitCount = 32; bITMAPINFO.biCompression = 0; SafeGDIHandle safeGDIHandle = CreateDIBSection(primaryHdc, bITMAPINFO, 0u, IntPtr.Zero, IntPtr.Zero, 0u); SelectObject(memoryHdc, safeGDIHandle); return safeGDIHandle; } [DllImport("credui.dll", CharSet = CharSet.Unicode)] internal static extern CredUIReturnCodes CredUIPromptForCredentials(ref CREDUI_INFO pUiInfo, string targetName, IntPtr Reserved, int dwAuthError, StringBuilder pszUserName, uint ulUserNameMaxChars, StringBuilder pszPassword, uint ulPaswordMaxChars, [In][Out][MarshalAs(UnmanagedType.Bool)] ref bool pfSave, CREDUI_FLAGS dwFlags); [DllImport("credui.dll", CharSet = CharSet.Unicode)] public static extern CredUIReturnCodes CredUIPromptForWindowsCredentials(ref CREDUI_INFO pUiInfo, uint dwAuthError, ref uint pulAuthPackage, IntPtr pvInAuthBuffer, uint ulInAuthBufferSize, out IntPtr ppvOutAuthBuffer, out uint pulOutAuthBufferSize, [MarshalAs(UnmanagedType.Bool)] ref bool pfSave, CredUIWinFlags dwFlags); [DllImport("advapi32.dll", CharSet = CharSet.Unicode, EntryPoint = "CredReadW", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CredRead(string TargetName, CredTypes Type, int Flags, out IntPtr Credential); [DllImport("advapi32.dll")] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static extern void CredFree(IntPtr Buffer); [DllImport("advapi32.dll", CharSet = CharSet.Unicode, EntryPoint = "CredDeleteW", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CredDelete(string TargetName, CredTypes Type, int Flags); [DllImport("advapi32.dll", CharSet = CharSet.Unicode, EntryPoint = "CredWriteW", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CredWrite(ref CREDENTIAL Credential, int Flags); [DllImport("credui.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CredPackAuthenticationBuffer(uint dwFlags, string pszUserName, string pszPassword, IntPtr pPackedCredentials, ref uint pcbPackedCredentials); [DllImport("credui.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CredUnPackAuthenticationBuffer(uint dwFlags, IntPtr pAuthBuffer, uint cbAuthBuffer, StringBuilder pszUserName, ref uint pcchMaxUserName, StringBuilder pszDomainName, ref uint pcchMaxDomainName, StringBuilder pszPassword, ref uint pcchMaxPassword); } public class OkButtonClickedEventArgs : CancelEventArgs { private string _input; private IWin32Window _inputBoxWindow; public string Input => _input; public IWin32Window InputBoxWindow => _inputBoxWindow; public OkButtonClickedEventArgs(string input, IWin32Window inputBoxWindow) { _input = input; _inputBoxWindow = inputBoxWindow; } } public enum ProgressBarState { Normal, Error, Paused } public enum ProgressBarStyle { None, ProgressBar, MarqueeProgressBar } [DefaultEvent("DoWork")] [DefaultProperty("Text")] [Description("Represents a dialog that can be used to report progress to the user.")] public class ProgressDialog : Component, IProgress<int>, IProgress<string> { private class ProgressChangedData { public string Text { get; set; } public string Description { get; set; } public object UserState { get; set; } } private string _windowTitle; private string _text; private string _description; private IProgressDialog _dialog; private string _cancellationText; private bool _useCompactPathsForText; private bool _useCompactPathsForDescription; private SafeModuleHandle _currentAnimationModuleHandle; private bool _cancellationPending; private int _percentProgress; private IntPtr _ownerHandle; private IContainer components; private BackgroundWorker _backgroundWorker; [Localizable(true)] [Category("Appearance")] [Description("The text in the progress dialog's title bar.")] [DefaultValue("")] public string WindowTitle { get { return _windowTitle ?? string.Empty; } set { _windowTitle = value; } } [Localizable(true)] [Category("Appearance")] [Description("A short description of the operation being carried out.")] public string Text { get { return _text ?? string.Empty; } set { _text = value; if (_dialog != null) { _dialog.SetLine(1u, Text, UseCompactPathsForText, IntPtr.Zero); } } } [Category("Behavior")] [Description("Indicates whether path strings in the Text property should be compacted if they are too large to fit on one line.")] [DefaultValue(false)] public bool UseCompactPathsForText { get { return _useCompactPathsForText; } set { _useCompactPathsForText = value; if (_dialog != null) { _dialog.SetLine(1u, Text, UseCompactPathsForText, IntPtr.Zero); } } } [Localizable(true)] [Category("Appearance")] [Description("Additional details about the operation being carried out.")] [DefaultValue("")] public string Description { get { return _description ?? string.Empty; } set { _description = value; if (_dialog != null) { _dialog.SetLine(2u, Description, UseCompactPathsForDescription, IntPtr.Zero); } } } [Category("Behavior")] [Description("Indicates whether path strings in the Description property should be compacted if they are too large to fit on one line.")] [DefaultValue(false)] public bool UseCompactPathsForDescription { get { return _useCompactPathsForDescription; } set { _useCompactPathsForDescription = value; if (_dialog != null) { _dialog.SetLine(2u, Description, UseCompactPathsForDescription, IntPtr.Zero); } } } [Localizable(true)] [Category("Appearance")] [Description("The text that will be shown after the Cancel button is pressed.")] [DefaultValue("")] public string CancellationText { get { return _cancellationText ?? string.Empty; } set { _cancellationText = value; } } [Category("Appearance")] [Description("Indicates whether an estimate of the remaining time will be shown.")] [DefaultValue(false)] public bool ShowTimeRemaining { get; set; } [Category("Appearance")] [Description("Indicates whether the dialog has a cancel button. Do not set to false unless absolutely necessary.")] [DefaultValue(true)] public bool ShowCancelButton { get; set; } [Category("Window Style")] [Description("Indicates whether the progress dialog has a minimize button.")] [DefaultValue(true)] public bool MinimizeBox { get; set; } [Browsable(false)] public bool CancellationPending { get { _backgroundWorker.ReportProgress(-1); return _cancellationPending; } } [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public AnimationResource Animation { get; set; } [Category("Appearance")] [Description("Indicates the style of the progress bar.")] [DefaultValue(ProgressBarStyle.ProgressBar)] public ProgressBarStyle ProgressBarStyle { get; set; } [Browsable(false)] public bool IsBusy => _backgroundWorker.IsBusy; public event DoWorkEventHandler DoWork; public event RunWorkerCompletedEventHandler RunWorkerCompleted; public event ProgressChangedEventHandler ProgressChanged; public ProgressDialog() : this(null) { } public ProgressDialog(IContainer container) { container?.Add(this); InitializeComponent(); ProgressBarStyle = ProgressBarStyle.ProgressBar; ShowCancelButton = true; MinimizeBox = true; if (!NativeMethods.IsWindowsVistaOrLater) { Animation = AnimationResource.GetShellAnimation(ShellAnimation.FlyingPapers); } } public void Show() { Show(null); } public void Show(object argument) { RunProgressDialog(IntPtr.Zero, argument); } public void ShowDialog() { ShowDialog(null, null); } public void ShowDialog(IWin32Window owner) { ShowDialog(owner, null); } public void ShowDialog(IntPtr owner) { ShowDialog(owner, null); } public void ShowDialog(IntPtr owner, object argument) { RunProgressDialog((owner == IntPtr.Zero) ? NativeMethods.GetActiveWindow() : owner, argument); } public void ShowDialog(IWin32Window owner, object argument) { RunProgressDialog((owner == null) ? NativeMethods.GetActiveWindow() : owner.Handle, argument); } void IProgress<int>.Report(int value) { ReportProgress(value, null, null, null); } void IProgress<string>.Report(string value) { ReportProgress(_percentProgress, value, null, null); } public void ReportProgress(int percentProgress) { ReportProgress(percentProgress, null, null, null); } public void ReportProgress(int percentProgress, string text, string description) { ReportProgress(percentProgress, text, description, null); } public void ReportProgress(int percentProgress, string text, string description, object userState) { if (percentProgress < 0 || percentProgress > 100) { throw new ArgumentOutOfRangeException("percentProgress"); } if (_dialog == null) { throw new InvalidOperationException(Resources.ProgressDialogNotRunningError); } _percentProgress = percentProgress; _backgroundWorker.ReportProgress(percentProgress, new ProgressChangedData { Text = text, Description = description, UserState = userState }); } protected virtual void OnDoWork(DoWorkEventArgs e) { this.DoWork?.Invoke(this, e); } protected virtual void OnRunWorkerCompleted(RunWorkerCompletedEventArgs e) { this.RunWorkerCompleted?.Invoke(this, e); } protected virtual void OnProgressChanged(ProgressChangedEventArgs e) { this.ProgressChanged?.Invoke(this, e); } private void RunProgressDialog(IntPtr owner, object argument) { if (_backgroundWorker.IsBusy) { throw new InvalidOperationException(Resources.ProgressDialogRunning); } if (Animation != null) { try { _currentAnimationModuleHandle = Animation.LoadLibrary(); } catch (Win32Exception ex) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.AnimationLoadErrorFormat, ex.Message), ex); } catch (FileNotFoundException ex2) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.AnimationLoadErrorFormat, ex2.Message), ex2); } } _cancellationPending = false; _dialog = (Ookii.Dialogs.WinForms.Interop.ProgressDialog)new ProgressDialogRCW(); _dialog.SetTitle(WindowTitle); if (Animation != null) { _dialog.SetAnimation(_currentAnimationModuleHandle, (ushort)Animation.ResourceId); } if (CancellationText.Length > 0) { _dialog.SetCancelMsg(CancellationText, null); } _dialog.SetLine(1u, Text, UseCompactPathsForText, IntPtr.Zero); _dialog.SetLine(2u, Description, UseCompactPathsForDescription, IntPtr.Zero); ProgressDialogFlags progressDialogFlags = ProgressDialogFlags.Normal; if (owner != IntPtr.Zero) { progressDialogFlags |= ProgressDialogFlags.Modal; } switch (ProgressBarStyle) { case ProgressBarStyle.None: progressDialogFlags |= ProgressDialogFlags.NoProgressBar; break; case ProgressBarStyle.MarqueeProgressBar: progressDialogFlags = ((!NativeMethods.IsWindowsVistaOrLater) ? (progressDialogFlags | ProgressDialogFlags.NoProgressBar) : (progressDialogFlags | ProgressDialogFlags.MarqueeProgress)); break; } if (ShowTimeRemaining) { progressDialogFlags |= ProgressDialogFlags.AutoTime; } if (!ShowCancelButton) { progressDialogFlags |= ProgressDialogFlags.NoCancel; } if (!MinimizeBox) { progressDialogFlags |= ProgressDialogFlags.NoMinimize; } _ownerHandle = owner; _dialog.StartProgressDialog(owner, null, progressDialogFlags, IntPtr.Zero); _backgroundWorker.RunWorkerAsync(argument); } private void _backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { OnDoWork(e); } private void _backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _dialog.StopProgressDialog(); Marshal.ReleaseComObject(_dialog); _dialog = null; if (_currentAnimationModuleHandle != null) { _currentAnimationModuleHandle.Dispose(); _currentAnimationModuleHandle = null; } if (_ownerHandle != IntPtr.Zero) { NativeMethods.EnableWindow(_ownerHandle, bEnable: true); } OnRunWorkerCompleted(new RunWorkerCompletedEventArgs((!e.Cancelled && e.Error == null) ? e.Result : null, e.Error, e.Cancelled)); } private void _backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { _cancellationPending = _dialog.HasUserCancelled(); if (e.ProgressPercentage < 0 || e.ProgressPercentage > 100) { return; } _dialog.SetProgress((uint)e.ProgressPercentage, 100u); if (e.UserState is ProgressChangedData progressChangedData) { if (progressChangedData.Text != null) { Text = progressChangedData.Text; } if (progressChangedData.Description != null) { Description = progressChangedData.Description; } OnProgressChanged(new ProgressChangedEventArgs(e.ProgressPercentage, progressChangedData.UserState)); } } protected override void Dispose(bool disposing) { try { if (disposing) { if (components != null) { components.Dispose(); } if (_currentAnimationModuleHandle != null) { _currentAnimationModuleHandle.Dispose(); _currentAnimationModuleHandle = null; } } } finally { base.Dispose(disposing); } } private void InitializeComponent() { _backgroundWorker = new BackgroundWorker(); _backgroundWorker.WorkerReportsProgress = true; _backgroundWorker.WorkerSupportsCancellation = true; _backgroundWorker.DoWork += _backgroundWorker_DoWork; _backgroundWorker.RunWorkerCompleted += _backgroundWorker_RunWorkerCompleted; _backgroundWorker.ProgressChanged += _backgroundWorker_ProgressChanged; } } [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] internal class ActivationContextSafeHandle : SafeHandleZeroOrMinusOneIsInvalid { public ActivationContextSafeHandle() : base(ownsHandle: true) { } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected override bool ReleaseHandle() { NativeMethods.ReleaseActCtx(handle); return true; } } [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] internal class SafeGDIHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeGDIHandle() : base(ownsHandle: true) { } internal SafeGDIHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); } protected override bool ReleaseHandle() { return NativeMethods.DeleteObject(handle); } } [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] internal class SafeDeviceHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeDeviceHandle() : base(ownsHandle: true) { } internal SafeDeviceHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); } protected override bool ReleaseHandle() { return NativeMethods.DeleteDC(handle); } } internal class SafeModuleHandle : SafeHandle { public override bool IsInvalid => handle == IntPtr.Zero; public SafeModuleHandle() : base(IntPtr.Zero, ownsHandle: true) { } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected override bool ReleaseHandle() { return NativeMethods.FreeLibrary(handle); } } public enum ShellAnimation { FileMove = 160, FileCopy = 161, FlyingPapers = 165, SearchGlobe = 166, PermanentDelete = 164, FromRecycleBinDelete = 163, ToRecycleBinDelete = 162, SearchComputer = 152, SearchDocument = 151, SearchFlashlight = 150 } [DefaultProperty("MainInstruction")] [DefaultEvent("ButtonClicked")] [Description("Displays a task dialog.")] [Designer(typeof(TaskDialogDesigner))] public class TaskDialog : Component, IWin32Window { private TaskDialogItemCollection<TaskDialogButton> _buttons; private TaskDialogItemCollection<TaskDialogRadioButton> _radioButtons; private NativeMethods.TASKDIALOGCONFIG _config; private TaskDialogIcon _mainIcon; private Icon _customMainIcon; private Icon _customFooterIcon; private TaskDialogIcon _footerIcon; private Dictionary<int, TaskDialogButton> _buttonsById; private Dictionary<int, TaskDialogRadioButton> _radioButtonsById; private IntPtr _handle; private int _progressBarMarqueeAnimationSpeed = 100; private int _progressBarMinimimum; private int _progressBarMaximum = 100; private int _progressBarValue; private ProgressBarState _progressBarState; private int _inEventHandler; private bool _updatePending; private object _tag; private Icon _windowIcon; private IContainer components; public static bool OSSupportsTaskDialogs => NativeMethods.IsWindowsVistaOrLater; [Localizable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Category("Appearance")] [Description("A list of the buttons on the Task Dialog.")] public TaskDialogItemCollection<TaskDialogButton> Buttons => _buttons ?? (_buttons = new TaskDialogItemCollection<TaskDialogButton>(this)); [Localizable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Category("Appearance")] [Description("A list of the radio buttons on the Task Dialog.")] public TaskDialogItemCollection<TaskDialogRadioButton> RadioButtons => _radioButtons ?? (_radioButtons = new TaskDialogItemCollection<TaskDialogRadioButton>(this)); [Localizable(true)] [Category("Appearance")] [Description("The window title of the task dialog.")] [DefaultValue("")] public string WindowTitle { get { return _config.pszWindowTitle ?? string.Empty; } set { _config.pszWindowTitle = (string.IsNullOrEmpty(value) ? null : value); UpdateDialog(); } } [Localizable(true)] [Category("Appearance")] [Description("The dialog's main instruction.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string MainInstruction { get { return _config.pszMainInstruction ?? string.Empty; } set { _config.pszMainInstruction = (string.IsNullOrEmpty(value) ? null : value); SetElementText(NativeMethods.TaskDialogElements.MainInstruction, MainInstruction); } } [Localizable(true)] [Category("Appearance")] [Description("The dialog's primary content.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string Content { get { return _config.pszContent ?? string.Empty; } set { _config.pszContent = (string.IsNullOrEmpty(value) ? null : value); SetElementText(NativeMethods.TaskDialogElements.Content, Content); } } [Localizable(true)] [Category("Appearance")] [Description("The icon to be used in the title bar of the dialog. Used only when the dialog is shown as a modeless dialog.")] [DefaultValue(null)] public Icon WindowIcon { get { if (IsDialogRunning) { return Icon.FromHandle(NativeMethods.SendMessage(Handle, 127, new IntPtr(0), IntPtr.Zero)); } return _windowIcon; } set { _windowIcon = value; } } [Localizable(true)] [Category("Appearance")] [Description("The icon to display in the task dialog.")] [DefaultValue(TaskDialogIcon.Custom)] public TaskDialogIcon MainIcon { get { return _mainIcon; } set { if (_mainIcon != value) { _mainIcon = value; UpdateDialog(); } } } [Localizable(true)] [Category("Appearance")] [Description("A custom icon to display in the dialog.")] [DefaultValue(null)] public Icon CustomMainIcon { get { return _customMainIcon; } set { if (_customMainIcon != value) { _customMainIcon = value; UpdateDialog(); } } } [Localizable(true)] [Category("Appearance")] [Description("The icon to display in the footer area of the task dialog.")] [DefaultValue(TaskDialogIcon.Custom)] public TaskDialogIcon FooterIcon { get { return _footerIcon; } set { if (_footerIcon != value) { _footerIcon = value; UpdateDialog(); } } } [Localizable(true)] [Category("Appearance")] [Description("A custom icon to display in the footer area of the task dialog.")] [DefaultValue(null)] public Icon CustomFooterIcon { get { return _customFooterIcon; } set { if (_customFooterIcon != value) { _customFooterIcon = value; UpdateDialog(); } } } [Category("Behavior")] [Description("Indicates whether custom buttons should be displayed as normal buttons or command links.")] [DefaultValue(TaskDialogButtonStyle.Standard)] public TaskDialogButtonStyle ButtonStyle { get { if (!GetFlag(NativeMethods.TaskDialogFlags.UseCommandLinksNoIcon)) { if (!GetFlag(NativeMethods.TaskDialogFlags.UseCommandLinks)) { return TaskDialogButtonStyle.Standard; } return TaskDialogButtonStyle.CommandLinks; } return TaskDialogButtonStyle.CommandLinksNoIcon; } set { SetFlag(NativeMethods.TaskDialogFlags.UseCommandLinks, value == TaskDialogButtonStyle.CommandLinks); SetFlag(NativeMethods.TaskDialogFlags.UseCommandLinksNoIcon, value == TaskDialogButtonStyle.CommandLinksNoIcon); UpdateDialog(); } } [Localizable(true)] [Category("Appearance")] [Description("The label for the verification checkbox.")] [DefaultValue("")] public string VerificationText { get { return _config.pszVerificationText ?? string.Empty; } set { string text = (string.IsNullOrEmpty(value) ? null : value); if (_config.pszVerificationText != text) { _config.pszVerificationText = text; UpdateDialog(); } } } [Category("Behavior")] [Description("Indicates whether the verification checkbox is checked ot not.")] [DefaultValue(false)] public bool IsVerificationChecked { get { return GetFlag(NativeMethods.TaskDialogFlags.VerificationFlagChecked); } set { if (value != IsVerificationChecked) { SetFlag(NativeMethods.TaskDialogFlags.VerificationFlagChecked, value); if (IsDialogRunning) { ClickVerification(value, setFocus: false); } } } } [Localizable(true)] [Category("Appearance")] [Description("Additional information to be displayed on the dialog.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string ExpandedInformation { get { return _config.pszExpandedInformation ?? string.Empty; } set { _config.pszExpandedInformation = (string.IsNullOrEmpty(value) ? null : value); SetElementText(NativeMethods.TaskDialogElements.ExpandedInformation, ExpandedInformation); } } [Localizable(true)] [Category("Appearance")] [Description("The text to use for the control for collapsing the expandable information.")] [DefaultValue("")] public string ExpandedControlText { get { return _config.pszExpandedControlText ?? string.Empty; } set { string text = (string.IsNullOrEmpty(value) ? null : value); if (_config.pszExpandedControlText != text) { _config.pszExpandedControlText = text; UpdateDialog(); } } } [Localizable(true)] [Category("Appearance")] [Description("The text to use for the control for expanding the expandable information.")] [DefaultValue("")] public string CollapsedControlText { get { return _config.pszCollapsedControlText ?? string.Empty; } set { string text = (string.IsNullOrEmpty(value) ? null : value); if (_config.pszCollapsedControlText != text) { _config.pszCollapsedControlText = (string.IsNullOrEmpty(value) ? null : value); UpdateDialog(); } } } [Localizable(true)] [Category("Appearance")] [Description("The text to be used in the footer area of the task dialog.")] [DefaultValue("")] [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] public string Footer { get { return _config.pszFooterText ?? string.Empty; } set { _config.pszFooterText = (string.IsNullOrEmpty(value) ? null : value); SetElementText(NativeMethods.TaskDialogElements.Footer, Footer); } } [Localizable(true)] [Category("Appearance")] [Description("the width of the task d
lib/System.Windows.Forms.dll
Decompiled 8 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.ComponentModel.Design; using System.ComponentModel.Design.Serialization; using System.Configuration; using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Design; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Printing; using System.Drawing.Text; using System.Globalization; using System.IO; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Timers; using System.Windows.Forms; using System.Windows.Forms.CarbonInternal; using System.Windows.Forms.ComponentModel.Com2Interop; using System.Windows.Forms.Design; using System.Windows.Forms.Layout; using System.Windows.Forms.PropertyGridInternal; using System.Windows.Forms.RTF; using System.Windows.Forms.Theming; using System.Windows.Forms.Theming.Default; using System.Windows.Forms.Theming.VisualStyles; using System.Windows.Forms.VisualStyles; using System.Windows.Forms.WebBrowserDialogs; using System.Xml; using Accessibility; using Microsoft.Win32; using Mono.Unix.Native; using Mono.WebBrowser; using Mono.WebBrowser.DOM; [assembly: AssemblyDefaultAlias("System.Windows.Forms.dll")] [assembly: AssemblyProduct("MONO Common language infrastructure")] [assembly: AssemblyCopyright("(c) various MONO Authors")] [assembly: SatelliteContractVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.50727.1433")] [assembly: CLSCompliant(true)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: ComVisible(false)] [assembly: AllowPartiallyTrustedCallers] [assembly: AssemblyDelaySign(true)] [assembly: AssemblyKeyFile("../ecma.pub")] [assembly: AssemblyFileVersion("2.0.50727.1433")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: CompilationRelaxations(CompilationRelaxations.NoStringInterning)] [assembly: Dependency("System.Drawing,", LoadHint.Always)] [assembly: Dependency("System,", LoadHint.Always)] [assembly: StringFreezing] [assembly: ComCompatibleVersion(1, 0, 3300, 0)] [assembly: InternalsVisibleTo("UIAutomationWinforms, PublicKey=00240000048000009400000006020000002400005253413100040000110000004bb98b1af6c1df0df8c02c380e116b7a7f0c8c827aecfccddc6e29b7c754cd608b49dfcef4df9699ad182e50f66afa4e68dabc7b6aeeec0aa4719a5f8e0aae8c193080a706adc3443a8356b1f254142034995532ac176398e12a30f6a74a119a89ac47672c9ae24d7e90de686557166e3b873cd707884431a0451d9d6f7fe795")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyTitle("System.Windows.Forms.dll")] [assembly: AssemblyDescription("System.Windows.Forms.dll")] [assembly: AssemblyCompany("MONO development team")] [assembly: PermissionSet(SecurityAction.RequestMinimum, XML = "<PermissionSet class=\"System.Security.PermissionSet\"\nversion=\"1\">\n<IPermission class=\"System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"\nversion=\"1\"\nFlags=\"SkipVerification\"/>\n</PermissionSet>\n")] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] internal static class Consts { public const string MonoVersion = "2.6.5.0"; public const string MonoCompany = "MONO development team"; public const string MonoProduct = "MONO Common language infrastructure"; public const string MonoCopyright = "(c) various MONO Authors"; public const string FxVersion = "2.0.0.0"; public const string VsVersion = "8.0.0.0"; public const string FxFileVersion = "2.0.50727.1433"; public const string VsFileVersion = "8.0.50727.1433"; public const string AssemblyI18N = "I18N, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMicrosoft_VisualStudio = "Microsoft.VisualStudio, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio_Web = "Microsoft.VisualStudio.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMono_Http = "Mono.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Posix = "Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Security = "Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Messaging_RabbitMQ = "Mono.Messaging.RabbitMQ, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyCorlib = "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem = "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Data = "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Design = "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_DirectoryServices = "System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing = "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Messaging = "System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Security = "System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Web = "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Core = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; } namespace System { [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoTODOAttribute : Attribute { private string comment; public string Comment => comment; public MonoTODOAttribute() { } public MonoTODOAttribute(string comment) { this.comment = comment; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoDocumentationNoteAttribute : MonoTODOAttribute { public MonoDocumentationNoteAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoExtensionAttribute : MonoTODOAttribute { public MonoExtensionAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoInternalNoteAttribute : MonoTODOAttribute { public MonoInternalNoteAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoLimitationAttribute : MonoTODOAttribute { public MonoLimitationAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoNotSupportedAttribute : MonoTODOAttribute { public MonoNotSupportedAttribute(string comment) : base(comment) { } } } namespace System.Windows.Forms { internal sealed class Locale { public static string GetText(string msg) { return msg; } public static string GetText(string msg, params object[] args) { return string.Format(GetText(msg), args); } } } namespace System.Resources { [Serializable] public sealed class ResXDataNode : ISerializable { private string name; private object value; private Type type; private ResXFileRef fileRef; private string comment; private Point pos; public string Comment { get { return comment; } set { comment = value; } } public ResXFileRef FileRef => fileRef; public string Name { get { return name; } set { name = value; } } internal object Value => value; public ResXDataNode(string name, object value) : this(name, value, Point.Empty) { } public ResXDataNode(string name, ResXFileRef fileRef) { if (name == null) { throw new ArgumentNullException("name"); } if (fileRef == null) { throw new ArgumentNullException("fileRef"); } if (name.Length == 0) { throw new ArgumentException("name"); } this.name = name; this.fileRef = fileRef; pos = Point.Empty; } internal ResXDataNode(string name, object value, Point position) { if (name == null) { throw new ArgumentNullException("name"); } if (name.Length == 0) { throw new ArgumentException("name"); } Type type = ((value != null) ? value.GetType() : typeof(object)); if (value != null && !type.IsSerializable) { throw new InvalidOperationException($"'{name}' of type '{type}' cannot be added because it is not serializable"); } this.type = type; this.name = name; this.value = value; pos = position; } void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) { si.AddValue("Name", Name); si.AddValue("Comment", Comment); } public Point GetNodePosition() { return pos; } [MonoInternalNote("Move the type parsing process from ResxResourceReader")] public string GetValueTypeName(AssemblyName[] names) { return type.AssemblyQualifiedName; } [MonoInternalNote("Move the type parsing process from ResxResourceReader")] public string GetValueTypeName(ITypeResolutionService typeResolver) { return type.AssemblyQualifiedName; } [MonoInternalNote("Move the value parsing process from ResxResourceReader")] public object GetValue(AssemblyName[] names) { return value; } [MonoInternalNote("Move the value parsing process from ResxResourceReader")] public object GetValue(ITypeResolutionService typeResolver) { return value; } } [Serializable] [TypeConverter(typeof(Converter))] public class ResXFileRef { public class Converter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return (object)sourceType == typeof(string); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return (object)destinationType == typeof(string); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) if (!(value is string)) { return null; } string[] array = Parse((string)value); if (array.Length == 1) { throw new ArgumentException("value"); } Type type = Type.GetType(array[1]); if ((object)type == typeof(string)) { using (TextReader textReader = new StreamReader(encoding: (array.Length <= 2) ? Encoding.Default : Encoding.GetEncoding(array[2]), path: array[0])) { return textReader.ReadToEnd(); } } byte[] array2; using (FileStream fileStream = new FileStream(array[0], FileMode.Open, FileAccess.Read, FileShare.Read)) { array2 = new byte[fileStream.Length]; fileStream.Read(array2, 0, (int)fileStream.Length); } if ((object)type == typeof(byte[])) { return array2; } if ((object)type == typeof(Bitmap) && Path.GetExtension(array[0]) == ".ico") { MemoryStream memoryStream = new MemoryStream(array2); return new Icon((Stream)memoryStream).ToBitmap(); } if ((object)type == typeof(MemoryStream)) { return new MemoryStream(array2); } return Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, new object[1] { new MemoryStream(array2) }, culture); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if ((object)destinationType != typeof(string)) { return base.ConvertTo(context, culture, value, destinationType); } return ((ResXFileRef)value).ToString(); } } private string filename; private string typename; private Encoding textFileEncoding; public string FileName => filename; public Encoding TextFileEncoding => textFileEncoding; public string TypeName => typename; public ResXFileRef(string fileName, string typeName) { if (fileName == null) { throw new ArgumentNullException("fileName"); } if (typeName == null) { throw new ArgumentNullException("typeName"); } filename = fileName; typename = typeName; } public ResXFileRef(string fileName, string typeName, Encoding textFileEncoding) : this(fileName, typeName) { this.textFileEncoding = textFileEncoding; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); if (filename != null) { stringBuilder.Append(filename); } stringBuilder.Append(';'); if (typename != null) { stringBuilder.Append(typename); } if (textFileEncoding != null) { stringBuilder.Append(';'); stringBuilder.Append(textFileEncoding.WebName); } return stringBuilder.ToString(); } internal static string[] Parse(string fileRef) { if (fileRef == null) { throw new ArgumentNullException("fileRef"); } return fileRef.Split(new char[1] { ';' }); } } [Serializable] internal class ResXNullRef { } public class ResXResourceReader : IDisposable, IResourceReader, IEnumerable { private class ResXHeader { private string resMimeType; private string reader; private string version; private string writer; public string ResMimeType { get { return resMimeType; } set { resMimeType = value; } } public string Reader { get { return reader; } set { reader = value; } } public string Version { get { return version; } set { version = value; } } public string Writer { get { return writer; } set { writer = value; } } public bool IsValid { get { if (string.Compare(ResMimeType, ResXResourceWriter.ResMimeType) != 0) { return false; } if (Reader == null || Writer == null) { return false; } string text = Reader.Split(new char[1] { ',' })[0].Trim(); if (text != typeof(ResXResourceReader).FullName) { return false; } string text2 = Writer.Split(new char[1] { ',' })[0].Trim(); if (text2 != typeof(ResXResourceWriter).FullName) { return false; } return true; } } public void Verify() { if (!IsValid) { throw new ArgumentException("Invalid ResX input. Could not find valid \"resheader\" tags for the ResX reader & writer type names."); } } } private string fileName; private Stream stream; private TextReader reader; private Hashtable hasht; private ITypeResolutionService typeresolver; private XmlTextReader xmlReader; private string basepath; private bool useResXDataNodes; private AssemblyName[] assemblyNames; private Hashtable hashtm; public string BasePath { get { return basepath; } set { basepath = value; } } public bool UseResXDataNodes { get { return useResXDataNodes; } set { if (xmlReader != null) { throw new InvalidOperationException(); } useResXDataNodes = value; } } public ResXResourceReader(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } if (!stream.CanRead) { throw new ArgumentException("Stream was not readable."); } this.stream = stream; } public ResXResourceReader(Stream stream, ITypeResolutionService typeResolver) : this(stream) { typeresolver = typeResolver; } public ResXResourceReader(string fileName) { this.fileName = fileName; } public ResXResourceReader(string fileName, ITypeResolutionService typeResolver) : this(fileName) { typeresolver = typeResolver; } public ResXResourceReader(TextReader reader) { this.reader = reader; } public ResXResourceReader(TextReader reader, ITypeResolutionService typeResolver) : this(reader) { typeresolver = typeResolver; } public ResXResourceReader(Stream stream, AssemblyName[] assemblyNames) : this(stream) { this.assemblyNames = assemblyNames; } public ResXResourceReader(string fileName, AssemblyName[] assemblyNames) : this(fileName) { this.assemblyNames = assemblyNames; } public ResXResourceReader(TextReader reader, AssemblyName[] assemblyNames) : this(reader) { this.assemblyNames = assemblyNames; } IEnumerator IEnumerable.GetEnumerator() { return ((IResourceReader)this).GetEnumerator(); } void IDisposable.Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } ~ResXResourceReader() { Dispose(disposing: false); } private void LoadData() { hasht = new Hashtable(); hashtm = new Hashtable(); if (fileName != null) { stream = File.OpenRead(fileName); } try { xmlReader = null; if (stream != null) { xmlReader = new XmlTextReader(stream); } else if (reader != null) { xmlReader = new XmlTextReader(reader); } if (xmlReader == null) { throw new InvalidOperationException("ResourceReader is closed."); } xmlReader.WhitespaceHandling = WhitespaceHandling.None; ResXHeader resXHeader = new ResXHeader(); try { while (xmlReader.Read()) { if (xmlReader.NodeType == XmlNodeType.Element) { switch (xmlReader.LocalName) { case "resheader": ParseHeaderNode(resXHeader); break; case "data": ParseDataNode(meta: false); break; case "metadata": ParseDataNode(meta: true); break; } } } } catch (XmlException innerException) { throw new ArgumentException("Invalid ResX input.", innerException); } catch (Exception ex) { XmlException innerException2 = new XmlException(ex.Message, ex, xmlReader.LineNumber, xmlReader.LinePosition); throw new ArgumentException("Invalid ResX input.", innerException2); } resXHeader.Verify(); } finally { if (fileName != null) { stream.Close(); stream = null; } xmlReader = null; } } private void ParseHeaderNode(ResXHeader header) { string attribute = GetAttribute("name"); if (attribute != null) { if (string.Compare(attribute, "resmimetype", ignoreCase: true) == 0) { header.ResMimeType = GetHeaderValue(); } else if (string.Compare(attribute, "reader", ignoreCase: true) == 0) { header.Reader = GetHeaderValue(); } else if (string.Compare(attribute, "version", ignoreCase: true) == 0) { header.Version = GetHeaderValue(); } else if (string.Compare(attribute, "writer", ignoreCase: true) == 0) { header.Writer = GetHeaderValue(); } } } private string GetHeaderValue() { string text = null; xmlReader.ReadStartElement(); if (xmlReader.NodeType == XmlNodeType.Element) { return xmlReader.ReadElementString(); } return xmlReader.Value.Trim(); } private string GetAttribute(string name) { if (!xmlReader.HasAttributes) { return null; } for (int i = 0; i < xmlReader.AttributeCount; i++) { xmlReader.MoveToAttribute(i); if (string.Compare(xmlReader.Name, name, ignoreCase: true) == 0) { string value = xmlReader.Value; xmlReader.MoveToElement(); return value; } } xmlReader.MoveToElement(); return null; } private string GetDataValue(bool meta, out string comment) { string result = null; comment = null; while (xmlReader.Read() && (xmlReader.NodeType != XmlNodeType.EndElement || !(xmlReader.LocalName == ((!meta) ? "data" : "metadata")))) { if (xmlReader.NodeType == XmlNodeType.Element) { if (xmlReader.Name.Equals("value")) { xmlReader.WhitespaceHandling = WhitespaceHandling.Significant; result = xmlReader.ReadString(); xmlReader.WhitespaceHandling = WhitespaceHandling.None; } else if (xmlReader.Name.Equals("comment")) { xmlReader.WhitespaceHandling = WhitespaceHandling.Significant; comment = xmlReader.ReadString(); xmlReader.WhitespaceHandling = WhitespaceHandling.None; if (xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.LocalName == ((!meta) ? "data" : "metadata")) { break; } } } else { result = xmlReader.Value.Trim(); } } return result; } private void ParseDataNode(bool meta) { Hashtable hashtable = ((!meta || useResXDataNodes) ? hasht : hashtm); Point position = new Point(xmlReader.LineNumber, xmlReader.LinePosition); string attribute = GetAttribute("name"); string attribute2 = GetAttribute("type"); string attribute3 = GetAttribute("mimetype"); Type type = ((attribute2 != null) ? ResolveType(attribute2) : null); if (attribute2 != null && (object)type == null) { throw new ArgumentException($"The type '{attribute2}' of the element '{attribute}' could not be resolved."); } if ((object)type == typeof(ResXNullRef)) { if (useResXDataNodes) { hashtable[attribute] = new ResXDataNode(attribute, null, position); } else { hashtable[attribute] = null; } return; } string comment = null; string dataValue = GetDataValue(meta, out comment); object obj = null; if (attribute3 != null && attribute3.Length > 0) { if (attribute3 == ResXResourceWriter.BinSerializedObjectMimeType) { byte[] buffer = Convert.FromBase64String(dataValue); BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(buffer); obj = binaryFormatter.Deserialize(serializationStream); } else if (attribute3 == ResXResourceWriter.ByteArraySerializedObjectMimeType && (object)type != null) { TypeConverter converter = TypeDescriptor.GetConverter(type); if (converter.CanConvertFrom(typeof(byte[]))) { obj = converter.ConvertFrom(Convert.FromBase64String(dataValue)); } } } else if ((object)type != null) { if ((object)type == typeof(byte[])) { obj = Convert.FromBase64String(dataValue); } else { TypeConverter converter2 = TypeDescriptor.GetConverter(type); if (converter2.CanConvertFrom(typeof(string))) { if (BasePath != null && (object)type == typeof(ResXFileRef)) { string[] array = ResXFileRef.Parse(dataValue); array[0] = Path.Combine(BasePath, array[0]); obj = converter2.ConvertFromInvariantString(string.Join(";", array)); } else { obj = converter2.ConvertFromInvariantString(dataValue); } } } } else { obj = dataValue; } if (attribute == null) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Could not find a name for a resource. The resource value was '{0}'.", new object[1] { obj })); } if (useResXDataNodes) { ResXDataNode resXDataNode = new ResXDataNode(attribute, obj, position); resXDataNode.Comment = comment; hashtable[attribute] = resXDataNode; } else { hashtable[attribute] = obj; } } private Type ResolveType(string type) { if (typeresolver != null) { return typeresolver.GetType(type); } if (assemblyNames != null) { AssemblyName[] array = assemblyNames; foreach (AssemblyName assemblyRef in array) { Assembly assembly = Assembly.Load(assemblyRef); Type type2 = assembly.GetType(type, throwOnError: false); if ((object)type2 != null) { return type2; } } } return Type.GetType(type); } public void Close() { if (reader != null) { reader.Close(); reader = null; } } public IDictionaryEnumerator GetEnumerator() { if (hasht == null) { LoadData(); } return hasht.GetEnumerator(); } protected virtual void Dispose(bool disposing) { if (disposing) { Close(); } } public static ResXResourceReader FromFileContents(string fileContents) { return new ResXResourceReader(new StringReader(fileContents)); } public static ResXResourceReader FromFileContents(string fileContents, ITypeResolutionService typeResolver) { return new ResXResourceReader(new StringReader(fileContents), typeResolver); } public static ResXResourceReader FromFileContents(string fileContents, AssemblyName[] assemblyNames) { return new ResXResourceReader(new StringReader(fileContents), assemblyNames); } public IDictionaryEnumerator GetMetadataEnumerator() { if (hashtm == null) { LoadData(); } return hashtm.GetEnumerator(); } } public class ResXResourceSet : ResourceSet { public ResXResourceSet(Stream stream) { Reader = new ResXResourceReader(stream); base.Table = new Hashtable(); ReadResources(); } public ResXResourceSet(string fileName) { Reader = new ResXResourceReader(fileName); base.Table = new Hashtable(); ReadResources(); } public override Type GetDefaultReader() { return typeof(ResXResourceReader); } public override Type GetDefaultWriter() { return typeof(ResXResourceWriter); } } public class ResXResourceWriter : IDisposable, IResourceWriter { private string filename; private Stream stream; private TextWriter textwriter; private XmlTextWriter writer; private bool written; private string base_path; public static readonly string BinSerializedObjectMimeType = "application/x-microsoft.net.object.binary.base64"; public static readonly string ByteArraySerializedObjectMimeType = "application/x-microsoft.net.object.bytearray.base64"; public static readonly string DefaultSerializedObjectMimeType = BinSerializedObjectMimeType; public static readonly string ResMimeType = "text/microsoft-resx"; public static readonly string ResourceSchema = schema; public static readonly string SoapSerializedObjectMimeType = "application/x-microsoft.net.object.soap.base64"; public static readonly string Version = "2.0"; private static string schema = "\n <xsd:schema id='root' xmlns='' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>\n <xsd:element name='root' msdata:IsDataSet='true'>\n <xsd:complexType>\n <xsd:choice maxOccurs='unbounded'>\n <xsd:element name='data'>\n <xsd:complexType>\n <xsd:sequence>\n <xsd:element name='value' type='xsd:string' minOccurs='0' msdata:Ordinal='1' />\n <xsd:element name='comment' type='xsd:string' minOccurs='0' msdata:Ordinal='2' />\n </xsd:sequence>\n <xsd:attribute name='name' type='xsd:string' msdata:Ordinal='1' />\n <xsd:attribute name='type' type='xsd:string' msdata:Ordinal='3' />\n <xsd:attribute name='mimetype' type='xsd:string' msdata:Ordinal='4' />\n </xsd:complexType>\n </xsd:element>\n <xsd:element name='resheader'>\n <xsd:complexType>\n <xsd:sequence>\n <xsd:element name='value' type='xsd:string' minOccurs='0' msdata:Ordinal='1' />\n </xsd:sequence>\n <xsd:attribute name='name' type='xsd:string' use='required' />\n </xsd:complexType>\n </xsd:element>\n </xsd:choice>\n </xsd:complexType>\n </xsd:element>\n </xsd:schema>\n".Replace("'", "\""); public string BasePath { get { return base_path; } set { base_path = value; } } public ResXResourceWriter(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } if (!stream.CanWrite) { throw new ArgumentException("stream is not writable.", "stream"); } this.stream = stream; } public ResXResourceWriter(TextWriter textWriter) { if (textWriter == null) { throw new ArgumentNullException("textWriter"); } textwriter = textWriter; } public ResXResourceWriter(string fileName) { if (fileName == null) { throw new ArgumentNullException("fileName"); } filename = fileName; } ~ResXResourceWriter() { Dispose(disposing: false); } private void InitWriter() { if (filename != null) { stream = File.OpenWrite(filename); } if (textwriter == null) { textwriter = new StreamWriter(stream, Encoding.UTF8); } writer = new XmlTextWriter(textwriter); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement("root"); writer.WriteRaw(schema); WriteHeader("resmimetype", "text/microsoft-resx"); WriteHeader("version", "1.3"); WriteHeader("reader", typeof(ResXResourceReader).AssemblyQualifiedName); WriteHeader("writer", typeof(ResXResourceWriter).AssemblyQualifiedName); } private void WriteHeader(string name, string value) { writer.WriteStartElement("resheader"); writer.WriteAttributeString("name", name); writer.WriteStartElement("value"); writer.WriteString(value); writer.WriteEndElement(); writer.WriteEndElement(); } private void WriteNiceBase64(byte[] value, int offset, int length) { string text = Convert.ToBase64String(value, offset, length); StringBuilder stringBuilder = new StringBuilder(text, text.Length + (text.Length + 160) / 80 * 3); int i = 0; int num = 80 + Environment.NewLine.Length + 1; string value2 = Environment.NewLine + "\t"; for (; i < stringBuilder.Length; i += num) { stringBuilder.Insert(i, value2); } stringBuilder.Insert(stringBuilder.Length, Environment.NewLine); writer.WriteString(stringBuilder.ToString()); } private void WriteBytes(string name, Type type, byte[] value, int offset, int length) { WriteBytes(name, type, value, offset, length, string.Empty); } private void WriteBytes(string name, Type type, byte[] value, int offset, int length, string comment) { writer.WriteStartElement("data"); writer.WriteAttributeString("name", name); if ((object)type != null) { writer.WriteAttributeString("type", type.AssemblyQualifiedName); if ((object)type != typeof(byte[])) { writer.WriteAttributeString("mimetype", ByteArraySerializedObjectMimeType); } writer.WriteStartElement("value"); WriteNiceBase64(value, offset, length); } else { writer.WriteAttributeString("mimetype", BinSerializedObjectMimeType); writer.WriteStartElement("value"); writer.WriteBase64(value, offset, length); } writer.WriteEndElement(); if (comment != null && !comment.Equals(string.Empty)) { writer.WriteStartElement("comment"); writer.WriteString(comment); writer.WriteEndElement(); } writer.WriteEndElement(); } private void WriteBytes(string name, Type type, byte[] value) { WriteBytes(name, type, value, 0, value.Length); } private void WriteString(string name, string value) { WriteString(name, value, null); } private void WriteString(string name, string value, Type type) { WriteString(name, value, type, string.Empty); } private void WriteString(string name, string value, Type type, string comment) { writer.WriteStartElement("data"); writer.WriteAttributeString("name", name); if ((object)type != null) { writer.WriteAttributeString("type", type.AssemblyQualifiedName); } writer.WriteStartElement("value"); writer.WriteString(value); writer.WriteEndElement(); if (comment != null && !comment.Equals(string.Empty)) { writer.WriteStartElement("comment"); writer.WriteString(comment); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteWhitespace("\n "); } public void AddResource(string name, byte[] value) { if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (written) { throw new InvalidOperationException("The resource is already generated."); } if (writer == null) { InitWriter(); } WriteBytes(name, value.GetType(), value); } public void AddResource(string name, object value) { AddResource(name, value, string.Empty); } private void AddResource(string name, object value, string comment) { if (value is string) { AddResource(name, (string)value); return; } if (value is byte[]) { AddResource(name, (byte[])value); return; } if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (!value.GetType().IsSerializable) { throw new InvalidOperationException($"The element '{name}' of type '{value.GetType().Name}' is not serializable."); } if (written) { throw new InvalidOperationException("The resource is already generated."); } if (writer == null) { InitWriter(); } TypeConverter converter = TypeDescriptor.GetConverter(value); if (converter != null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) { string value2 = converter.ConvertToInvariantString(value); WriteString(name, value2, value.GetType()); return; } if (converter != null && converter.CanConvertTo(typeof(byte[])) && converter.CanConvertFrom(typeof(byte[]))) { byte[] value3 = (byte[])converter.ConvertTo(value, typeof(byte[])); WriteBytes(name, value.GetType(), value3); return; } MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); try { binaryFormatter.Serialize(memoryStream, value); } catch (Exception ex) { throw new InvalidOperationException(string.Concat("Cannot add a ", value.GetType(), "because it cannot be serialized: ", ex.Message)); } WriteBytes(name, null, memoryStream.GetBuffer(), 0, (int)memoryStream.Length, comment); memoryStream.Close(); } public void AddResource(string name, string value) { if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (written) { throw new InvalidOperationException("The resource is already generated."); } if (writer == null) { InitWriter(); } WriteString(name, value); } [MonoTODO("Stub, not implemented")] public virtual void AddAlias(string aliasName, AssemblyName assemblyName) { } public void AddResource(ResXDataNode node) { AddResource(node.Name, node.Value, node.Comment); } public void AddMetadata(string name, string value) { if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (written) { throw new InvalidOperationException("The resource is already generated."); } if (writer == null) { InitWriter(); } writer.WriteStartElement("metadata"); writer.WriteAttributeString("name", name); writer.WriteAttributeString("xml:space", "preserve"); writer.WriteElementString("value", value); writer.WriteEndElement(); } public void AddMetadata(string name, byte[] value) { if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (written) { throw new InvalidOperationException("The resource is already generated."); } if (writer == null) { InitWriter(); } writer.WriteStartElement("metadata"); writer.WriteAttributeString("name", name); writer.WriteAttributeString("type", value.GetType().AssemblyQualifiedName); writer.WriteStartElement("value"); WriteNiceBase64(value, 0, value.Length); writer.WriteEndElement(); writer.WriteEndElement(); } public void AddMetadata(string name, object value) { if (value is string) { AddMetadata(name, (string)value); return; } if (value is byte[]) { AddMetadata(name, (byte[])value); return; } if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } if (!value.GetType().IsSerializable) { throw new InvalidOperationException($"The element '{name}' of type '{value.GetType().Name}' is not serializable."); } if (written) { throw new InvalidOperationException("The resource is already generated."); } if (writer == null) { InitWriter(); } Type type = value.GetType(); TypeConverter converter = TypeDescriptor.GetConverter(value); if (converter != null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string))) { string text = converter.ConvertToInvariantString(value); writer.WriteStartElement("metadata"); writer.WriteAttributeString("name", name); if ((object)type != null) { writer.WriteAttributeString("type", type.AssemblyQualifiedName); } writer.WriteStartElement("value"); writer.WriteString(text); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteWhitespace("\n "); return; } if (converter != null && converter.CanConvertTo(typeof(byte[])) && converter.CanConvertFrom(typeof(byte[]))) { byte[] array = (byte[])converter.ConvertTo(value, typeof(byte[])); writer.WriteStartElement("metadata"); writer.WriteAttributeString("name", name); if ((object)type != null) { writer.WriteAttributeString("type", type.AssemblyQualifiedName); writer.WriteAttributeString("mimetype", ByteArraySerializedObjectMimeType); writer.WriteStartElement("value"); WriteNiceBase64(array, 0, array.Length); } else { writer.WriteAttributeString("mimetype", BinSerializedObjectMimeType); writer.WriteStartElement("value"); writer.WriteBase64(array, 0, array.Length); } writer.WriteEndElement(); writer.WriteEndElement(); return; } MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); try { binaryFormatter.Serialize(memoryStream, value); } catch (Exception ex) { throw new InvalidOperationException(string.Concat("Cannot add a ", value.GetType(), "because it cannot be serialized: ", ex.Message)); } writer.WriteStartElement("metadata"); writer.WriteAttributeString("name", name); if ((object)type != null) { writer.WriteAttributeString("type", type.AssemblyQualifiedName); writer.WriteAttributeString("mimetype", ByteArraySerializedObjectMimeType); writer.WriteStartElement("value"); WriteNiceBase64(memoryStream.GetBuffer(), 0, memoryStream.GetBuffer().Length); } else { writer.WriteAttributeString("mimetype", BinSerializedObjectMimeType); writer.WriteStartElement("value"); writer.WriteBase64(memoryStream.GetBuffer(), 0, memoryStream.GetBuffer().Length); } writer.WriteEndElement(); writer.WriteEndElement(); memoryStream.Close(); } public void Close() { if (!written) { Generate(); } if (writer != null) { writer.Close(); stream = null; filename = null; textwriter = null; } } public virtual void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } public void Generate() { if (written) { throw new InvalidOperationException("The resource is already generated."); } written = true; writer.WriteEndElement(); writer.Flush(); } protected virtual void Dispose(bool disposing) { if (disposing) { Close(); } } } } namespace System.Windows.Forms.Design { [ToolboxItem(false)] [ClassInterface(ClassInterfaceType.AutoDispatch)] [ComVisible(true)] public class ComponentEditorForm : Form { [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public new virtual bool AutoSize { get { return base.AutoSize; } set { base.AutoSize = value; } } [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public new event EventHandler AutoSizeChanged { add { base.AutoSizeChanged += value; } remove { base.AutoSizeChanged -= value; } } [MonoTODO] public ComponentEditorForm(object component, Type[] pageTypes) { } [MonoTODO] protected override void OnActivated(EventArgs e) { } [MonoTODO] protected virtual void OnSelChangeSelector(object source, TreeViewEventArgs e) { } [MonoTODO] public override bool PreProcessMessage(ref Message msg) { throw new NotImplementedException(); } [MonoTODO] public virtual DialogResult ShowForm() { throw new NotImplementedException(); } [MonoTODO] public virtual DialogResult ShowForm(int page) { throw new NotImplementedException(); } [MonoTODO] public virtual DialogResult ShowForm(IWin32Window owner) { throw new NotImplementedException(); } [MonoTODO] public virtual DialogResult ShowForm(IWin32Window owner, int page) { throw new NotImplementedException(); } [MonoTODO] protected override void OnHelpRequested(HelpEventArgs e) { } } [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDispatch)] public abstract class ComponentEditorPage : Panel { private bool commitOnDeactivate; private IComponent component; private bool firstActivate = true; private Icon icon; private int loading; private bool loadRequired; private IComponentEditorPageSite pageSite; [EditorBrowsable(EditorBrowsableState.Never)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false)] public new virtual bool AutoSize { get { return base.AutoSize; } set { base.AutoSize = value; } } public bool CommitOnDeactivate { get { return commitOnDeactivate; } set { commitOnDeactivate = value; } } protected IComponent Component { get { return component; } set { component = value; } } [MonoTODO("Find out what this does.")] protected override CreateParams CreateParams { get { throw new NotImplementedException(); } } protected bool FirstActivate { get { return firstActivate; } set { firstActivate = value; } } public Icon Icon { get { return icon; } set { icon = value; } } protected int Loading { get { return loading; } set { loading = value; } } protected bool LoadRequired { get { return loadRequired; } set { loadRequired = value; } } protected IComponentEditorPageSite PageSite { get { return pageSite; } set { pageSite = value; } } public virtual string Title => base.Text; [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public new event EventHandler AutoSizeChanged { add { base.AutoSizeChanged += value; } remove { base.AutoSizeChanged -= value; } } public ComponentEditorPage() { } public virtual void Activate() { base.Visible = true; firstActivate = false; if (loadRequired) { EnterLoadingMode(); LoadComponent(); ExitLoadingMode(); } } public virtual void ApplyChanges() { SaveComponent(); } public virtual void Deactivate() { base.Visible = false; } protected void EnterLoadingMode() { loading++; } protected void ExitLoadingMode() { loading--; } public virtual Control GetControl() { return this; } protected IComponent GetSelectedComponent() { return component; } protected bool IsFirstActivate() { return firstActivate; } protected bool IsLoading() { return loading != 0; } public virtual bool IsPageMessage(ref Message msg) { return PreProcessMessage(ref msg); } protected abstract void LoadComponent(); [MonoTODO("Find out what this does.")] public virtual void OnApplyComplete() { } protected virtual void ReloadComponent() { loadRequired = true; } protected abstract void SaveComponent(); public virtual void SetComponent(IComponent component) { this.component = component; ReloadComponent(); } [MonoTODO("Find out what this does.")] protected virtual void SetDirty() { } public virtual void SetSite(IComponentEditorPageSite site) { pageSite = site; pageSite.GetControl().Controls.Add(this); } public virtual void ShowHelp() { } public virtual bool SupportsHelp() { return false; } } public class EventsTab : PropertyTab { private IServiceProvider serviceProvider; public override string HelpKeyword => TabName; public override string TabName => Locale.GetText("Events"); private EventsTab() { } public EventsTab(IServiceProvider sp) { serviceProvider = sp; } public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attributes) { IEventBindingService eventBindingService = null; EventDescriptorCollection eventDescriptorCollection = null; if (serviceProvider != null) { eventBindingService = (IEventBindingService)serviceProvider.GetService(typeof(IEventBindingService)); } if (eventBindingService == null) { return new PropertyDescriptorCollection(null); } eventDescriptorCollection = ((attributes == null) ? TypeDescriptor.GetEvents(component) : TypeDescriptor.GetEvents(component, attributes)); return eventBindingService.GetEventProperties(eventDescriptorCollection); } public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes) { return GetProperties(null, component, attributes); } public override bool CanExtend(object extendee) { return false; } public override PropertyDescriptor GetDefaultProperty(object obj) { if (serviceProvider == null) { return null; } EventDescriptor defaultEvent = TypeDescriptor.GetDefaultEvent(obj); IEventBindingService eventBindingService = (IEventBindingService)serviceProvider.GetService(typeof(IEventBindingService)); if (defaultEvent != null && eventBindingService != null) { return eventBindingService.GetEventProperty(defaultEvent); } return null; } } [Guid("06a9c74b-5e32-4561-be73-381b37869f4f")] public interface IUIService { IDictionary Styles { get; } bool CanShowComponentEditor(object component); IWin32Window GetDialogOwnerWindow(); void SetUIDirty(); bool ShowComponentEditor(object component, IWin32Window parent); void ShowError(Exception ex); void ShowError(string message); void ShowError(Exception ex, string message); DialogResult ShowDialog(Form form); void ShowMessage(string message); void ShowMessage(string message, string caption); DialogResult ShowMessage(string message, string caption, MessageBoxButtons buttons); bool ShowToolWindow(Guid toolWindow); } public interface IWindowsFormsEditorService { void CloseDropDown(); void DropDownControl(Control control); DialogResult ShowDialog(Form dialog); } public abstract class PropertyTab : IExtenderProvider { private Bitmap bitmap; private object[] components; public virtual Bitmap Bitmap { get { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if (bitmap == null) { Type type = GetType(); bitmap = new Bitmap(type, type.Name + ".bmp"); } return bitmap; } } public virtual object[] Components { get { return components; } set { components = value; } } public virtual string HelpKeyword => TabName; public abstract string TabName { get; } ~PropertyTab() { Dispose(disposing: false); } public virtual bool CanExtend(object extendee) { return true; } public virtual void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing && bitmap != null) { ((Image)bitmap).Dispose(); bitmap = null; } } public virtual PropertyDescriptor GetDefaultProperty(object component) { return TypeDescriptor.GetDefaultProperty(component); } public virtual PropertyDescriptorCollection GetProperties(object component) { return GetProperties(component, null); } public abstract PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes); public virtual PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attributes) { return GetProperties(component, attributes); } } [Flags] public enum ToolStripItemDesignerAvailability { None = 0, ToolStrip = 1, MenuStrip = 2, ContextMenuStrip = 4, StatusStrip = 8, All = 0xF } [AttributeUsage(AttributeTargets.Class)] public sealed class ToolStripItemDesignerAvailabilityAttribute : Attribute { private ToolStripItemDesignerAvailability visibility; public static readonly ToolStripItemDesignerAvailabilityAttribute Default = new ToolStripItemDesignerAvailabilityAttribute(); public ToolStripItemDesignerAvailability ItemAdditionVisibility => visibility; public ToolStripItemDesignerAvailabilityAttribute() { visibility = ToolStripItemDesignerAvailability.None; } public ToolStripItemDesignerAvailabilityAttribute(ToolStripItemDesignerAvailability visibility) { this.visibility = visibility; } public override bool Equals(object obj) { if (!(obj is ToolStripItemDesignerAvailabilityAttribute)) { return false; } return ItemAdditionVisibility == (obj as ToolStripItemDesignerAvailabilityAttribute).ItemAdditionVisibility; } public override int GetHashCode() { return (int)visibility; } public override bool IsDefaultAttribute() { return visibility == ToolStripItemDesignerAvailability.None; } } public abstract class WindowsFormsComponentEditor : ComponentEditor { public override bool EditComponent(ITypeDescriptorContext context, object component) { return EditComponent(context, component, null); } public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner) { ComponentEditorForm componentEditorForm = new ComponentEditorForm(component, GetComponentEditorPages()); if (componentEditorForm.ShowForm(owner, GetInitialComponentEditorPageIndex()) == DialogResult.OK) { return true; } return false; } public bool EditComponent(object component, IWin32Window owner) { return EditComponent(null, component, owner); } protected virtual Type[] GetComponentEditorPages() { return null; } protected virtual int GetInitialComponentEditorPageIndex() { return 0; } } } namespace System.Windows.Forms { internal class DebugHelper { private struct Data { public MethodBase method; public object[] args; public Data(MethodBase m, object[] a) { method = m; args = a; } } private static Stack<Data> methods; static DebugHelper() { methods = new Stack<Data>(); Debug.AutoFlush = true; } [Conditional("DEBUG")] internal static void DumpCallers() { StackTrace stackTrace = new StackTrace(fNeedFileInfo: true); int frameCount = stackTrace.FrameCount; for (int i = 1; i < frameCount; i++) { StackFrame frame = stackTrace.GetFrame(i); MethodBase method = frame.GetMethod(); string fileName = frame.GetFileName(); if (fileName != null && fileName.Length > 1) { fileName = fileName.Substring(fileName.LastIndexOf(Path.DirectorySeparatorChar) + 1); } } } [Conditional("DEBUG")] internal static void DumpCallers(int count) { StackTrace stackTrace = new StackTrace(fNeedFileInfo: true); int num = ((count <= stackTrace.FrameCount) ? count : stackTrace.FrameCount); for (int i = 1; i < num; i++) { StackFrame frame = stackTrace.GetFrame(i); MethodBase method = frame.GetMethod(); string fileName = frame.GetFileName(); if (fileName != null && fileName.Length > 1) { fileName = fileName.Substring(fileName.LastIndexOf(Path.DirectorySeparatorChar) + 1); } } } [Conditional("DEBUG")] internal static void Enter() { StackTrace stackTrace = new StackTrace(); methods.Push(new Data(stackTrace.GetFrame(1).GetMethod(), null)); } [Conditional("DEBUG")] internal static void Enter(object[] args) { StackTrace stackTrace = new StackTrace(); methods.Push(new Data(stackTrace.GetFrame(1).GetMethod(), args)); } [Conditional("DEBUG")] internal static void Leave() { if (methods.Count > 0) { methods.Pop(); } } [Conditional("DEBUG")] internal static void Print() { if (methods.Count != 0) { Data data = methods.Peek(); } } [Conditional("DEBUG")] internal static void Print(int index) { if (methods.Count != 0 && methods.Count > index && index >= 0) { Stack<Data> stack = new Stack<Data>(index - 1); for (int i = 0; i < index; i++) { stack.Push(methods.Pop()); } Data data = methods.Peek(); for (int j = 0; j < stack.Count; j++) { methods.Push(stack.Pop()); } stack = null; } } [Conditional("DEBUG")] internal static void Print(string methodName, string parameterName) { if (methods.Count == 0) { return; } Stack<Data> stack = new Stack<Data>(); Data data = methods.Peek(); bool flag = false; for (int i = 0; i < methods.Count; i++) { data = methods.Peek(); if (data.method.Name.Equals(methodName)) { flag = true; break; } stack.Push(methods.Pop()); } for (int j = 0; j < stack.Count; j++) { methods.Push(stack.Pop()); } stack = null; if (!flag) { return; } ParameterInfo[] parameters = data.method.GetParameters(); for (int k = 0; k < parameters.Length; k++) { if (!(parameters[k].Name == parameterName) || (object)parameters[k].ParameterType == typeof(IntPtr)) { } } } [Conditional("DEBUG")] internal static void Print(string parameterName) { if (methods.Count == 0) { return; } ParameterInfo[] parameters = methods.Peek().method.GetParameters(); for (int i = 0; i < parameters.Length; i++) { if (!(parameters[i].Name == parameterName) || (object)parameters[i].ParameterType == typeof(IntPtr)) { } } } [Conditional("DEBUG")] internal static void WriteLine(object arg) { } [Conditional("DEBUG")] internal static void WriteLine(string format, params object[] arg) { } [Conditional("DEBUG")] internal static void WriteLine(string message) { } [Conditional("DEBUG")] internal static void Indent() { } [Conditional("DEBUG")] internal static void Unindent() { } [Conditional("TRACE")] internal static void TraceWriteLine(string format, params object[] arg) { } [Conditional("TRACE")] internal static void TraceWriteLine(string message) { } } } namespace System.Windows.Forms.PropertyGridInternal { public class PropertiesTab : PropertyTab { public override string HelpKeyword => "vs.properties"; public override string TabName => "Properties"; public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes) { return GetProperties(null, component, attributes); } public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attributes) { if (component == null) { return new PropertyDescriptorCollection(null); } if (attributes == null) { attributes = new Attribute[1] { BrowsableAttribute.Yes }; } PropertyDescriptorCollection propertyDescriptorCollection = null; TypeConverter converter = TypeDescriptor.GetConverter(component); if (converter != null && converter.GetPropertiesSupported()) { propertyDescriptorCollection = converter.GetProperties(context, component, attributes); } if (propertyDescriptorCollection == null) { propertyDescriptorCollection = TypeDescriptor.GetProperties(component, attributes); } return propertyDescriptorCollection; } public override PropertyDescriptor GetDefaultProperty(object obj) { if (obj == null) { return null; } return TypeDescriptor.GetDefaultProperty(obj); } } } namespace System.Windows.Forms.RTF { internal class Charcode { private StandardCharCode[] codes; private Hashtable reverse; private int size; private static Charcode ansi_generic; public int this[StandardCharCode c] { get { object obj = reverse[c]; if (obj != null) { return (int)obj; } for (int i = 0; i < size; i++) { if (codes[i] == c) { return i; } } return -1; } } public StandardCharCode this[int c] { get { if (c < 0 || c >= size) { return StandardCharCode.nothing; } return codes[c]; } private set { if (c >= 0 && c < size) { codes[c] = value; reverse[value] = c; } } } public static Charcode AnsiGeneric { get { if (ansi_generic != null) { return ansi_generic; } ansi_generic = new Charcode(256); ansi_generic[6] = StandardCharCode.formula; ansi_generic[30] = StandardCharCode.nobrkhyphen; ansi_generic[31] = StandardCharCode.opthyphen; ansi_generic[32] = StandardCharCode.space; ansi_generic[33] = StandardCharCode.exclam; ansi_generic[34] = StandardCharCode.quotedbl; ansi_generic[35] = StandardCharCode.numbersign; ansi_generic[36] = StandardCharCode.dollar; ansi_generic[37] = StandardCharCode.percent; ansi_generic[38] = StandardCharCode.ampersand; ansi_generic[92] = StandardCharCode.quoteright; ansi_generic[40] = StandardCharCode.parenleft; ansi_generic[41] = StandardCharCode.parenright; ansi_generic[42] = StandardCharCode.asterisk; ansi_generic[43] = StandardCharCode.plus; ansi_generic[44] = StandardCharCode.comma; ansi_generic[45] = StandardCharCode.hyphen; ansi_generic[46] = StandardCharCode.period; ansi_generic[47] = StandardCharCode.slash; ansi_generic[48] = StandardCharCode.zero; ansi_generic[49] = StandardCharCode.one; ansi_generic[50] = StandardCharCode.two; ansi_generic[51] = StandardCharCode.three; ansi_generic[52] = StandardCharCode.four; ansi_generic[53] = StandardCharCode.five; ansi_generic[54] = StandardCharCode.six; ansi_generic[55] = StandardCharCode.seven; ansi_generic[56] = StandardCharCode.eight; ansi_generic[57] = StandardCharCode.nine; ansi_generic[58] = StandardCharCode.colon; ansi_generic[59] = StandardCharCode.semicolon; ansi_generic[60] = StandardCharCode.less; ansi_generic[61] = StandardCharCode.equal; ansi_generic[62] = StandardCharCode.greater; ansi_generic[63] = StandardCharCode.question; ansi_generic[64] = StandardCharCode.at; ansi_generic[65] = StandardCharCode.A; ansi_generic[66] = StandardCharCode.B; ansi_generic[67] = StandardCharCode.C; ansi_generic[68] = StandardCharCode.D; ansi_generic[69] = StandardCharCode.E; ansi_generic[70] = StandardCharCode.F; ansi_generic[71] = StandardCharCode.G; ansi_generic[72] = StandardCharCode.H; ansi_generic[73] = StandardCharCode.I; ansi_generic[74] = StandardCharCode.J; ansi_generic[75] = StandardCharCode.K; ansi_generic[76] = StandardCharCode.L; ansi_generic[77] = StandardCharCode.M; ansi_generic[78] = StandardCharCode.N; ansi_generic[79] = StandardCharCode.O; ansi_generic[80] = StandardCharCode.P; ansi_generic[81] = StandardCharCode.Q; ansi_generic[82] = StandardCharCode.R; ansi_generic[83] = StandardCharCode.S; ansi_generic[84] = StandardCharCode.T; ansi_generic[85] = StandardCharCode.U; ansi_generic[86] = StandardCharCode.V; ansi_generic[87] = StandardCharCode.W; ansi_generic[88] = StandardCharCode.X; ansi_generic[89] = StandardCharCode.Y; ansi_generic[90] = StandardCharCode.Z; ansi_generic[91] = StandardCharCode.bracketleft; ansi_generic[92] = StandardCharCode.backslash; ansi_generic[93] = StandardCharCode.bracketright; ansi_generic[94] = StandardCharCode.asciicircum; ansi_generic[95] = StandardCharCode.underscore; ansi_generic[96] = StandardCharCode.quoteleft; ansi_generic[97] = StandardCharCode.a; ansi_generic[98] = StandardCharCode.b; ansi_generic[99] = StandardCharCode.c; ansi_generic[100] = StandardCharCode.d; ansi_generic[101] = StandardCharCode.e; ansi_generic[102] = StandardCharCode.f; ansi_generic[103] = StandardCharCode.g; ansi_generic[104] = StandardCharCode.h; ansi_generic[105] = StandardCharCode.i; ansi_generic[106] = StandardCharCode.j; ansi_generic[107] = StandardCharCode.k; ansi_generic[108] = StandardCharCode.l; ansi_generic[109] = StandardCharCode.m; ansi_generic[110] = StandardCharCode.n; ansi_generic[111] = StandardCharCode.o; ansi_generic[112] = StandardCharCode.p; ansi_generic[113] = StandardCharCode.q; ansi_generic[114] = StandardCharCode.r; ansi_generic[115] = StandardCharCode.s; ansi_generic[116] = StandardCharCode.t; ansi_generic[117] = StandardCharCode.u; ansi_generic[118] = StandardCharCode.v; ansi_generic[119] = StandardCharCode.w; ansi_generic[120] = StandardCharCode.x; ansi_generic[121] = StandardCharCode.y; ansi_generic[122] = StandardCharCode.z; ansi_generic[123] = StandardCharCode.braceleft; ansi_generic[124] = StandardCharCode.bar; ansi_generic[125] = StandardCharCode.braceright; ansi_generic[126] = StandardCharCode.asciitilde; ansi_generic[160] = StandardCharCode.nobrkspace; ansi_generic[161] = StandardCharCode.exclamdown; ansi_generic[162] = StandardCharCode.cent; ansi_generic[163] = StandardCharCode.sterling; ansi_generic[164] = StandardCharCode.currency; ansi_generic[165] = StandardCharCode.yen; ansi_generic[166] = StandardCharCode.brokenbar; ansi_generic[167] = StandardCharCode.section; ansi_generic[168] = StandardCharCode.dieresis; ansi_generic[169] = StandardCharCode.copyright; ansi_generic[170] = StandardCharCode.ordfeminine; ansi_generic[171] = StandardCharCode.guillemotleft; ansi_generic[172] = StandardCharCode.logicalnot; ansi_generic[173] = StandardCharCode.opthyphen; ansi_generic[174] = StandardCharCode.registered; ansi_generic[175] = StandardCharCode.macron; ansi_generic[176] = StandardCharCode.degree; ansi_generic[177] = StandardCharCode.plusminus; ansi_generic[178] = StandardCharCode.twosuperior; ansi_generic[179] = StandardCharCode.threesuperior; ansi_generic[180] = StandardCharCode.acute; ansi_generic[181] = StandardCharCode.mu; ansi_generic[182] = StandardCharCode.paragraph; ansi_generic[183] = StandardCharCode.periodcentered; ansi_generic[184] = StandardCharCode.cedilla; ansi_generic[185] = StandardCharCode.onesuperior; ansi_generic[186] = StandardCharCode.ordmasculine; ansi_generic[187] = StandardCharCode.guillemotright; ansi_generic[188] = StandardCharCode.onequarter; ansi_generic[189] = StandardCharCode.onehalf; ansi_generic[190] = StandardCharCode.threequarters; ansi_generic[191] = StandardCharCode.questiondown; ansi_generic[192] = StandardCharCode.Agrave; ansi_generic[193] = StandardCharCode.Aacute; ansi_generic[194] = StandardCharCode.Acircumflex; ansi_generic[195] = StandardCharCode.Atilde; ansi_generic[196] = StandardCharCode.Adieresis; ansi_generic[197] = StandardCharCode.Aring; ansi_generic[198] = StandardCharCode.AE; ansi_generic[199] = StandardCharCode.Ccedilla; ansi_generic[200] = StandardCharCode.Egrave; ansi_generic[201] = StandardCharCode.Eacute; ansi_generic[202] = StandardCharCode.Ecircumflex; ansi_generic[203] = StandardCharCode.Edieresis; ansi_generic[204] = StandardCharCode.Igrave; ansi_generic[205] = StandardCharCode.Iacute; ansi_generic[206] = StandardCharCode.Icircumflex; ansi_generic[207] = StandardCharCode.Idieresis; ansi_generic[208] = StandardCharCode.Eth; ansi_generic[209] = StandardCharCode.Ntilde; ansi_generic[210] = StandardCharCode.Ograve; ansi_generic[211] = StandardCharCode.Oacute; ansi_generic[212] = StandardCharCode.Ocircumflex; ansi_generic[213] = StandardCharCode.Otilde; ansi_generic[214] = StandardCharCode.Odieresis; ansi_generic[215] = StandardCharCode.multiply; ansi_generic[216] = StandardCharCode.Oslash; ansi_generic[217] = StandardCharCode.Ugrave; ansi_generic[218] = StandardCharCode.Uacute; ansi_generic[219] = StandardCharCode.Ucircumflex; ansi_generic[220] = StandardCharCode.Udieresis; ansi_generic[221] = StandardCharCode.Yacute; ansi_generic[222] = StandardCharCode.Thorn; ansi_generic[223] = StandardCharCode.germandbls; ansi_generic[224] = StandardCharCode.agrave; ansi_generic[225] = StandardCharCode.aacute; ansi_generic[226] = StandardCharCode.acircumflex; ansi_generic[227] = StandardCharCode.atilde; ansi_generic[228] = StandardCharCode.adieresis; ansi_generic[229] = StandardCharCode.aring; ansi_generic[230] = StandardCharCode.ae; ansi_generic[231] = StandardCharCode.ccedilla; ansi_generic[232] = StandardCharCode.egrave; ansi_generic[233] = StandardCharCode.eacute; ansi_generic[234] = StandardCharCode.ecircumflex; ansi_generic[235] = StandardCharCode.edieresis; ansi_generic[236] = StandardCharCode.igrave; ansi_generic[237] = StandardCharCode.iacute; ansi_generic[238] = StandardCharCode.icircumflex; ansi_generic[239] = StandardCharCode.idieresis; ansi_generic[240] = StandardCharCode.eth; ansi_generic[241] = StandardCharCode.ntilde; ansi_generic[242] = StandardCharCode.ograve; ansi_generic[243] = StandardCharCode.oacute; ansi_generic[244] = StandardCharCode.ocircumflex; ansi_generic[245] = StandardCharCode.otilde; ansi_generic[246] = StandardCharCode.odieresis; ansi_generic[247] = StandardCharCode.divide; ansi_generic[248] = StandardCharCode.oslash; ansi_generic[249] = StandardCharCode.ugrave; ansi_generic[250] = StandardCharCode.uacute; ansi_generic[251] = StandardCharCode.ucircumflex; ansi_generic[252] = StandardCharCode.udieresis; ansi_generic[253] = StandardCharCode.yacute; ansi_generic[254] = StandardCharCode.thorn; ansi_generic[255] = StandardCharCode.ydieresis; return ansi_generic; } } public static Charcode AnsiSymbol { get { Charcode charcode = new Charcode(256); charcode[6] = StandardCharCode.formula; charcode[30] = StandardCharCode.nobrkhyphen; charcode[31] = StandardCharCode.opthyphen; charcode[32] = StandardCharCode.space; charcode[33] = StandardCharCode.exclam; charcode[34] = StandardCharCode.universal; charcode[35] = StandardCharCode.mathnumbersign; charcode[36] = StandardCharCode.existential; charcode[37] = StandardCharCode.percent; charcode[38] = StandardCharCode.ampersand; charcode[92] = StandardCharCode.suchthat; charcode[40] = StandardCharCode.parenleft; charcode[41] = StandardCharCode.parenright; charcode[42] = StandardCharCode.mathasterisk; charcode[43] = StandardCharCode.mathplus; charcode[44] = StandardCharCode.comma; charcode[45] = StandardCharCode.mathminus; charcode[46] = StandardCharCode.period; charcode[47] = StandardCharCode.slash; charcode[48] = StandardCharCode.zero; charcode[49] = StandardCharCode.one; charcode[50] = StandardCharCode.two; charcode[51] = StandardCharCode.three; charcode[52] = StandardCharCode.four; charcode[53] = StandardCharCode.five; charcode[54] = StandardCharCode.six; charcode[55] = StandardCharCode.seven; charcode[56] = StandardCharCode.eight; charcode[57] = StandardCharCode.nine; charcode[58] = StandardCharCode.colon; charcode[59] = StandardCharCode.semicolon; charcode[60] = StandardCharCode.less; charcode[61] = StandardCharCode.mathequal; charcode[62] = StandardCharCode.greater; charcode[63] = StandardCharCode.question; charcode[64] = StandardCharCode.congruent; charcode[65] = StandardCharCode.Alpha; charcode[66] = StandardCharCode.Beta; charcode[67] = StandardCharCode.Chi; charcode[68] = StandardCharCode.Delta; charcode[69] = StandardCharCode.Epsilon; charcode[70] = StandardCharCode.Phi; charcode[71] = StandardCharCode.Gamma; charcode[72] = StandardCharCode.Eta; charcode[73] = StandardCharCode.Iota; charcode[75] = StandardCharCode.Kappa; charcode[76] = StandardCharCode.Lambda; charcode[77] = StandardCharCode.Mu; charcode[78] = StandardCharCode.Nu; charcode[79] = StandardCharCode.Omicron; charcode[80] = StandardCharCode.Pi; charcode[81] = StandardCharCode.Theta; charcode[82] = StandardCharCode.Rho; charcode[83] = StandardCharCode.Sigma; charcode[84] = StandardCharCode.Tau; charcode[85] = StandardCharCode.Upsilon; charcode[86] = StandardCharCode.varsigma; charcode[87] = StandardCharCode.Omega; charcode[88] = StandardCharCode.Xi; charcode[89] = StandardCharCode.Psi; charcode[90] = StandardCharCode.Zeta; charcode[91] = StandardCharCode.bracketleft; charcode[92] = StandardCharCode.backslash; charcode[93] = StandardCharCode.bracketright; charcode[94] = StandardCharCode.asciicircum; charcode[95] = StandardCharCode.underscore; charcode[96] = StandardCharCode.quoteleft; charcode[97] = StandardCharCode.alpha; charcode[98] = StandardCharCode.beta; charcode[99] = StandardCharCode.chi; charcode[100] = StandardCharCode.delta; charcode[101] = StandardCharCode.epsilon; charcode[102] = StandardCharCode.phi; charcode[103] = StandardCharCode.gamma; charcode[104] = StandardCharCode.eta; charcode[105] = StandardCharCode.iota; charcode[107] = StandardCharCode.kappa; charcode[108] = StandardCharCode.lambda; charcode[109] = StandardCharCode.mu; charcode[110] = StandardCharCode.nu; charcode[111] = StandardCharCode.omicron; charcode[112] = StandardCharCode.pi; charcode[113] = StandardCharCode.theta; charcode[114] = StandardCharCode.rho; charcode[115] = StandardCharCode.sigma; charcode[116] = StandardCharCode.tau; charcode[117] = StandardCharCode.upsilon; charcode[119] = StandardCharCode.omega; charcode[120] = StandardCharCode.xi; charcode[121] = StandardCharCode.psi; charcode[122] = StandardCharCode.zeta; charcode[123] = StandardCharCode.braceleft; charcode[124] = StandardCharCode.bar; charcode[125] = StandardCharCode.braceright; charcode[126] = StandardCharCode.mathtilde; return charcode; } } public Charcode() : this(256) { } private Charcode(int size) { this.size = size; codes = new StandardCharCode[size]; reverse = new Hashtable(size); } } internal class Charset { private CharsetType id; private CharsetFlags flags; private Charcode code; private string file; public Charcode Code { get { return code; } set { code = value; } } public CharsetFlags Flags { get { return flags; } set { flags = value; } } public CharsetType ID { get { return id; } set { if (value != 0 && value == CharsetType.Symbol) { id = CharsetType.Symbol; } else { id = CharsetType.General; } } } public string File { get { return file; } set { if (file != value) { file = value; } } } public StandardCharCode this[int c] => code[c]; public Charset() { flags = CharsetFlags.Read | CharsetFlags.Switch; id = CharsetType.General; file = string.Empty; ReadMap(); } public bool ReadMap() { switch (id) { case CharsetType.General: if (file == string.Empty) { code = Charcode.AnsiGeneric; return true; } return true; case CharsetType.Symbol: if (file == string.Empty) { code = Charcode.AnsiSymbol; return true; } return true; default: return false; } } public char StdCharCode(string name) { return ' '; } public string StdCharName(char code) { return string.Empty; } } [Flags] internal enum CharsetFlags { None = 0, Read = 1, Switch = 2 } internal enum CharsetType { General, Symbol } internal class ClassCallback { private ClassDelegate[] callbacks; public ClassDelegate this[TokenClass c] { get { return callbacks[(int)c]; } set { callbacks[(int)c] = value; } } public ClassCallback() { callbacks = new ClassDelegate[Enum.GetValues(typeof(Major)).Length]; } } internal class Color { private int red; private int green; private int blue; private int num; private Color next; public int Red { get { return red; } set { red = value; } } public int Green { get { return green; } set { green = value; } } public int Blue { get { return blue; } set { blue = value; } } public int Num { get { return num; } set { num = value; } } public Color(RTF rtf) { red = -1; green = -1; blue = -1; num = -1; lock (rtf) { if (rtf.Colors == null) { rtf.Colors = this; return; } Color colors = rtf.Colors; while (colors.next != null) { colors = colors.next; } colors.next = this; } } public static Color GetColor(RTF rtf, int color_number) { lock (rtf) { return GetColor(rtf.Colors, color_number); } } private static Color GetColor(Color start, int color_number) { if (color_number == -1) { return start; } Color color = start; while (color != null && color.num != color_number) { color = color.next; } return color; } } internal class DestinationCallback { private DestinationDelegate[] callbacks; public DestinationDelegate this[Minor c] { get { return callbacks[(int)c]; } set { callbacks[(int)c] = value; } } public DestinationCallback() { callbacks = new DestinationDelegate[Enum.GetValues(typeof(Minor)).Length]; } } internal class Font { private string name; private string alt_name; private int num; private int family; private CharsetType charset; private int pitch; private int type; private int codepage; private Font next; private RTF rtf; public string Name { get { return name; } set { name = value; } } public string AltName { get { return alt_name; } set { alt_name = value; } } public int Num { get { return num; } set { DeleteFont(rtf, value); num = value; } } public int Family { get { return family; } set { family = value; } } public CharsetType Charset { get { return charset; } set { charset = value; } } public int Pitch { get { return pitch; } set { pitch = value; } } public int Type { get { return type; } set { type = value; } } public int Codepage { get { return codepage; } set { codepage = value; } } public Font(RTF rtf) { this.rtf = rtf; num = -1; name = string.Empty; lock (rtf) { if (rtf.Fonts == null) { rtf.Fonts = this; return; } Font fonts = rtf.Fonts; while (fonts.next != null) { fonts = fonts.next; } fonts.next = this; } } public static bool DeleteFont(RTF rtf, int font_number) { lock (rtf) { Font fonts = rtf.Fonts; Font font = null; while (fonts != null && fonts.num != font_number) { font = fonts; fonts = fonts.next; } if (fonts != null) { if (fonts == rtf.Fonts) { rtf.Fonts = fonts.next; } else if (font != null) { font.next = fonts.next; } else { rtf.Fonts = fonts.next; } return true; } } return false; } public static Font GetFont(RTF rtf, int font_number) { lock (rtf) { return GetFont(rtf.Fonts, font_number); } } public static Font GetFont(Font start, int font_number) { if (font_number == -1) { return start; } Font font = start; while (font != null && font.num != font_number) { font = font.next; } return font; } } internal struct KeyStruct { public Major Major; public Minor Minor; public string Symbol; public KeyStruct(Major major, Minor minor, string symbol) { Major = major; Minor = minor; Symbol = symbol; } } internal class KeysInit { public static KeyStruct[] Init() { return new KeyStruct[684] { new KeyStruct(Major.SpecialChar, Minor.IIntVersion, "vern"), new KeyStruct(Major.SpecialChar, Minor.ICreateTime, "creatim"), new KeyStruct(Major.SpecialChar, Minor.IRevisionTime, "revtim"), new KeyStruct(Major.SpecialChar, Minor.IPrintTime, "printim"), new KeyStruct(Major.SpecialChar, Minor.IBackupTime, "buptim"), new KeyStruct(Major.SpecialChar, Minor.IEditTime, "edmins"), new KeyStruct(Major.SpecialChar, Minor.IYear, "yr"), new KeyStruct(Major.SpecialChar, Minor.IMonth, "mo"), new KeyStruct(Major.SpecialChar, Minor.IDay, "dy"), new KeyStruct(Major.SpecialChar, Minor.IHour, "hr"), new KeyStruct(Major.SpecialChar, Minor.IMinute, "min"), new KeyStruct(Major.SpecialChar, Minor.ISecond, "sec"), new KeyStruct(Major.SpecialChar, Minor.INPages, "nofpages"), new KeyStruct(Major.SpecialChar, Minor.INWords, "nofwords"), new KeyStruct(Major.SpecialChar, Minor.INChars, "nofchars"), new KeyStruct(Major.SpecialChar, Minor.IIntID, "id"), new KeyStruct(Major.SpecialChar, Minor.CurHeadDate, "chdate"), new KeyStruct(Major.SpecialChar, Minor.CurHeadDateLong, "chdpl"), new KeyStruct(Major.SpecialChar, Minor.CurHeadDateAbbrev, "chdpa"), new KeyStruct(Major.SpecialChar, Minor.CurHeadTime, "chtime"), new KeyStruct(Major.SpecialChar, Minor.CurHeadPage, "chpgn"), new KeyStruct(Major.SpecialChar, Minor.SectNum, "sectnum"), new KeyStruct(Major.SpecialChar, Minor.CurFNote, "chftn"), new KeyStruct(Major.SpecialChar, Minor.CurAnnotRef, "chatn"), new KeyStruct(Major.SpecialChar, Minor.FNoteSep, "chftnsep"), new KeyStruct(Major.SpecialChar, Minor.FNoteCont, "chftnsepc"), new KeyStruct(Major.SpecialChar, Minor.Cell, "cell"), new KeyStruct(Major.SpecialChar, Minor.Row, "row"), new KeyStruct(Major.SpecialChar, Minor.Par, "par"), new KeyStruct(Major.SpecialChar, Minor.Par, "\n"), new KeyStruct(Major.SpecialChar, Minor.Par, "\r"), new KeyStruct(Major.SpecialChar, Minor.Sect, "sect"), new KeyStruct(Major.SpecialChar, Minor.Page, "page"), new KeyStruct(Major.SpecialChar, Minor.Column, "column"), new KeyStruct(Major.SpecialChar, Minor.Line, "line"), new KeyStruct(Major.SpecialChar, Minor.SoftPage, "softpage"), new KeyStruct(Major.SpecialChar, Minor.SoftColumn, "softcol"), new KeyStruct(Major.SpecialChar, Minor.SoftLine, "softline"), new KeyStruct(Major.SpecialChar, Minor.SoftLineHt, "softlheight"), new KeyStruct(Major.SpecialChar, Minor.Tab, "tab"), new KeyStruct(Major.SpecialChar, Minor.EmDash, "emdash"), new KeyStruct(Major.SpecialChar, Minor.EnDash, "endash"), new KeyStruct(Major.SpecialChar, Minor.EmSpace, "emspace"), new KeyStruct(Major.SpecialChar, Minor.EnSpace, "enspace"), new KeyStruct(Major.SpecialChar, Minor.Bullet, "bullet"), new KeyStruct(Major.SpecialChar, Minor.LQuote, "lquote"), new KeyStruct(Major.SpecialChar, Minor.RQuote, "rquote"), new KeyStruct(Major.SpecialChar, Minor.LDblQuote, "ldblquote"), new KeyStruct(Major.SpecialChar, Minor.RDblQuote, "rdblquote"), new KeyStruct(Major.SpecialChar, Minor.Formula, "|"), new KeyStruct(Major.SpecialChar, Minor.NoBrkSpace, "~"), new KeyStruct(Major.SpecialChar, Minor.NoReqHyphen, "-"), new KeyStruct(Major.SpecialChar, Minor.NoBrkHyphen, "_"), new KeyStruct(Major.SpecialChar, Minor.LTRMark, "ltrmark"), new KeyStruct(Major.SpecialChar, Minor.RTLMark, "rtlmark"), new KeyStruct(Major.SpecialChar, Minor.NoWidthJoiner, "zwj"), new KeyStruct(Major.SpecialChar, Minor.NoWidthNonJoiner, "zwnj"), new KeyStruct(Major.SpecialChar, Minor.CurHeadPict, "chpict"), new KeyStruct(Major.CharAttr, Minor.Plain, "plain"), new KeyStruct(Major.CharAttr, Minor.Bold, "b"), new KeyStruct(Major.CharAttr, Minor.AllCaps, "caps"), new KeyStruct(Major.CharAttr, Minor.Deleted, "deleted"), new KeyStruct(Major.CharAttr, Minor.SubScript, "dn"), new KeyStruct(Major.CharAttr, Minor.SubScrShrink, "sub"), new KeyStruct(Major.CharAttr, Minor.NoSuperSub, "nosupersub"), new KeyStruct(Major.CharAttr, Minor.Expand, "expnd"), new KeyStruct(Major.CharAttr, Minor.ExpandTwips, "expndtw"), new KeyStruct(Major.CharAttr, Minor.Kerning, "kerning"), new KeyStruct(Major.CharAttr, Minor.FontNum, "f"), new KeyStruct(Major.CharAttr, Minor.FontSize, "fs"), new KeyStruct(Major.CharAttr, Minor.Italic, "i"), new KeyStruct(Major.CharAttr, Minor.Outline, "outl"), new KeyStruct(Major.CharAttr, Minor.Revised, "revised"), new KeyStruct(Major.CharAttr, Minor.RevAuthor, "revauth"), new KeyStruct(Major.CharAttr, Minor.RevDTTM, "revdttm"), new KeyStruct(Major.CharAttr, Minor.SmallCaps, "scaps"), new KeyStruct(Major.CharAttr, Minor.Shadow, "shad"), new KeyStruct(Major.CharAttr, Minor.StrikeThru, "strike"), new KeyStruct(Major.CharAttr, Minor.Underline, "ul"), new KeyStruct(Major.CharAttr, Minor.DotUnderline, "uld"), new KeyStruct(Major.CharAttr, Minor.DbUnderline, "uldb"), new KeyStruct(Major.CharAttr, Minor.NoUnderline, "ulnone"), new KeyStruct(Major.CharAttr, Minor.WordUnderline, "ulw"), new KeyStruct(Major.CharAttr, Minor.SuperScript, "up"), new KeyStruct(Major.CharAttr, Minor.SuperScrShrink, "super"), new KeyStruct(Major.CharAttr, Minor.Invisible, "v"), new KeyStruct(Major.CharAttr, Minor.ForeColor, "cf"), new KeyStruct(Major.CharAttr, Minor.BackColor, "cb"), new KeyStruct(Major.CharAttr, Minor.RTLChar, "rtlch"), new KeyStruct(Major.CharAttr, Minor.LTRChar, "ltrch"), new KeyStruct(Major.CharAttr, Minor.CharStyleNum, "cs"), new KeyStruct(Major.CharAttr, Minor.CharCharSet, "cchs"), new KeyStruct(Major.CharAttr, Minor.Language, "lang"), new KeyStruct(Major.CharAttr, Minor.Gray, "gray"), new KeyStruct(Major.ParAttr, Minor.ParDef, "pard"), new KeyStruct(Major.ParAttr, Minor.StyleNum, "s"), new KeyStruct(Major.ParAttr, Minor.Hyphenate, "hyphpar"), new KeyStruct(Major.ParAttr, Minor.InTable, "intbl"), new KeyStruct(Major.ParAttr, Minor.Keep, "keep"), new KeyStruct(Major.ParAttr, Minor.NoWidowControl, "nowidctlpar"), new KeyStruct(Major.ParAttr, Minor.KeepNext, "keepn"), new KeyStruct(Major.ParAttr, Minor.OutlineLevel, "level"), new KeyStruct(Major.ParAttr, Minor.NoLineNum, "noline"), new KeyStruct(Major.ParAttr, Minor.PBBefore, "pagebb"), new KeyStruct(Major.ParAttr, Minor.SideBySide, "sbys"), new KeyStruct(Major.ParAttr, Minor.QuadLeft, "ql"), new KeyStruct(Major.ParAttr, Minor.QuadRight, "qr"), new KeyStruct(Major.ParAttr, Minor.QuadJust, "qj"), new KeyStruct(Major.ParAttr, Minor.QuadCenter, "qc"), new KeyStruct(Major.ParAttr, Minor.FirstIndent, "fi"), new KeyStruct(Major.ParAttr, Minor.LeftIndent, "li"), new KeyStruct(Major.ParAttr, Minor.RightIndent, "ri"), new KeyStruct(Major.ParAttr, Minor.SpaceBefore, "sb"), new KeyStruct(Major.ParAttr, Minor.SpaceAfter, "sa"), new KeyStruct(Major.ParAttr, Minor.SpaceBetween, "sl"), new KeyStruct(Major.ParAttr, Minor.SpaceMultiply, "slmult"), new KeyStruct(Major.ParAttr, Minor.SubDocument, "subdocument"), new KeyStruct(Major.ParAttr, Minor.RTLPar, "rtlpar"), new KeyStruct(Major.ParAttr, Minor.LTRPar, "ltrpar"), new KeyStruct(Major.ParAttr, Minor.TabPos, "tx"), new KeyStruct(Major.ParAttr, Minor.TabLeft, "tql"), new KeyStruct(Major.ParAttr, Minor.TabRight, "tqr"), new KeyStruct(Major.ParAttr, Minor.TabCenter, "tqc"), new KeyStruct(Major.ParAttr, Minor.TabDecimal, "tqdec"), new KeyStruct(Major.ParAttr, Minor.TabBar, "tb"), new KeyStruct(Major.ParAttr, Minor.LeaderDot, "tldot"), new KeyStruct(Major.ParAttr, Minor.LeaderHyphen, "tlhyph"), new KeyStruct(Major.ParAttr, Minor.LeaderUnder, "tlul"), new KeyStruct(Major.ParAttr, Minor.LeaderThick, "tlth"), new KeyStruct(Major.ParAttr, Minor.LeaderEqual, "tleq"), new KeyStruct(Major.ParAttr, Minor.ParLevel, "pnlvl"), new KeyStruct(Major.ParAttr, Minor.ParBullet, "pnlvlblt"), new KeyStruct(Major.ParAttr, Minor.ParSimple, "pnlvlbody"), new KeyStruct(Major.ParAttr, Minor.ParNumCont, "pnlvlcont"), new KeyStruct(Major.ParAttr, Minor.ParNumOnce, "pnnumonce"), new KeyStruct(Major.ParAttr, Minor.ParNumAcross, "pnacross"), new KeyStruct(Major.ParAttr, Minor.ParHangIndent, "pnhang"), new KeyStruct(Major.ParAttr, Minor.ParNumRestart, "pnrestart"), new KeyStruct(Major.ParAttr, Minor.ParNumCardinal, "pncard"), new KeyStruct(Major.ParAttr, Minor.ParNumDecimal, "pndec"), new KeyStruct(Major.ParAttr, Minor.ParNumULetter, "pnucltr"), new KeyStruct(Major.ParAttr, Minor.ParNumURoman, "pnucrm"), new KeyStruct(Major.ParAttr, Minor.ParNumLLetter, "pnlcltr"), new KeyStruct(Major.ParAttr, Minor.ParNumLRoman, "pnlcrm"), new KeyStruct(Major.ParAttr, Minor.ParNumOrdinal, "pnord"), new KeyStruct(Major.ParAttr, Minor.ParNumOrdinalText, "pnordt"), new KeyStruct(Major.ParAttr, Minor.ParNumBold, "pnb"), new KeyStruct(Major.ParAttr, Minor.ParNumItalic, "pni"), new KeyStruct(Major.ParAttr, Minor.ParNumAllCaps, "pncaps"), new KeyStruct(Major.ParAttr, Minor.ParNumSmallCaps, "pnscaps"), new KeyStruct(Major.ParAttr, Minor.ParNumUnder, "pnul"), new KeyStruct(Major.ParAttr, Minor.ParNumDotUnder, "pnuld"), new KeyStruct(Major.ParAttr, Minor.ParNumDbUnder, "pnuldb"), new KeyStruct(Major.ParAttr, Minor.ParNumNoUnder, "pnulnone"), new KeyStruct(Major.ParAttr, Minor.ParNumWordUnder, "pnulw"), new KeyStruct(Major.ParAttr, Minor.ParNumStrikethru, "pnstrike"), new KeyStruct(Major.ParAttr, Minor.ParNumForeColor, "pncf"), new KeyStruct(Major.ParAttr, Minor.ParNumFont, "pnf"), new KeyStruct(Major.ParAttr, Minor.ParNumFontSize, "pnfs"), new KeyStruct(Major.ParAttr, Minor.ParNumIndent, "pnindent"), new KeyStruct(Major.ParAttr, Minor.ParNumSpacing, "pnsp"), new KeyStruct(Major.ParAttr, Minor.ParNumInclPrev, "pnprev"), new KeyStruct(Major.ParAttr, Minor.ParNumCenter, "pnqc"), new KeyStruct(Major.ParAttr, Minor.ParNumLeft, "pnql"), new KeyStruct(Major.ParAttr, Minor.ParNumRight, "pnqr"), new KeyStruct(Major.ParAttr, Minor.ParNumStartAt, "pnstart"), new KeyStruct(Major.ParAttr, Minor.BorderTop, "brdrt"), new KeyStruct(Major.ParAttr, Minor.BorderBottom, "brdrb"), new KeyStruct(Major.ParAttr, Minor.BorderLeft, "brdrl"), new KeyStruct(Major.ParAttr, Minor.BorderRight, "brdrr"), new KeyStruct(Major.ParAttr, Minor.BorderBetween, "brdrbtw"), new KeyStruct(Major.ParAttr, Minor.BorderBar, "brdrbar"), new KeyStruct(Major.ParAttr, Minor.BorderBox, "box"), new KeyStruct(Major.ParAttr, Minor.BorderSingle, "brdrs"), new KeyStruct(Major.ParAttr, Minor.BorderThick, "brdrth"), new KeyStruct(Major.ParAttr, Minor.BorderShadow, "brdrsh"), new KeyStruct(Major.ParAttr, Minor.BorderDouble, "brdrdb"), new KeyStruct(Major.ParAttr, Minor.BorderDot, "brdrdot"), new KeyStruct(Major.ParAttr, Minor.BorderDot, "brdrdash"), new KeyStruct(Major.ParAttr, Minor.BorderHair, "brdrhair"), new KeyStruct(Major.ParAttr, Minor.BorderWidth, "brdrw"), new KeyStruct(Major.ParAttr, Minor.BorderColor, "brdrcf"), new KeyStruct(Major.ParAttr, Minor.BorderSpace, "brsp"), new KeyStruct(Major.ParAttr, Minor.Shading, "shading"), new KeyStruct(Major.ParAttr, Minor.BgPatH, "bghoriz"), new KeyStruct(Major.ParAttr, Minor.BgPatV, "bgvert"), new KeyStruct(Major.ParAttr, Minor.FwdDiagBgPat, "bgfdiag"), new KeyStruct(Major.ParAttr, Minor.BwdDiagBgPat, "bgbdiag"), new KeyStruct(Major.ParAttr, Minor.HatchBgPat, "bgcross"), new KeyStruct(Major.ParAttr, Minor.DiagHatchBgPat, "bgdcross"), new KeyStruct(Major.ParAttr, Minor.DarkBgPatH, "bgdkhoriz"), new KeyStruct(Major.ParAttr, Minor.DarkBgPatV, "bgdkvert"), new KeyStruct(Major.ParAttr, Minor.FwdDarkBgPat, "bgdkfdiag"), new KeyStruct(Major.ParAttr, Minor.BwdDarkBgPat, "bgdkbdiag"), new KeyStruct(Major.ParAttr, Minor.DarkHatchBgPat, "bgdkcross"), new KeyStruct(Major.ParAttr, Minor.DarkDiagHatchBgPat, "bgdkdcross"), new KeyStruct(Major.ParAttr, Minor.BgPatLineColor, "cfpat"), new KeyStruct(Major.ParAttr, Minor.BgPatColor, "cbpat"), new KeyStruct(Major.SectAttr, Minor.SectDef, "sectd"), new KeyStruct(Major.SectAttr, Minor.ENoteHere, "endnhere"), new KeyStruct(Major.SectAttr, Minor.PrtBinFirst, "binfsxn"), new KeyStruct(Major.SectAttr, Minor.PrtBin, "binsxn"), new KeyStruct(Major.SectAttr, Minor.SectStyleNum, "ds"), new KeyStruct(Major.SectAttr, Minor.NoBreak, "sbknone"), new KeyStruct(Major.SectAttr, Minor.ColBreak, "sbkcol"), new KeyStruct(Major.SectAttr, Minor.PageBreak, "sbkpage"), new KeyStruct(Major.SectAttr, Minor.EvenBreak, "sbkeven"), new KeyStruct(Major.SectAttr, Minor.OddBreak, "sbkodd"), new KeyStruct(Major.SectAttr, Minor.Columns, "cols"), new KeyStruct(Major.SectAttr, Minor.ColumnSpace, "colsx"), new KeyStruct(Major.SectAttr, Minor.ColumnNumber, "colno"), new KeyStruct(Major.SectAttr, Minor.ColumnSpRight, "colsr"), new KeyStruct(Major.SectAttr, Minor.ColumnWidth, "colw"), new KeyStruct(Major.SectAttr, Minor.ColumnLine, "linebetcol"), new KeyStruct(Major.SectAttr, Minor.LineModulus, "linemod"), new KeyStruct(Major.SectAttr, Minor.LineDist, "linex"), new KeyStruct(Major.SectAttr, Minor.LineStarts, "linestarts"), new KeyStruct(Major.SectAttr, Minor.LineRestart, "linerestart"), new KeyStruct(Major.SectAttr, Minor.LineRestartPg, "lineppage"), new KeyStruct(Major.SectAttr, Minor.LineCont, "linecont"), new KeyStruct(Major.SectAttr, Minor.SectPageWid, "pgwsxn"), new KeyStruct(Major.SectAttr, Minor.SectPageHt, "pghsxn"), new KeyStruct(Major.SectAttr, Minor.SectMarginLeft, "marglsxn"), new KeyStruct(Major.SectAttr, Minor.SectMarginRight, "margrsxn"), new KeyStruct(Major.SectAttr, Minor.SectMarginTop, "margtsxn"), new KeyStruct(Major.SectAttr, Minor.SectMarginBottom, "margbsxn"), new KeyStruct(Major.SectAttr, Minor.SectMarginGutter, "guttersxn"), new KeyStruct(Major.SectAttr, Minor.SectLandscape, "lndscpsxn"), new KeyStruct(Major.SectAttr, Minor.TitleSpecial, "titlepg"), new KeyStruct(Major.SectAttr, Minor.HeaderY, "headery"), new KeyStruct(Major.SectAttr, Minor.FooterY, "footery"), new KeyStruct(Major.SectAttr, Minor.PageStarts, "pgnstarts"), new KeyStruct(Major.SectAttr, Minor.PageCont, "pgncont"), new KeyStruct(Major.SectAttr, Minor.PageRestart, "pgnrestart"), new KeyStruct(Major.SectAttr, Minor.PageNumRight, "pgnx"), new KeyStruct(Major.SectAttr, Minor.PageNumTop, "pgny"), new KeyStruct(Major.SectAttr, Minor.PageDecimal, "pgndec"), new KeyStruct(Major.SectAttr, Minor.PageURoman, "pgnucrm"), new KeyStruct(Major.SectAttr, Minor.PageLRoman, "pgnlcrm"), new KeyStruct(Major.SectAttr, Minor.PageULetter, "pgnucltr"), new KeyStruct(Major.SectAttr, Minor.PageLLetter, "pgnlcltr"), new KeyStruct(Major.SectAttr, Minor.PageNumHyphSep, "pgnhnsh"), new KeyStruct(Major.SectAttr, Minor.PageNumSpaceSep, "pgnhnsp"), new KeyStruct(Major.SectAttr, Minor.PageNumColonSep, "pgnhnsc"), new KeyStruct(Major.SectAttr, Minor.PageNumEmdashSep, "pgnhnsm"), new KeyStruct(Major.SectAttr, Minor.PageNumEndashSep, "pgnhnsn"), new KeyStruct(Major.SectAttr, Minor.TopVAlign, "vertalt"), new KeyStruct(Major.SectAttr, Minor.BottomVAlign, "vertalb"), new KeyStruct(Major.SectAttr, Minor.CenterVAlign, "vertalc"), new KeyStruct(Major.SectAttr, Minor.JustVAlign, "vertalj"), new KeyStruct(Major.SectAttr, Minor.RTLSect, "rtlsect"), new KeyStruct(Major.SectAttr, Minor.LTRSect, "ltrsect"), new KeyStruct(Major.DocAttr, Minor.DefTab, "deftab"), new KeyStruct(Major.DocAttr, Minor.HyphHotZone, "hyphhotz"), new KeyStruct(Major.DocAttr, Minor.HyphConsecLines, "hyphconsec"), new KeyStruct(Major.DocAttr, Minor.HyphCaps, "hyphcaps"), new KeyStruct(Major.DocAttr, Minor.HyphAuto, "hyphauto"), new KeyStruct(Major.DocAttr, Minor.LineStart, "linestart"), new KeyStruct(Major.DocAttr, Minor.FracWidth, "fracwidth"), new KeyStruct(Major.DocAttr, Minor.MakeBackup, "makeback"), new KeyStruct(Major.DocAttr, Minor.MakeBackup, "makebackup"), new KeyStruct(Major.DocAttr, Minor.RTFDefault, "defformat"), new KeyStruct(Major.DocAttr, Minor.PSOverlay, "psover"), new KeyStruct(Major.DocAttr, Minor.DocTemplate, "doctemp"), new KeyStruct(Major.DocAttr, Minor.DefLanguage, "deflang"), new KeyStruct(Major.DocAttr, Minor.FENoteType, "fet"), new KeyStruct(Major.DocAttr, Minor.FNoteEndSect, "endnotes"), new KeyStruct(Major.DocAttr, Minor.FNoteEndDoc, "enddoc"), new KeyStruct(Major.DocAttr, Minor.FNoteText, "ftntj"), new KeyStruct(Major.DocAttr, Minor.FNoteBottom, "ftnbj"), new KeyStruct(Major.DocAttr, Minor.ENoteEndSect, "aendnotes"), new KeyStruct(Major.DocAttr, Minor.ENoteEndDoc, "aenddoc"), new KeyStruct(Major.DocAttr, Minor.ENoteText, "aftntj"), new KeyStruct(Major.DocAttr, Minor.ENoteBottom, "aftnbj"), new KeyStruct(Major.DocAttr, Minor.FNoteStart, "ftnstart"), new KeyStruct(Major.DocAttr, Minor.ENoteStart, "aftnstart"), new KeyStruct(Major.DocAttr, Minor.FNoteRestartPage, "ftnrstpg"), new KeyStruct(Major.DocAttr, Minor.FNoteRestart, "ftnrestart"), new KeyStruct(Major.DocAttr, Minor.FNoteRestartCont, "ftnrstcont"), new KeyStruct(Major.DocAttr, Minor.ENoteRestart, "aftnrestart"), new KeyStruct(Major.DocAttr, Minor.ENoteRestartCont, "aftnrstcont"), new KeyStruct(Major.DocAttr, Minor.FNoteNumArabic, "ftnnar"), new KeyStruct(Major.DocAttr, Minor.FNoteNumLLetter, "ftnnalc"), new KeyStruct(Major.DocAttr, Minor.FNoteNumULetter, "ftnnauc"), new KeyStruct(Major.DocAttr, Minor.FNoteNumLRoman, "ftnnrlc"), new KeyStruct(Major.DocAttr, Minor.FNoteNumURoman, "ftnnruc"), new KeyStruct(Major.DocAttr, Minor.FNoteNumChicago, "ftnnchi"), new KeyStruct(Major.DocAttr, Minor.ENoteNumArabic, "aftnnar"), new KeyStruct(Major.DocAttr, Minor.ENoteNumLLetter, "aftnnalc"), new KeyStruct(Major.DocAttr, Minor.ENoteNumULetter, "aftnnauc"), new KeyStruct(Major.DocAttr, Minor.ENoteNumLRoman, "aftnnrlc"), new KeyStruct(Major.DocAttr, Minor.ENoteNumURoman, "aftnnruc"), new KeyStruct(Major.DocAttr, Minor.ENoteNumChicago, "aftnnchi"), new KeyStruct(Major.DocAttr, Minor.PaperWidth, "paperw"), new KeyStruct(Major.DocAttr, Minor.PaperHeight, "paperh"), new KeyStruct(Major.DocAttr, Minor.PaperSize, "psz"), new KeyStruct(Major.DocAttr, Minor.LeftMargin, "margl"), new KeyStruct(Major.DocAttr, Minor.RightMargin, "margr"), new KeyStruct(Major.DocAttr, Minor.TopMargin, "margt"), new KeyStruct(Major.DocAttr, Minor.BottomMargin, "margb"), new KeyStruct(Major.DocAttr, Minor.FacingPage, "facingp"), new KeyStruct(Major.DocAttr, Minor.GutterWid, "gutter"), new KeyStruct(Major.DocAttr, Minor.MirrorMargin, "margmirror"), new KeyStruct(Major.DocAttr, Minor.Landscape, "landscape"), new KeyStruct(Major.DocAttr, Minor.PageStart, "pgnstart"), new KeyStruct(Major.DocAttr, Minor.WidowCtrl, "widowctrl"), new KeyStruct(Major.DocAttr, Minor.LinkStyles, "linkstyles"), new KeyStruct(Major.DocAttr, Minor.NoAutoTabIndent, "notabind"), new KeyStruct(Major.DocAttr, Minor.WrapSpaces, "wraptrsp"), new KeyStruct(Major.DocAttr, Minor.PrintColorsBlack, "prcolbl"), new KeyStruct(Major.DocAttr, Minor.NoExtraSpaceRL, "noextrasprl"), new KeyStruct(Major.DocAttr, Minor.NoColumnBalance, "nocolbal"), new KeyStruct(Major.DocAttr, Minor.CvtMailMergeQuote, "cvmme"), new KeyStruct(Major.DocAttr, Minor.SuppressTopSpace, "sprstsp"), new KeyStruct(Major.DocAttr, Minor.SuppressPreParSpace, "sprsspbf"), new KeyStruct(Major.DocAttr, Minor.CombineTblBorders, "otblrul"), new KeyStruct(Major.DocAttr, Minor.TranspMetafiles, "transmf"), new KeyStruct(Major.DocAttr, Minor.SwapBorders, "swpbdr"), new KeyStruct(Major.DocAttr, Minor.ShowHardBreaks, "brkfrm"), new KeyStruct(Major.DocAttr, Minor.FormProtected, "formprot"), new KeyStruct(Major.DocAttr, Minor.AllProtected, "allprot"), new KeyStruct(Major.DocAttr, Minor.FormShading, "formshade"), new KeyStruct(Major.DocAttr, Minor.FormDisplay, "formdisp"), new KeyStruct(Major.DocAttr, Minor.PrintData, "printdata"), new KeyStruct(Major.DocAttr, Minor.RevProtected, "revprot"), new KeyStruct(Major.DocAttr, Minor.Revisions, "revisions"), new KeyStruct(Major.DocAttr, Minor.RevDisplay, "revprop"), new KeyStruct(Major.DocAttr, Minor.RevBar, "revbar"), new KeyStruct(Major.DocAttr, Minor.AnnotProtected, "annotprot"), new KeyStruct(Major.DocAttr, Minor.RTLDoc, "rtldoc"), new KeyStruct(Major.DocAttr, Minor.LTRDoc, "ltrdoc"), new KeyStruct(Major.StyleAttr, Minor.Additive, "additive"), new KeyStruct(Major.StyleAttr, Minor.BasedOn, "sbasedon"), new KeyStruct(Major.StyleAttr, Minor.Next, "snext"), new KeyStruct(Major.PictAttr, Minor.MacQD, "macpict"), new KeyStruct(Major.PictAttr, Minor.PMMetafile, "pmmetafile"), new KeyStruct(Major.PictAttr, Minor.WinMetafile, "wmetafile"), new KeyStruct(Major.PictAttr, Minor.DevIndBitmap, "dibitmap"), new KeyStruct(Major.PictAttr, Minor.WinBitmap, "wbitmap"), new KeyStruct(Major.PictAttr, Minor.PngBlip, "pngblip"), new KeyStruct(Major.PictAttr, Minor.PixelBits, "wbmbitspixel"), new KeyStruct(Major.PictAttr, Minor.BitmapPlanes, "wbmplanes"), new KeyStruct(Major.PictAttr, Minor.BitmapWid, "wbmwidthbytes"), new KeyStruct(Major.PictAttr, Minor.PicWid, "picw"), new KeyStruct(Major.PictAttr, Minor.PicHt, "pich"), new KeyStruct(Major.PictAttr, Minor.PicGoalWid, "picwgoal"), new KeyStruct(Major.PictAttr, Minor.PicGoalHt, "pichgoal"), new KeyStruct(Major.PictAttr, Minor.PicGoalWid, "picwGoal"), new KeyStruct(Major.PictAttr, Minor.PicGoalHt, "pichGoal"), new KeyStruct(Major.PictAttr, Minor.PicScaleX, "picscalex"), new KeyStruct(Major.PictAttr, Minor.PicScaleY, "picscaley"), new KeyStruct(Major.PictAttr, Minor.PicScaled, "picscaled"), new KeyStruct(Major.PictAttr, Minor.PicCropTop, "piccropt"), new KeyStruct(Major.PictAttr, Minor.PicCropBottom, "piccropb"), new KeyStruct(Major.PictAttr, Minor.PicCropLeft, "piccropl"), new KeyStruct(Major.PictAttr, Minor.PicCropRight, "piccropr"), new KeyStruct(Major.PictAttr, Minor.PicMFHasBitmap, "picbmp"), new KeyStruct(Major.PictAttr, Minor.PicMFBitsPerPixel, "picbpp"), new KeyStruct(Major.PictAttr, Minor.PicBinary, "bin"), new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGWidth, "width"), new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"), new KeyStruct(Major.Destination, Minor.OptDest, "*"), new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"), new KeyStruct(Major.Destination, Minor.FontAltName, "f
MoreSettings.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Windows.Forms; using BepInEx; using HarmonyLib; using MoreSettings.Settings; using MoreSettings.Settings.Type; using Ookii.Dialogs.WinForms; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using Zorro.Core; using Zorro.Settings; using Zorro.Settings.DebugUI; using Zorro.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("More Settings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("More Settings")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ba9b4adf-0a47-430d-82ef-63130009aa2f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreSettings { [BepInPlugin("MoreSettings", "More Settings", "0.2.0")] public class MoreSettings : BaseUnityPlugin { private Harmony harmony; internal static List<Setting> additionalSettings = new List<Setting>(); internal static List<IPatch> patches = new List<IPatch>(); private void Awake() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreSettings Loaded!!!"); addSetting((Setting)(object)new HDRSetting()); addSetting((Setting)(object)new RenderScaleSetting()); addSetting((Setting)(object)new FSRToggleSetting()); addSetting((Setting)(object)new FSRSharpnessSetting()); addSetting((Setting)(object)new TextureResolutionSetting()); addSetting((Setting)(object)new AntiAliasingSetting()); addSetting((Setting)(object)new PostProcessingSetting()); addSetting((Setting)(object)new FOVSetting()); addSetting((Setting)(object)new RecordSaveSetting()); addSetting((Setting)(object)new CrouchingModeSetting()); addSetting((Setting)(object)new UseItemKeybindSetting()); addSetting((Setting)(object)new AimKeybindSetting()); addSetting((Setting)(object)new ResetGraphicsToDefault()); addSetting((Setting)(object)new ResetAudioToDefault()); addSetting((Setting)(object)new ResetControlsToDefault()); addPatches(new ShadowQualityPatch()); addPatches(new VoiceVolumePatch()); addPatches(new SFXVolumePatch()); addPatches(new MasterVolumePatch()); addPatches(new KeybindPatch()); harmony = new Harmony("MoreSettings"); harmony.PatchAll(typeof(MainPatch)); ApplyPatches(); } internal void ApplyPatches() { foreach (Setting additionalSetting in additionalSettings) { if (additionalSetting is IPatch) { (additionalSetting as IPatch).ApplyPatch(ref harmony); } } foreach (IPatch patch in patches) { patch.ApplyPatch(ref harmony); } } public static void addSetting(Setting setting) { additionalSettings.Add(setting); } internal static void addPatches(IPatch patch) { patches.Add(patch); } } internal class MainPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void PatchSettingsHandler(SettingsHandler __instance) { List<Setting> first = Traverse.Create((object)__instance).Field("settings").GetValue() as List<Setting>; object value = Traverse.Create((object)__instance).Field("_settingsSaveLoad").GetValue(); ISettingsSaveLoad val = (ISettingsSaveLoad)((value is ISettingsSaveLoad) ? value : null); first = first.Concat(MoreSettings.additionalSettings).ToList(); Traverse.Create((object)__instance).Field("settings").SetValue((object)first); foreach (Setting additionalSetting in MoreSettings.additionalSettings) { additionalSetting.Load(val); additionalSetting.ApplyValue(); } Debug.Log((object)"Settings Patch Applied [MoreSettings]"); } [HarmonyPatch(typeof(Player), "Start")] [HarmonyPostfix] private static void ApplySettingAtStart(Player __instance) { if (__instance.IsLocal) { Tools.ApplySettings(); } } } public class Tools { public static void LogMessage(string message) { FileLog.Log(message); Debug.Log((object)message); } public static void ApplySettings() { foreach (Setting item in GameHandler.Instance.SettingsHandler.GetAllSettingsNonAlloc()) { item.ApplyValue(); } } } } namespace MoreSettings.Settings { public class FOVSetting : FloatSetting, IExposedSetting, IPatch { internal class Patch { [HarmonyPatch(typeof(MainCamera), "Awake")] [HarmonyPostfix] private static void PatchFOV() { FOVSetting.baseFOVTraverse = Traverse.Create((object)MainCamera.instance).Field<float>("baseFOV"); Debug.Log((object)("traverse " + (object)FOVSetting.baseFOVTraverse)); try { Traverse<float> baseFOVTraverse = FOVSetting.baseFOVTraverse; if (baseFOVTraverse != null) { _ = baseFOVTraverse.Value; if (true) { FOVSetting.baseFOVTraverse.Value = ((FloatSetting)GameHandler.Instance.SettingsHandler.GetSetting<FOVSetting>()).Value; } } } catch (Exception) { } } } private static Traverse<float> baseFOVTraverse; public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "FOV (Field Of View)"; } protected override float GetDefaultValue() { return 70.08072f; } protected override float2 GetMinMaxValue() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return new float2(60f, 100f); } public override void ApplyValue() { if (baseFOVTraverse != null) { baseFOVTraverse.Value = ((FloatSetting)this).Value; } } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } } public class HDRSetting : EnumSetting, IExposedSetting { public override void ApplyValue() { RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null); switch (((IntSetting)this).Value) { case 0: val.supportsHDR = false; break; case 1: val.supportsHDR = true; break; } } protected override int GetDefaultValue() { return 1; } public override List<string> GetChoices() { return new List<string> { "OFF", "ON" }; } public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "High Dynamic Range (HDR)"; } } public class KeybindPatch : IPatch { public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(KeybindPatch)); } [HarmonyPatch(typeof(PlayerInput), "SampeInput")] [HarmonyPostfix] private static void UseItemPatch(PlayerInput __instance, PlayerData data) { //IL_0067: 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: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!(data.inputOverideAmount > 0.99f)) { if (data.cantUseItemFor <= 0f) { KeyCode val = (KeyCode)((IntSetting)GameHandler.Instance.SettingsHandler.GetSetting<UseItemKeybindSetting>()).Value; __instance.clickWasPressed = GlobalInputHandler.GetKeyDown(val); __instance.clickIsPressed = GlobalInputHandler.GetKey(val); __instance.clickWasReleased = GlobalInputHandler.GetKeyUp(val); } KeyCode val2 = (KeyCode)((IntSetting)GameHandler.Instance.SettingsHandler.GetSetting<AimKeybindSetting>()).Value; __instance.aimWasPressed = GlobalInputHandler.GetKeyDown(val2); __instance.aimIsPressed = GlobalInputHandler.GetKey(val2); } } } internal class MasterVolumePatch : IPatch { [HarmonyPatch(typeof(MasterVolumeSetting), "GetMinMaxValue")] [HarmonyPostfix] private static void PatchMasterVolumeMinMax(ref float2 __result) { //IL_000b: 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) __result = new float2(0f, 2f); } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(MasterVolumePatch)); } } internal class ResetControlsToDefault : StringSetting, IExposedSetting, IPatch { internal class Patch { [HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")] [HarmonyPostfix] private static void ResetAudioToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (setting is ResetControlsToDefault) { ((TMP_Text)__instance.label).text = "Reset"; ((UnityEvent)__instance.button.onClick).AddListener(new UnityAction(OnButtonClicked)); } } [HarmonyPatch(typeof(SettingsCell), "Setup")] [HarmonyPostfix] private static void GetSettingCellTitle(SettingsCell __instance, Setting setting) { titleComponent = ((setting is ResetControlsToDefault) ? __instance.title : titleComponent); } [HarmonyPatch(typeof(MainMenuMainPage), "OnPageEnter")] [HarmonyPostfix] private static void PatchGetSettingHandler(MainMenuMainPage __instance) { pageHandler = ((UIPage)__instance).GetPageHandler<UIPageHandler>(); } [HarmonyPatch(typeof(SettingCategoryTab), "Select")] [HarmonyPostfix] private static void PatchCategory(SettingCategoryTab __instance) { menu = __instance.settingsMenu; } } internal static TextMeshProUGUI titleComponent; internal static UIPageHandler pageHandler; internal static SettingsMenu menu; public SettingCategory GetSettingCategory() { return (SettingCategory)2; } public string GetDisplayName() { return "Reset Controls To Default"; } public override void ApplyValue() { } protected override string GetDefaultValue() { return ""; } internal static void OnButtonClicked() { //IL_0033: 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_005a: Unknown result type (might be due to invalid IL or missing references) foreach (Setting setting in GameHandler.Instance.SettingsHandler.GetSettings((SettingCategory)2)) { ResolutionSetting val = (ResolutionSetting)(object)((setting is ResolutionSetting) ? setting : null); if (val != null) { Resolution val2 = val.GetResolutions().FirstOrDefault(); Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width)); val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val).Update(); } IntSetting val3 = (IntSetting)(object)((setting is IntSetting) ? setting : null); if (val3 != null) { object obj = ((object)setting).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(setting, new object[0]); Debug.Log((object)("Default Value " + (int)obj)); val3.SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val3).Update(); } FloatSetting val4 = (FloatSetting)(object)((setting is FloatSetting) ? setting : null); if (val4 != null) { object obj2 = ((object)setting).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(setting, new object[0]); Debug.Log((object)("Default Value " + (float)obj2)); val4.SetValue((float)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val4).Update(); } } GameHandler.Instance.SettingsHandler.Update(); GameHandler.Instance.SettingsHandler.RegisterPage(); if ((Object)(object)pageHandler != (Object)null) { pageHandler.TransistionToPage<MainMenuMainPage>(); pageHandler.TransistionToPage<MainMenuSettingsPage>(); menu.SelectCategory((SettingCategory)2); } } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } } internal class ResetAudioToDefault : StringSetting, IExposedSetting, IPatch { internal class Patch { [HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")] [HarmonyPostfix] private static void ResetAudioToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (setting is ResetAudioToDefault) { ((TMP_Text)__instance.label).text = "Reset"; ((UnityEvent)__instance.button.onClick).AddListener(new UnityAction(OnButtonClicked)); } } [HarmonyPatch(typeof(SettingsCell), "Setup")] [HarmonyPostfix] private static void GetSettingCellTitle(SettingsCell __instance, Setting setting) { titleComponent = ((setting is ResetAudioToDefault) ? __instance.title : titleComponent); } [HarmonyPatch(typeof(MainMenuMainPage), "OnPageEnter")] [HarmonyPostfix] private static void PatchGetSettingHandler(MainMenuMainPage __instance) { pageHandler = ((UIPage)__instance).GetPageHandler<UIPageHandler>(); } [HarmonyPatch(typeof(SettingCategoryTab), "Select")] [HarmonyPostfix] private static void PatchCategory(SettingCategoryTab __instance) { menu = __instance.settingsMenu; } } internal static TextMeshProUGUI titleComponent; internal static UIPageHandler pageHandler; internal static SettingsMenu menu; public SettingCategory GetSettingCategory() { return (SettingCategory)1; } public string GetDisplayName() { return "Reset Audio To Default"; } public override void ApplyValue() { } protected override string GetDefaultValue() { return ""; } internal static void OnButtonClicked() { //IL_0033: 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_005a: Unknown result type (might be due to invalid IL or missing references) foreach (Setting setting in GameHandler.Instance.SettingsHandler.GetSettings((SettingCategory)1)) { ResolutionSetting val = (ResolutionSetting)(object)((setting is ResolutionSetting) ? setting : null); if (val != null) { Resolution val2 = val.GetResolutions().FirstOrDefault(); Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width)); val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val).Update(); } IntSetting val3 = (IntSetting)(object)((setting is IntSetting) ? setting : null); if (val3 != null) { object obj = ((object)setting).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(setting, new object[0]); Debug.Log((object)("Default Value " + (int)obj)); val3.SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val3).Update(); } FloatSetting val4 = (FloatSetting)(object)((setting is FloatSetting) ? setting : null); if (val4 != null) { object obj2 = ((object)setting).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(setting, new object[0]); Debug.Log((object)("Default Value " + (float)obj2)); val4.SetValue((float)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val4).Update(); } } GameHandler.Instance.SettingsHandler.Update(); GameHandler.Instance.SettingsHandler.RegisterPage(); if ((Object)(object)pageHandler != (Object)null) { pageHandler.TransistionToPage<MainMenuMainPage>(); pageHandler.TransistionToPage<MainMenuSettingsPage>(); menu.SelectCategory((SettingCategory)1); } } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } } internal class ResetGraphicsToDefault : StringSetting, IExposedSetting, IPatch { internal class Patch { [HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")] [HarmonyPostfix] private static void ResetGraphicsToDefaultSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (setting is ResetGraphicsToDefault) { ((TMP_Text)__instance.label).text = "Reset"; ((UnityEvent)__instance.button.onClick).AddListener(new UnityAction(OnButtonClicked)); } } [HarmonyPatch(typeof(SettingsCell), "Setup")] [HarmonyPostfix] private static void GetSettingCellTitle(SettingsCell __instance, Setting setting) { titleComponent = ((setting is ResetGraphicsToDefault) ? __instance.title : titleComponent); } [HarmonyPatch(typeof(MainMenuMainPage), "OnPageEnter")] [HarmonyPostfix] private static void PatchGetSettingHandler(MainMenuMainPage __instance) { pageHandler = ((UIPage)__instance).GetPageHandler<UIPageHandler>(); } } internal static TextMeshProUGUI titleComponent; internal static UIPageHandler pageHandler; public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "Reset Graphics To Default"; } public override void ApplyValue() { } protected override string GetDefaultValue() { return ""; } internal static void OnButtonClicked() { //IL_0033: 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_005a: Unknown result type (might be due to invalid IL or missing references) foreach (Setting setting in GameHandler.Instance.SettingsHandler.GetSettings((SettingCategory)0)) { ResolutionSetting val = (ResolutionSetting)(object)((setting is ResolutionSetting) ? setting : null); if (val != null) { Resolution val2 = val.GetResolutions().FirstOrDefault(); Debug.Log((object)("Default Value " + ((Resolution)(ref val2)).width)); val.SetValue(val2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val).Update(); } IntSetting val3 = (IntSetting)(object)((setting is IntSetting) ? setting : null); if (val3 != null) { object obj = ((object)setting).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(setting, new object[0]); Debug.Log((object)("Default Value " + (int)obj)); val3.SetValue((int)obj, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val3).Update(); } FloatSetting val4 = (FloatSetting)(object)((setting is FloatSetting) ? setting : null); if (val4 != null) { object obj2 = ((object)setting).GetType().GetMethod("GetDefaultValue", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(setting, new object[0]); Debug.Log((object)("Default Value " + (float)obj2)); val4.SetValue((float)obj2, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); ((Setting)val4).Update(); } } GameHandler.Instance.SettingsHandler.Update(); GameHandler.Instance.SettingsHandler.RegisterPage(); if ((Object)(object)pageHandler != (Object)null) { pageHandler.TransistionToPage<MainMenuMainPage>(); pageHandler.TransistionToPage<MainMenuSettingsPage>(); } } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } } internal class SFXVolumePatch : IPatch { [HarmonyPatch(typeof(SFXVolumeSetting), "GetMinMaxValue")] [HarmonyPostfix] private static void PatchSFXVolumeMinMax(ref float2 __result) { //IL_000b: 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) __result = new float2(0f, 2f); } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(SFXVolumePatch)); } } internal class AimKeybindSetting : KeyCodeSetting, IExposedSetting { public string GetDisplayName() { return "Aim"; } public SettingCategory GetSettingCategory() { return (SettingCategory)2; } protected override KeyCode GetDefaultKey() { return (KeyCode)324; } } internal class UseItemKeybindSetting : KeyCodeSetting, IExposedSetting, IPatch { public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } public string GetDisplayName() { return "Use Item"; } public SettingCategory GetSettingCategory() { return (SettingCategory)2; } protected override KeyCode GetDefaultKey() { return (KeyCode)323; } } internal class VoiceVolumePatch : IPatch { [HarmonyPatch(typeof(VoiceVolumeSetting), "GetMinMaxValue")] [HarmonyPostfix] private static void PatchVoiceVolumeMinMax(ref float2 __result) { //IL_000b: 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) __result = new float2(0f, 2f); } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(VoiceVolumePatch)); } } public class CrouchingModeSetting : EnumSetting, IExposedSetting, IPatch { internal class Patch { [HarmonyPatch(typeof(PlayerController), "MovementStateChanges")] [HarmonyPrefix] private static void PatchCrouchingMode(PlayerController __instance) { Traverse val = Traverse.Create((object)__instance).Field("player"); if (((IntSetting)GameHandler.Instance.SettingsHandler.GetSetting<CrouchingModeSetting>()).Value == 1 && val != null) { object value = val.GetValue(); Player val2 = (Player)((value is Player) ? value : null); val2.data.isCrouching = val2.input.crouchIsPressed; val.SetValue((object)val2); } } } public override void ApplyValue() { } protected override int GetDefaultValue() { return 0; } public override List<string> GetChoices() { return new List<string> { "Toggle", "Hold" }; } public SettingCategory GetSettingCategory() { return (SettingCategory)2; } public string GetDisplayName() { return "Crouching Mode"; } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } } public class PostProcessingSetting : EnumSetting, IExposedSetting { public override void ApplyValue() { UniversalAdditionalCameraData[] array = (UniversalAdditionalCameraData[])(object)Resources.FindObjectsOfTypeAll(typeof(UniversalAdditionalCameraData)); foreach (UniversalAdditionalCameraData val in array) { switch (((IntSetting)this).Value) { case 0: val.renderPostProcessing = false; break; case 1: val.renderPostProcessing = true; break; } } } protected override int GetDefaultValue() { return 1; } public override List<string> GetChoices() { return new List<string> { "OFF", "ON" }; } public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "Post processing (off = Brightness won't work)"; } } public class AntiAliasingSetting : EnumSetting, IExposedSetting { public override void ApplyValue() { Camera[] array = (Camera[])(object)Resources.FindObjectsOfTypeAll(typeof(Camera)); foreach (Camera val in array) { switch (((IntSetting)this).Value) { case 0: CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasing = (AntialiasingMode)0; break; case 1: CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasing = (AntialiasingMode)1; CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasingQuality = (AntialiasingQuality)2; break; case 2: CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasing = (AntialiasingMode)2; CameraExtensions.GetUniversalAdditionalCameraData(val).antialiasingQuality = (AntialiasingQuality)2; break; } } } protected override int GetDefaultValue() { return 0; } public override List<string> GetChoices() { return new List<string> { "OFF", "FXAA", "SMAA" }; } public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "Anti Aliasing"; } } internal class ShadowQualityPatch : IPatch { public static class ShadowChanger { private static FieldInfo MainLightCastShadows_FieldInfo; private static FieldInfo AdditionalLightCastShadows_FieldInfo; private static FieldInfo MainLightShadowmapResolution_FieldInfo; private static FieldInfo AdditionalLightShadowmapResolution_FieldInfo; private static FieldInfo Cascade2Split_FieldInfo; private static FieldInfo Cascade4Split_FieldInfo; private static FieldInfo SoftShadowsEnabled_FieldInfo; public static bool MainLightCastShadows { get { return (bool)MainLightCastShadows_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { MainLightCastShadows_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } public static bool AdditionalLightCastShadows { get { return (bool)AdditionalLightCastShadows_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { AdditionalLightCastShadows_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } public static ShadowResolution MainLightShadowResolution { get { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return (ShadowResolution)MainLightShadowmapResolution_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { //IL_000a: Unknown result type (might be due to invalid IL or missing references) MainLightShadowmapResolution_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } public static ShadowResolution AdditionalLightShadowResolution { get { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return (ShadowResolution)AdditionalLightShadowmapResolution_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { //IL_000a: Unknown result type (might be due to invalid IL or missing references) AdditionalLightShadowmapResolution_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } public static float Cascade2Split { get { return (float)Cascade2Split_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { Cascade2Split_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } public static Vector3 Cascade4Split { get { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return (Vector3)Cascade4Split_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Cascade4Split_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } public static bool SoftShadowsEnabled { get { return (bool)SoftShadowsEnabled_FieldInfo.GetValue(GraphicsSettings.currentRenderPipeline); } set { SoftShadowsEnabled_FieldInfo.SetValue(GraphicsSettings.currentRenderPipeline, value); } } static ShadowChanger() { System.Type typeFromHandle = typeof(UniversalRenderPipelineAsset); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic; MainLightCastShadows_FieldInfo = typeFromHandle.GetField("m_MainLightShadowsSupported", bindingAttr); AdditionalLightCastShadows_FieldInfo = typeFromHandle.GetField("m_AdditionalLightShadowsSupported", bindingAttr); MainLightShadowmapResolution_FieldInfo = typeFromHandle.GetField("m_MainLightShadowmapResolution", bindingAttr); AdditionalLightShadowmapResolution_FieldInfo = typeFromHandle.GetField("m_AdditionalLightsShadowmapResolution", bindingAttr); Cascade2Split_FieldInfo = typeFromHandle.GetField("m_Cascade2Split", bindingAttr); Cascade4Split_FieldInfo = typeFromHandle.GetField("m_Cascade4Split", bindingAttr); SoftShadowsEnabled_FieldInfo = typeFromHandle.GetField("m_SoftShadowsSupported", bindingAttr); } } [HarmonyPatch(typeof(ShadowQualitySetting), "SetShadowSettings")] [HarmonyPrefix] private static void PatchShadowQualityApply(ShadowQualitySetting __instance, ref ShadowResolution shadowResolution, ref float shadowDistance) { if (((IntSetting)__instance).Value == 2) { shadowResolution = (ShadowResolution)256; shadowDistance = 30f; } else if (((IntSetting)__instance).Value == 3) { shadowResolution = (ShadowResolution)0; shadowDistance = 0f; } } [HarmonyPatch(typeof(ShadowQualitySetting), "SetShadowSettings")] [HarmonyPostfix] private static void postPatchShadow(ShadowQualitySetting __instance, ref ShadowResolution shadowResolution, ref float shadowDistance) { RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null); ShadowChanger.AdditionalLightShadowResolution = shadowResolution; ShadowChanger.MainLightShadowResolution = shadowResolution; Debug.Log((object)("Shadow Resolution " + val.mainLightShadowmapResolution + " [MoreSettings]")); } [HarmonyPatch(typeof(ShadowQualitySetting), "GetChoices")] [HarmonyPostfix] private static void PatchShadowQualityChoices(ref List<string> __result) { __result = new List<string> { "High", "Low", "Lowest", "Off" }; } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(ShadowQualityPatch)); } } public class TextureResolutionSetting : EnumSetting, IExposedSetting { public override void ApplyValue() { QualitySettings.globalTextureMipmapLimit = 3 - ((IntSetting)this).Value; } protected override int GetDefaultValue() { return 3; } public override List<string> GetChoices() { return new List<string> { "Low", "Medium", "High", "Very High" }; } public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "Texture Resolution"; } } public class FSRToggleSetting : EnumSetting, IExposedSetting { public override void ApplyValue() { RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null); switch (((IntSetting)this).Value) { case 0: val.upscalingFilter = (UpscalingFilterSelection)0; val.fsrOverrideSharpness = false; break; case 1: val.upscalingFilter = (UpscalingFilterSelection)3; val.fsrOverrideSharpness = true; break; } } protected override int GetDefaultValue() { return 0; } public override List<string> GetChoices() { return new List<string> { "OFF", "ON" }; } public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "FSR 1.0 (FidelityFx Super Resolution)"; } } public class FSRSharpnessSetting : FloatSetting, IExposedSetting { public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "FSR Sharpness Amount"; } protected override float GetDefaultValue() { return 0.92f; } protected override float2 GetMinMaxValue() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return new float2(0f, 1f); } public override void ApplyValue() { RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; ((UniversalRenderPipelineAsset)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null)).fsrSharpness = ((FloatSetting)this).Value; } } public class RenderScaleSetting : FloatSetting, IExposedSetting { public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "Render Scale"; } protected override float GetDefaultValue() { return 1f; } protected override float2 GetMinMaxValue() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return new float2(0.25f, 1f); } public override void ApplyValue() { RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; ((UniversalRenderPipelineAsset)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null)).renderScale = ((FloatSetting)this).Value; } } public class RecordSaveSetting : StringSetting, IExposedSetting, IPatch { internal class Patch { [HarmonyPatch(typeof(KeyCodeSettingUI), "Setup")] [HarmonyPostfix] private static void RecordLocationSettingUI(KeyCodeSettingUI __instance, Setting setting, ISettingHandler settingHandler) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (setting is RecordSaveSetting) { ((TMP_Text)__instance.label).text = "Select Folder"; ((UnityEvent)__instance.button.onClick).AddListener(new UnityAction(OnButtonClicked)); } } [HarmonyPatch(typeof(SettingsCell), "Setup")] [HarmonyPostfix] private static void GetSettingCellTitle(SettingsCell __instance, Setting setting) { titleComponent = ((setting is RecordSaveSetting) ? __instance.title : titleComponent); } [HarmonyPatch(typeof(CameraRecording), "SaveToDesktop")] [HarmonyPostfix] private static void PatchSaveRecording(CameraRecording __instance, out string videoFileName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) string sourceFileName = default(string); if (!RecordingsHandler.TryGetRecordingPath(__instance.videoHandle, ref sourceFileName)) { videoFileName = string.Empty; return; } videoFileName = "content_warning_" + GuidExtensions.ToShortString(__instance.videoHandle.id) + ".webm"; string text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), videoFileName); string value = GameHandler.Instance.SettingsHandler.GetSetting<RecordSaveSetting>().Value; string text2 = Path.Combine(value, videoFileName); if (text.Equals(text2)) { return; } try { if (!Directory.Exists(value)) { Directory.CreateDirectory(value); } if (File.Exists(text)) { File.Move(text, text2); } else { File.Copy(sourceFileName, text2); } Debug.Log((object)("Video saved successfully to " + text2 + " [MoreSettings]")); } catch (Exception ex) { if (!text.Equals(text2)) { File.Copy(sourceFileName, text); } Debug.LogException(ex); Debug.Log((object)"Error encountered when saving to custom directory, video saved to desktop directory instead [MoreSettings]"); } } } internal static TextMeshProUGUI titleComponent; public SettingCategory GetSettingCategory() { return (SettingCategory)0; } public string GetDisplayName() { return "Record Save Location: " + base.Value; } public override void ApplyValue() { if ((Object)(object)titleComponent != (Object)null) { ((TMP_Text)titleComponent).text = GetDisplayName(); } } protected override string GetDefaultValue() { return Environment.GetFolderPath(Environment.SpecialFolder.Desktop); } internal static void OnButtonClicked() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 VistaFolderBrowserDialog val = new VistaFolderBrowserDialog(); if ((int)((CommonDialog)val).ShowDialog() == 1 && !Utility.IsNullOrWhiteSpace(val.SelectedPath)) { GameHandler.Instance.SettingsHandler.GetSetting<RecordSaveSetting>().SetValue(val.SelectedPath, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); GameHandler.Instance.SettingsHandler.RegisterPage(); } } public void ApplyPatch(ref Harmony harmony) { harmony.PatchAll(typeof(Patch)); } } } namespace MoreSettings.Settings.Type { public interface IPatch { void ApplyPatch(ref Harmony harmony); } public abstract class StringSetting : Setting { public string Value { get; protected set; } public override SettingUI GetDebugUI(ISettingHandler settingHandler) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new SettingUI(); } public override void Load(ISettingsSaveLoad loader) { string value = default(string); if (loader.TryGetString(((object)this).GetType(), ref value)) { Value = value; return; } Debug.LogWarning((object)("Failed to load setting of type " + ((object)this).GetType().FullName + " from PlayerPrefs.")); Value = GetDefaultValue(); } protected abstract string GetDefaultValue(); public override GameObject GetSettingUICell() { return SingletonAsset<InputCellMapper>.Instance.KeyCodeSettingCell; } public override void Save(ISettingsSaveLoad saver) { saver.SaveString(((object)this).GetType(), Value); } public void SetValue(string value, ISettingHandler handler) { Value = value; ((Setting)this).ApplyValue(); handler.SaveSetting((Setting)(object)this); } } }