コード例 #1
0
        /// <summary>
        /// Gets the SystemStringId for a particular system string.
        /// </summary>
        /// <param name="utf8String">The system string to get the enum id for.</param>
        /// <param name="systemStringId">The id of the system string if found.</param>
        /// <returns>The SystemStringId for a particular system string.</returns>
        public static bool TryGetSystemStringId(ReadOnlySpan <byte> utf8String, out int systemStringId)
        {
            int?id = SystemStrings.GetSystemStringId(utf8String);

            if (!id.HasValue)
            {
                systemStringId = default;
                return(false);
            }

            systemStringId = id.Value;
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Gets the SystemStringId for a particular system string.
        /// </summary>
        /// <param name="utf8Span">The system string to get the enum id for.</param>
        /// <param name="systemStringId">The id of the system string if found.</param>
        /// <returns>The SystemStringId for a particular system string.</returns>
        public static bool TryGetSystemStringId(Utf8Span utf8Span, out int systemStringId)
        {
            int?id = SystemStrings.GetSystemStringId(utf8Span);

            if (!id.HasValue)
            {
                systemStringId = default;
                return(false);
            }

            systemStringId = id.Value;
            return(true);
        }
コード例 #3
0
        private static string GetString(SystemStrings sysString)
        {
            string result = "";

            if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.ToLower() != "en" && MessageBoxEx.UseSystemLocalizedString)
            {
                try
                {
                    result = MB_GetString((int)sysString);
                }
                catch
                {
                    result = "";
                }
            }

            if (result == "")
            {
                result = GetLocalizedText(sysString);
            }

            return result;
        }
コード例 #4
0
        private static string GetLocalizedText(SystemStrings sysString)
        {
            string key = "";
            string result = null;
            if (sysString == SystemStrings.Abort)
            {
                result = "&Abort";
                key = LocalizationKeys.MessageBoxAbortButton;
            }
            else if (sysString == SystemStrings.Cancel)
            {
                result = "&Cancel";
                key = LocalizationKeys.MessageBoxCancelButton;
            }
            else if (sysString == SystemStrings.Close)
            {
                result = "C&lose";
                key = LocalizationKeys.MessageBoxCloseButton;
            }
            else if (sysString == SystemStrings.Continue)
            {
                result = "Co&ntinue";
                key = LocalizationKeys.MessageBoxContinueButton;
            }
            else if (sysString == SystemStrings.Help)
            {
                result = "&Help";
                key = LocalizationKeys.MessageBoxHelpButton;
            }
            else if (sysString == SystemStrings.Ignore)
            {
                result = "&Ignore";
                key = LocalizationKeys.MessageBoxIgnoreButton;
            }
            else if (sysString == SystemStrings.No)
            {
                result = "&No";
                key = LocalizationKeys.MessageBoxNoButton;
            }
            else if (sysString == SystemStrings.OK)
            {
                result = "&OK";
                key = LocalizationKeys.MessageBoxOkButton;
            }
            else if (sysString == SystemStrings.Retry)
            {
                result = "&Retry";
                key = LocalizationKeys.MessageBoxRetryButton;
            }
            else if (sysString == SystemStrings.TryAgain)
            {
                result = "&Try Again";
                key = LocalizationKeys.MessageBoxTryAgainButton;
            }
            else if (sysString == SystemStrings.Yes)
            {
                result = "&Yes";
                key = LocalizationKeys.MessageBoxYesButton;
            }

            if (key != null)
            {
                result = LocalizationManager.GetLocalizedString(key, result);
            }

            return result;
        }