Example #1
0
        public static void Load(WebsiteSetting websiteSetting)
        {
            WebsiteSetting settings;

            if (websiteSetting.IsDebugMode && websiteSetting.Debug != null)
            {
                settings             = websiteSetting.Debug;
                settings.IsDebugMode = true;
            }
            else
            {
                settings = websiteSetting;
            }

            ApplicationSettingManager.Load(settings);

            _websiteSetting = settings;
            var rountyInfoJson = JsonConvert.SerializeObject(websiteSetting.GoMoblinPortal);

            _goMoblinPortal = JsonConvert.DeserializeObject <GoMoblinPortal>(rountyInfoJson);



            var type       = _goMoblinPortal.GetType();
            var properties = type.GetProperties();

            foreach (var propertyInfo in properties)
            {
                if (propertyInfo.PropertyType == typeof(string))
                {
                    var propValue = propertyInfo.GetValue(_goMoblinPortal);
                    if (propValue == null)
                    {
                        continue;
                    }
                    var propStringVal = propValue.ToString();
                    //propStringVal = propStringVal.Replace("*|affiliateid|*", GoMoblinPortal.AffiliateId.ToString(), StringComparison.CurrentCultureIgnoreCase);
                    //propStringVal = propStringVal.Replace("*|apikey|*", GoMoblinPortal.APIKey, StringComparison.CurrentCultureIgnoreCase);
                    propertyInfo.SetValue(_goMoblinPortal, propStringVal);
                }
            }
            OnSettingChanged();
        }
        //[JsonIgnore]
        //public string Zubi { get; set; }

        public WebsiteSetting()
        {
            GoMoblinPortal = new GoMoblinPortal();
        }