Bloom.Book.BookStorage.GetHtmlMessageIfVersionIsIncompatibleWithThisBloom C# (CSharp) Méthode

GetHtmlMessageIfVersionIsIncompatibleWithThisBloom() public static méthode

public static GetHtmlMessageIfVersionIsIncompatibleWithThisBloom ( HtmlDom dom, string path ) : string
dom HtmlDom
path string
Résultat string
        public static string GetHtmlMessageIfVersionIsIncompatibleWithThisBloom(HtmlDom dom,string path)
        {
            var versionString = dom.GetMetaValue("BloomFormatVersion", "").Trim();
            if (string.IsNullOrEmpty(versionString))
                return "";// "This file lacks the following required element: <meta name='BloomFormatVersion' content='x.y'>";

            float versionFloat = 0;
            if (!float.TryParse(versionString, NumberStyles.Float, CultureInfo.InvariantCulture, out versionFloat))
                return "This file claims a version number that isn't really a number: " + versionString;

            if (versionFloat > float.Parse(kBloomFormatVersion, CultureInfo.InvariantCulture))
            {
                var msg = LocalizationManager.GetString("Errors.NeedNewerVersion",
                    "{0} requires a newer version of Bloom. Download the latest version of Bloom from {1}","{0} will get the name of the book, {1} will give a link to open the Bloom Library Web page.");
                msg = string.Format(msg, path, string.Format("<a href='{0}'>BloomLibrary.org</a>", UrlLookup.LookupUrl(UrlType.LibrarySite)));
                msg += string.Format(". (Format {0} vs. {1})",versionString, kBloomFormatVersion);
                return msg;
            }

            return null;
        }