Bloom.Book.XMatterInfo.GetDescription C# (CSharp) Method

GetDescription() public method

public GetDescription ( ) : string
return string
        public string GetDescription()
        {
            const string desc = "description";
            try
            {
                // try to read English XMatter pack description first
                // we need version number at least
                var pathEnglish = Path.Combine(PathToFolder, desc + "-en.txt");
                if (!RobustFile.Exists(pathEnglish))
                    return string.Empty;

                var englishDescription = RobustFile.ReadAllText(pathEnglish);
                if (!englishDescription.StartsWith("[V"))
                    return englishDescription;

                // Once we put [V1] in the english description we could have translations
                // for other UI languages.
                var uiLangId = LocalizationManager.UILanguageId;
                var enVersion = GetVersionNumberString(englishDescription);
                englishDescription = StripVersionOff(englishDescription);
                var pathUiLang = Path.Combine(PathToFolder, desc + "-" + uiLangId + ".txt");
                if (uiLangId == "en" || !RobustFile.Exists(pathUiLang))
                    return englishDescription;

                var uiLangDescription = RobustFile.ReadAllText(pathUiLang);
                var uiVersion = GetVersionNumberString(uiLangDescription);
                uiLangDescription = StripVersionOff(uiLangDescription);
                return enVersion > uiVersion || uiVersion == 0 || uiLangDescription.Length < 2 ? englishDescription : uiLangDescription;
            }
            catch (Exception error)
            {
                return error.Message;
            }
        }