IsRequired() public static méthode

public static IsRequired ( ) : bool
Résultat bool
Exemple #1
0
        // 1219:
        //   Mono prepends byte order mark (BOM) to StdIn.
        //   https://sourceforge.net/p/keepass/bugs/1219/
        // 1245:
        //   Key events not raised while Alt is down, and nav keys out of order.
        //   https://sourceforge.net/p/keepass/bugs/1245/
        // 1254:
        //   NumericUpDown bug: text is drawn below up/down buttons.
        //   https://sourceforge.net/p/keepass/bugs/1254/
        // 1354:
        //   Finalizer of NotifyIcon throws on Unity.
        //   See also 1574.
        //   https://sourceforge.net/p/keepass/bugs/1354/
        // 1358:
        //   FileDialog crashes when ~/.recently-used is invalid.
        //   https://sourceforge.net/p/keepass/bugs/1358/
        // 1366:
        //   Drawing bug when scrolling a RichTextBox.
        //   https://sourceforge.net/p/keepass/bugs/1366/
        // 1378:
        //   Mono doesn't implement Microsoft.Win32.SystemEvents events.
        //   https://sourceforge.net/p/keepass/bugs/1378/
        //   https://github.com/mono/mono/blob/master/mcs/class/System/Microsoft.Win32/SystemEvents.cs
        // 1418:
        //   Minimizing a form while loading it doesn't work.
        //   https://sourceforge.net/p/keepass/bugs/1418/
        // 1468:
        //   Use LibGCrypt for AES-KDF, because Mono's implementations
        //   of RijndaelManaged and AesCryptoServiceProvider are slow.
        //   https://sourceforge.net/p/keepass/bugs/1468/
        // 1527:
        //   Timer causes 100% CPU load.
        //   https://sourceforge.net/p/keepass/bugs/1527/
        // 1530:
        //   Mono's clipboard functions don't work properly.
        //   https://sourceforge.net/p/keepass/bugs/1530/
        // 1574:
        //   Finalizer of NotifyIcon throws on Mac OS X.
        //   See also 1354.
        //   https://sourceforge.net/p/keepass/bugs/1574/
        // 1632:
        //   RichTextBox rendering bug for bold/italic text.
        //   https://sourceforge.net/p/keepass/bugs/1632/
        // 1690:
        //   Removing items from a list view doesn't work properly.
        //   https://sourceforge.net/p/keepass/bugs/1690/
        // 2139:
        //   Shortcut keys are ignored.
        //   https://sourceforge.net/p/keepass/feature-requests/2139/
        // 2140:
        //   Explicit control focusing is ignored.
        //   https://sourceforge.net/p/keepass/feature-requests/2140/
        // 5795:
        //   Text in input field is incomplete.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=5795
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/d23dc88b/
        // 10163:
        //   WebRequest GetResponse call missing, breaks WebDAV due to no PUT.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=10163
        //   https://sourceforge.net/p/keepass/bugs/1117/
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/9422258c/
        //   https://github.com/mono/mono/commit/8e67b8c2fc7cb66bff7816ebf7c1039fb8cfc43b
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=1512
        //   https://sourceforge.net/p/keepass/patches/89/
        // 12525:
        //   PictureBox not rendered when bitmap height >= control height.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=12525
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/54f61e9a/
        // 100001:
        //   Control locations/sizes are invalid/unexpected.
        //   [NoRef]
        // 373134:
        //   Control.InvokeRequired doesn't always return the correct value.
        //   https://bugzilla.novell.com/show_bug.cgi?id=373134
        // 586901:
        //   RichTextBox doesn't handle Unicode string correctly.
        //   https://bugzilla.novell.com/show_bug.cgi?id=586901
        // 620618:
        //   ListView column headers not drawn.
        //   https://bugzilla.novell.com/show_bug.cgi?id=620618
        // 649266:
        //   Calling Control.Hide doesn't remove the application from taskbar.
        //   https://bugzilla.novell.com/show_bug.cgi?id=649266
        // 686017:
        //   Minimum sizes must be enforced.
        //   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686017
        // 801414:
        //   Mono recreates the main window incorrectly.
        //   https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/801414
        // 891029:
        //   Increase tab control height and don't use images on tabs.
        //   https://sourceforge.net/projects/keepass/forums/forum/329221/topic/4519750
        //   https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/891029
        //   https://sourceforge.net/p/keepass/bugs/1256/
        //   https://sourceforge.net/p/keepass/bugs/1566/
        //   https://sourceforge.net/p/keepass/bugs/1634/
        // 836428016:
        //   ListView group header selection unsupported.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/31dae0f0/
        // 2449941153:
        //   RichTextBox doesn't properly escape '}' when generating RTF data.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/920722a1/
        // 3471228285:
        //   Mono requires command line arguments to be encoded differently.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/cee6bd7d/
        // 3574233558:
        //   Problems with minimizing windows, no content rendered.
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/d50a79d6/
        public static bool IsRequired(uint uBugID)
        {
            if (!MonoWorkarounds.IsRequired())
            {
                return(false);
            }

            bool bForce;

            if (g_dForceReq.TryGetValue(uBugID, out bForce))
            {
                return(bForce);
            }

            ulong v = NativeLib.MonoVersion;

            if (v != 0)
            {
                if (uBugID == 10163)
                {
                    return(v >= 0x0002000B00000000UL);                      // >= 2.11
                }
            }

            return(true);
        }
        /// <summary>
        /// Ensure that the file ~/.recently-used is valid (in order to
        /// prevent Mono's FileDialog from crashing).
        /// </summary>
        internal static void EnsureRecentlyUsedValid()
        {
            if (!MonoWorkarounds.IsRequired(1358))
            {
                return;
            }

            try
            {
                string strFile = Environment.GetFolderPath(
                    Environment.SpecialFolder.Personal);
                strFile  = UrlUtil.EnsureTerminatingSeparator(strFile, false);
                strFile += ".recently-used";

                if (File.Exists(strFile))
                {
                    try
                    {
                        // Mono's WriteRecentlyUsedFiles method also loads the
                        // XML file using XmlDocument
                        XmlDocument xd = XmlUtilEx.CreateXmlDocument();
                        xd.Load(strFile);
                    }
                    catch (Exception)                    // The XML file is invalid
                    {
                        File.Delete(strFile);
                    }
                }
            }
            catch (Exception) { Debug.Assert(false); }
        }
        public static void Release(Form f)
        {
            if (!MonoWorkarounds.IsRequired())
            {
                return;
            }
            if (f == null)
            {
                Debug.Assert(false); return;
            }

#if !KeePassLibSD
            f.HandleCreated -= MonoWorkarounds.OnFormHandleCreated;

            ApplyToControlsRec(f.Controls, f, MonoWorkarounds.ReleaseControl);
#endif
        }
