Exemplo n.º 1
0
        private void updateConfig(ConfigInfo info, Config config)
        {
            if (info.Language != null && !PlainText.AcceptLanguage(info.Language))
            {
                throw Error.LanguageUnknown.Throw();
            }

            if (info.TimeZone != null && !TZ.IsValid(info.TimeZone))
            {
                throw Error.TimeZoneUnknown.Throw();
            }

            if (!String.IsNullOrEmpty(info.Language))
            {
                config.Language = info.Language;
            }

            if (!String.IsNullOrEmpty(info.TimeZone))
            {
                config.TimeZone = info.TimeZone;
            }

            if (info.UseCategories.HasValue)
            {
                config.UseCategories = info.UseCategories.Value;
            }

            if (info.UseAccountsSigns.HasValue)
            {
                config.UseAccountsSigns = info.UseAccountsSigns.Value;
            }

            if (info.MoveCheck.HasValue)
            {
                config.MoveCheck = info.MoveCheck.Value;
            }

            if (info.SendMoveEmail.HasValue)
            {
                config.SendMoveEmail = info.SendMoveEmail.Value;
            }

            if (info.Wizard.HasValue)
            {
                config.Wizard = info.Wizard.Value;
            }

            repos.Config.Update(config);
        }