Bloom.Api.BrandingApi.GetSettings C# (CSharp) Method

GetSettings() public static method

branding folders can optionally contain a settings.json file which aligns with this Settings class
public static GetSettings ( string brandingNameOrFolderPath ) : Settings
brandingNameOrFolderPath string Normally, the branding is just a name, which we look up in the official branding folder //but unit tests can instead provide a path to the folder. ///
return Settings
        public static Settings GetSettings(string brandingNameOrFolderPath)
        {
            try
            {
                var settingsPath = BloomFileLocator.GetOptionalBrandingFile(brandingNameOrFolderPath, "settings.json");
                if(!string.IsNullOrEmpty(settingsPath))
                {
                    var content = RobustFile.ReadAllText(settingsPath);
                    var settings = JsonConvert.DeserializeObject<Settings>(content);
                    if(settings == null)
                    {
                        NonFatalProblem.Report(ModalIf.Beta, PassiveIf.All, "Trouble reading branding settings",
                            "settings.json of the branding " + brandingNameOrFolderPath + " may be corrupt. It had: " + content);
                        return null;
                    }
                    return settings;
                }
            }
            catch(Exception e)
            {
                NonFatalProblem.Report(ModalIf.Beta, PassiveIf.All, "Trouble reading branding settings", exception: e);
            }
            return null;
        }