Exemple #4
0
        public static void ApplyTo(Form f)
        {
            if (!MonoWorkarounds.IsRequired())
            {
                return;
            }
            if (f == null)
            {
                Debug.Assert(false); return;
            }

#if (!KeePassLibSD && !KeePassRT)
            f.HandleCreated += MonoWorkarounds.OnFormHandleCreated;
            SetWmClass(f);

            ApplyToControlsRec(f.Controls, f, MonoWorkarounds.ApplyToControl);
#endif
        }
        private static void ApplyToControl(Control c, Form fContext)
        {
            Button btn = (c as Button);

            if (btn != null)
            {
                ApplyToButton(btn, fContext);
            }

            NumericUpDown nc = (c as NumericUpDown);

            if ((nc != null) && MonoWorkarounds.IsRequired(1254))
            {
                if (nc.TextAlign == HorizontalAlignment.Right)
                {
                    nc.TextAlign = HorizontalAlignment.Left;
                }
            }
        }
Exemple #6
0
        // 1219:
        //   Mono prepends byte order mark (BOM) to StdIn.
        //   https://sourceforge.net/p/keepass/bugs/1219/
        // 1245:
        //   Key events not raised while Alt is down, and nav keys out of order.
        //   https://sourceforge.net/p/keepass/bugs/1245/
        // 1254:
        //   NumericUpDown bug: text is drawn below up/down buttons.
        //   https://sourceforge.net/p/keepass/bugs/1254/
        // 1366:
        //   Drawing bug when scrolling a RichTextBox.
        //   https://sourceforge.net/p/keepass/bugs/1366/
        // 1378:
        //   Mono doesn't implement Microsoft.Win32.SystemEvents events.
        //   https://sourceforge.net/p/keepass/bugs/1378/
        //   https://github.com/mono/mono/blob/master/mcs/class/System/Microsoft.Win32/SystemEvents.cs
        // 5795:
        //   Text in input field is incomplete.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=5795
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/d23dc88b/
        // 10163:
        //   WebRequest GetResponse call missing, breaks WebDAV due to no PUT.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=10163
        //   https://sourceforge.net/p/keepass/bugs/1117/
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/9422258c/
        //   https://github.com/mono/mono/commit/8e67b8c2fc7cb66bff7816ebf7c1039fb8cfc43b
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=1512
        //   https://sourceforge.net/p/keepass/patches/89/
        // 12525:
        //   PictureBox not rendered when bitmap height >= control height.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=12525
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/54f61e9a/
        // 586901:
        //   RichTextBox doesn't handle Unicode string correctly.
        //   https://bugzilla.novell.com/show_bug.cgi?id=586901
        // 620618:
        //   ListView column headers not drawn.
        //   https://bugzilla.novell.com/show_bug.cgi?id=620618
        // 649266:
        //   Calling Control.Hide doesn't remove the application from taskbar.
        //   https://bugzilla.novell.com/show_bug.cgi?id=649266
        // 686017:
        //   Minimum sizes must be enforced.
        //   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686017
        // 801414:
        //   Mono recreates the main window incorrectly.
        //   https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/801414
        // 891029:
        //   Increase tab control height, otherwise Mono throws exceptions.
        //   https://sourceforge.net/projects/keepass/forums/forum/329221/topic/4519750
        //   https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/891029
        // 836428016:
        //   ListView group header selection unsupported.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/31dae0f0/
        // 3574233558:
        //   Problems with minimizing windows, no content rendered.
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/d50a79d6/
        public static bool IsRequired(uint uBugID)
        {
            if (!MonoWorkarounds.IsRequired())
            {
                return(false);
            }

            ulong v = NativeLib.MonoVersion;

            if (v != 0)
            {
                if (uBugID == 10163)
                {
                    return(v >= 0x0002000B00000000UL);                      // >= 2.11
                }
            }

            return(true);
        }
        // 106:
        //   Mono throws exceptions when no X server is running.
        //   https://sourceforge.net/p/keepass/patches/106/
        // 1219:
        //   Mono prepends byte order mark (BOM) to StdIn.
        //   https://sourceforge.net/p/keepass/bugs/1219/
        // 1245:
        //   Key events not raised while Alt is down, and nav keys out of order.
        //   https://sourceforge.net/p/keepass/bugs/1245/
        // 1254:
        //   NumericUpDown bug: text is drawn below up/down buttons.
        //   https://sourceforge.net/p/keepass/bugs/1254/
        // 1354:
        //   Finalizer of NotifyIcon throws on Unity.
        //   See also 1574.
        //   https://sourceforge.net/p/keepass/bugs/1354/
        // 1358:
        //   FileDialog crashes when ~/.recently-used is invalid.
        //   https://sourceforge.net/p/keepass/bugs/1358/
        // 1366:
        //   Drawing bug when scrolling a RichTextBox.
        //   https://sourceforge.net/p/keepass/bugs/1366/
        // 1378:
        //   Mono doesn't implement Microsoft.Win32.SystemEvents events.
        //   https://sourceforge.net/p/keepass/bugs/1378/
        //   https://github.com/mono/mono/blob/master/mcs/class/System/Microsoft.Win32/SystemEvents.cs
        // 1418:
        //   Minimizing a form while loading it doesn't work.
        //   https://sourceforge.net/p/keepass/bugs/1418/
        // 1468:
        //   Use LibGCrypt for AES-KDF, because Mono's implementations
        //   of RijndaelManaged and AesCryptoServiceProvider are slow.
        //   https://sourceforge.net/p/keepass/bugs/1468/
        // 1527:
        //   Timer causes 100% CPU load.
        //   https://sourceforge.net/p/keepass/bugs/1527/
        // 1530:
        //   Mono's clipboard functions don't work properly.
        //   https://sourceforge.net/p/keepass/bugs/1530/
        // 1574:
        //   Finalizer of NotifyIcon throws on Mac OS X.
        //   See also 1354.
        //   https://sourceforge.net/p/keepass/bugs/1574/
        // 1632:
        //   RichTextBox rendering bug for bold/italic text.
        //   https://sourceforge.net/p/keepass/bugs/1632/
        // 1690:
        //   Removing items from a list view doesn't work properly.
        //   https://sourceforge.net/p/keepass/bugs/1690/
        // 1710:
        //   Mono doesn't always raise the FormClosed event properly.
        //   https://sourceforge.net/p/keepass/bugs/1710/
        // 1716:
        //   'Always on Top' doesn't work properly on the Cinnamon desktop.
        //   https://sourceforge.net/p/keepass/bugs/1716/
        // 1760:
        //   Input focus is not restored when activating a form.
        //   https://sourceforge.net/p/keepass/bugs/1760/
        // 1976:
        //   Input focus cannot be set after unlocking.
        //   https://sourceforge.net/p/keepass/bugs/1976/
        // 2140:
        //   Explicit control focusing is ignored.
        //   https://sourceforge.net/p/keepass/feature-requests/2140/
        // 5795: [Fixed]
        //   Text in input field is incomplete.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=5795
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/d23dc88b/
        //   https://github.com/mono/mono/commit/1a79065f8cd9f128e6e527e5d573111f794ce288
        //   https://github.com/mono/mono/pull/5947
        // 9604:
        //   Trying to resolve a non-existing metadata token crashes Mono.
        //   https://github.com/mono/mono/issues/9604
        // 10163:
        //   WebRequest GetResponse call missing, breaks WebDAV due to no PUT.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=10163
        //   https://sourceforge.net/p/keepass/bugs/1117/
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/9422258c/
        //   https://github.com/mono/mono/commit/8e67b8c2fc7cb66bff7816ebf7c1039fb8cfc43b
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=1512
        //   https://sourceforge.net/p/keepass/patches/89/
        // 12525:
        //   PictureBox not rendered when bitmap height >= control height.
        //   https://bugzilla.xamarin.com/show_bug.cgi?id=12525
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/54f61e9a/
        // 19836:
        //   URLs/documents cannot be opened using Process.Start anymore
        //   (even when UseShellExecute = true).
        //   https://github.com/mono/mono/issues/19836
        // 100001:
        //   Control locations/sizes are invalid/unexpected.
        //   [NoRef]
        // 100002:
        //   TextChanged event isn't raised when the formatting changes.
        //   [NoRef]
        // 100003:
        //   Icon.ExtractAssociatedIcon always returns the same icon.
        //   [NoRef]
        // 190417:
        //   Mono's Process.Start method replaces '\\' by '/'.
        //   https://github.com/mono/mono/blob/master/mono/metadata/w32process-unix.c
        // 373134:
        //   Control.InvokeRequired doesn't always return the correct value.
        //   https://bugzilla.novell.com/show_bug.cgi?id=373134
        // 586901:
        //   RichTextBox doesn't handle Unicode string correctly.
        //   https://bugzilla.novell.com/show_bug.cgi?id=586901
        // 620618:
        //   ListView column headers not drawn.
        //   https://bugzilla.novell.com/show_bug.cgi?id=620618
        // 649266:
        //   Calling Control.Hide doesn't remove the application from taskbar.
        //   https://bugzilla.novell.com/show_bug.cgi?id=649266
        // 686017:
        //   Minimum sizes must be enforced.
        //   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686017
        // 688007: [Fixed]
        //   Credentials are required for anonymous web requests.
        //   https://bugzilla.novell.com/show_bug.cgi?id=688007
        //   https://sourceforge.net/p/keepass/bugs/1950/
        // 801414:
        //   Mono recreates the main window incorrectly.
        //   https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/801414
        // 891029:
        //   Increase tab control height and don't use images on tabs.
        //   https://sourceforge.net/projects/keepass/forums/forum/329221/topic/4519750
        //   https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/891029
        //   https://sourceforge.net/p/keepass/bugs/1256/
        //   https://sourceforge.net/p/keepass/bugs/1566/
        //   https://sourceforge.net/p/keepass/bugs/1634/
        // 836428016:
        //   ListView group header selection unsupported.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/31dae0f0/
        // 2449941153:
        //   RichTextBox doesn't properly escape '}' when generating RTF data.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/920722a1/
        // 3471228285:
        //   Mono requires command line arguments to be encoded differently.
        //   https://sourceforge.net/p/keepass/discussion/329221/thread/cee6bd7d/
        // 3574233558:
        //   Problems with minimizing windows, no content rendered.
        //   https://sourceforge.net/p/keepass/discussion/329220/thread/d50a79d6/
        public static bool IsRequired(uint uBugID)
        {
            if (!MonoWorkarounds.IsRequired())
            {
                return(false);
            }

            bool bForce;

            if (g_dForceReq.TryGetValue(uBugID, out bForce))
            {
                return(bForce);
            }

            ulong v = NativeLib.MonoVersion;

            if (v == 0)
            {
                return(true);
            }

            bool b = true;

            switch (uBugID)
            {
            case 5795:
                b = (v < 0x0005000A00000000UL); break;

            case 10163:
                b = (v >= 0x0002000B00000000UL); break;

            case 688007:
                b = (v < 0x0006000000000000UL); break;

            default: break;
            }

            return(b);
        }