public async void OnValidSubmit() { // Apply changes SettingConfig existingConfig = SettingsService.Settings.Where(x => string.Compare(x.Name, Name) == 0).FirstOrDefault(); if (existingConfig == null) { await jsRuntime.InvokeVoidAsync("alert", "Unexpected error. Config no longer exists"); } else { if (string.Compare(existingConfig.Name, Config.Name, true) != 0) { // Make sure another config with the new name does not already exist if (SettingsService.Settings.Count(x => string.Compare(x.Name, Config.Name, true) == 0 && x != existingConfig) > 0) { await jsRuntime.InvokeVoidAsync("alert", "A config with that name already exists. Please select another name and try again"); return; } } existingConfig.Name = Config.Name; existingConfig.Settings.Copy(Config.Settings); SettingsService.SaveConfigs(); } MoveBack(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseCors("TelerikReportingDemoPolicy"); app.UseRequestLocalization(); app.UseAuthentication(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseKendo(env); app.UseStaticFiles(); app.UseSession(); HttpHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>()); SettingConfig.InitilizeSettings(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
private void Load() { if (File.Exists(ConfigFilePath)) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(SettingConfig)); using (FileStream fileStream = File.OpenRead(ConfigFilePath)) { settingData = xmlSerializer.Deserialize(fileStream) as SettingConfig; } } else { Directory.CreateDirectory(Path.GetDirectoryName(ConfigFilePath)); } if (settingData == null) { settingData = new SettingConfig() { StartWithSystem = true, BlockScreenOff = true, BlockSystemSleep = true, NotAutoVisitTime = "", DelayHours = 12, URLTimedAccessList = new List <URLTimedAccess>() }; } if (settingData.URLTimedAccessList == null) { settingData.URLTimedAccessList = new List <URLTimedAccess>(); } }
private void ButGame_Click(object sender, EventArgs e) { Button but = sender as Button; int id = (int)but.Tag; GameSaveData data = CaroService.Storage.GameList.SingleOrDefault(x => x.id == id); if (data != null) { CaroService.Storage.CurrentIndex = id; SettingConfig.InitializeGameSaveSetting(data); CaroService.Player.PlayerName1 = data.PlayerName1; CaroService.Player.PlayerName2 = data.PlayerName2; CaroService.Player.Turn = data.Turn; CaroService.Action.ResetAction(); CaroService.Board.InitCaroBoard(); CaroService.Board.DrawCaroBoard(); CaroService.Winner.LoadSaveGame(data.Turn, data.CaroBoard); if (isSetting) { Control parent = this.Parent; parent.Hide(); } else { routes.Routing(Constants.MAIN); } } else { MessageBox.Show("Not Found Your Game", "Thông Báo", MessageBoxButtons.OK); } }
protected override void CancelBut_Click(object sender, EventArgs e) { SettingConfig.ResetSettingOption(); Control parent = this.Parent; parent.Hide(); }
public static void Postfix(CustomGameSettings __instance, SettingConfig config) { foreach (var tsetting in tsettings) { __instance.AddSettingConfig(tsetting); } }
public void AddSettingConfig(SettingConfig config) { QualitySettings.Add(config.id, config); if (!CurrentQualityLevelsBySetting.ContainsKey(config.id) || string.IsNullOrEmpty(CurrentQualityLevelsBySetting[config.id])) { CurrentQualityLevelsBySetting[config.id] = config.default_level_id; } }
/// <summary> /// 加密方法,默认MD5,如不同请重写 /// </summary> /// <param name="passWord"></param> /// <returns></returns> public virtual string EncryptPass(string passWord) { if (SettingConfig.RoleAuthorizeEncryptPass != null) { return(SettingConfig.RoleAuthorizeEncryptPass(passWord)); } return(CoreHelper.StringHelper.EncryptMD5(passWord)); }
/// <summary> /// 获取静态资源地址 /// </summary> /// <param name="path">路径</param> /// <returns></returns> public static string GetStaticUrl(string path) { return(StringHelper.FormatDefault( string.Format("{0}{1}?v={2}", SettingConfig.GetValue(KeyModel.Config.Setting.KeyStaticUrl, KeyModel.Config.Setting.GroupWebsite), path, VersionNo))); }
static public bool RegisterSetting(SettingConfig setting) { if (!tsettings.Contains(setting)) { tsettings.Add(setting); return(true); } return(false); }
/// <summary> /// 多语言资源文件初始 /// </summary> /// <param name="languages"></param> public static void LanguageResourceInit(List <CultureInfo> languages) { Assembly asm = Assembly.Load("App_GlobalResources"); foreach (var item in StringHelper.ToArray(SettingConfig.GetValue(KeyModel.Config.Setting.KeyResourceScript), new string[] { "," })) { #region 脚本资源文件处理 var itemArr = StringHelper.ToArray(item, new string[] { "|" }); if (!(itemArr != null && itemArr.Length == 2)) { continue; } Type resourceType = asm.GetType(itemArr[0]); ResourceManager resourceMgr = new ResourceManager(itemArr[0], asm); if (VerifyHelper.IsEmpty(resourceType) || VerifyHelper.IsEmpty(resourceMgr)) { continue; } foreach (var culture in languages) { string context = ScriptsHelper.GetJSONStringByList(ResourceHelper.GetList(resourceType, resourceMgr, culture), itemArr[1]); if (!VerifyHelper.IsEmpty(context)) { FileHelper.WriterFile(string.Format("{0}/{1}.{2}.js", HttpContext.Current.Server.MapPath(SettingConfig.GetValue(KeyModel.Config.Setting.KeyCulturePath, KeyModel.Config.Setting.GroupWebsite)), itemArr[1], culture), context); } } #endregion } foreach (var name in StringHelper.ToArray(SettingConfig.GetValue(KeyModel.Config.Setting.KeyResourceCache), new string[] { "," })) { #region 缓存资源文件处理 Type resourceType = asm.GetType(name); ResourceManager resourceMgr = new ResourceManager(name, asm); if (VerifyHelper.IsEmpty(resourceType) || VerifyHelper.IsEmpty(resourceMgr)) { continue; } foreach (var culture in languages) { var list = ResourceHelper.GetList(resourceType, resourceMgr, culture); if (!VerifyHelper.IsEmpty(list)) { CachingHelper.Set(string.Format("_RESOURCE_{0}_{1}", resourceType.FullName, culture), list); } } #endregion } }
public void CreateNewGame(int turn) { CaroService.Player.Turn = turn; CaroService.Action.ResetAction(); InitCaroBoard(); DrawCaroBoard(); SettingConfig.NewGame(); CaroService.Winner.NewGameHanlde(turn); }
private void AddLocationSetting() { SettingConfig location = new SettingConfig(); location.id = "1"; location.Name = "Open GPS"; location.ButtonName = "Open"; location.IsEnabled = WifiAdapter.Instance.IsGpsEnabled(); list.Add(location); }
private void AddWifiSetting() { SettingConfig wifi = new SettingConfig(); wifi.id = "3"; wifi.Name = "Turn On Wifi"; wifi.ButtonName = "Open"; wifi.IsEnabled = DependencyService.Get <IPlatformWifiManager>().IsWifiEnabled(); list.Add(wifi); }
private void AddMobiledataSetting() { SettingConfig mobileData = new SettingConfig(); mobileData.id = "4"; mobileData.Name = "Turn Off Mobile data"; mobileData.ButtonName = "Open"; mobileData.IsEnabled = DependencyService.Get <IPlatformWifiManager>().IsHotSpotEnabled(); list.Add(mobileData); }
DbContext getDbContext(string manageName) { var dbLocation = new CRL.DBLocation() { DataAccessType = DataAccessType.Default, ManageType = GetType(), ManageName = manageName }; var helper = SettingConfig.GetDBAccessBuild(dbLocation).GetDBHelper(); var dbContext = new DbContext(helper, dbLocation); return(dbContext); }
DbContext getDbContext() { var dbLocation = new CRL.DBLocation() { DataAccessType = DataAccessType.Read, ManageType = typeof(T) }; var helper = SettingConfig.GetDbAccess(dbLocation); var dbContext = new DbContext(helper, dbLocation); return(dbContext); }
private void AddHotspotSetting() { var list = new ObservableCollection <SettingConfig>(); SettingConfig hotspot = new SettingConfig(); hotspot.id = "2"; hotspot.Name = "Turn Off Hotspot"; hotspot.ButtonName = "Open"; hotspot.IsEnabled = DependencyService.Get <IPlatformWifiManager>().IsHotSpotEnabled(); list.Add(hotspot); }
internal override DbContext GetDbContext() { if (SettingConfig.GetDbAccess == null) { throw new CRLException("请配置CRL数据访问对象,实现CRL.SettingConfig.GetDbAccess"); } var helper = SettingConfig.GetDbAccess(dbLocation); var dbContext = new DbContext(helper, dbLocation); dbContext.ShardingMainDataIndex = mainDataIndex; dbContext.UseSharding = true; return(dbContext); }
/// <summary> /// 获取描述信息(无HTML) /// </summary> /// <param name="content"></param> /// <param name="length"></param> /// <param name="startIndex"></param> /// <returns></returns> public static string GetDescript(string content, int length = 0, int startIndex = 0) { if (VerifyHelper.IsEmpty(content)) { return(""); } if (length == 0) { length = IntHelper.Get(SettingConfig.GetValue(KeyModel.Config.Setting.KeyDescriptLength)); } content = HtmlsHelper.Remove(HtmlsHelper.Decode(content)); return(StringHelper.ToCutString(content, length, startIndex: startIndex)); }
private void SettingChanged(SettingConfig config, SettingLevel level) { coordinate.text = CustomGameSettings.Instance.GetSettingsCoordinate(); string setting = newGameSettings.GetSetting(CustomGameSettingConfigs.World); string setting2 = newGameSettings.GetSetting(CustomGameSettingConfigs.WorldgenSeed); int.TryParse(setting2, out int result); ColonyDestinationAsteroidData colonyDestinationAsteroidData = destinationMapPanel.SelectAsteroid(setting, result); DebugUtil.LogArgs("Selected asteroid", setting, result); destinationProperties.SetDescriptors(colonyDestinationAsteroidData.GetParamDescriptors()); startLocationProperties.SetDescriptors(colonyDestinationAsteroidData.GetTraitDescriptors()); }
internal override DbContext GetDbContext() { //if (SettingConfig.DbAccessCreaterCache.Count == 0) //{ // throw new CRLException("请配置CRL数据访问对象,实现CRL.SettingConfig.GetDbAccess"); //} dbLocation.ManageName = ManageName; var helper = SettingConfig.GetDBAccessBuild(dbLocation).GetDBHelper(); var dbContext = new DbContext(helper, dbLocation); dbContext.UseSharding = true; return(dbContext); }
/// <summary> /// 获取会员中心路径 /// </summary> /// <returns></returns> public static string GetMemberPath(bool isRouteFormat = false) { var path = StringHelper.Get(SettingConfig.GetValue(KeyModel.Config.Setting.KeyMemberPath, KeyModel.Config.Setting.GroupWebsite)); while (path.IndexOf("//") > -1) { path = path.Replace("//", "/"); } if (isRouteFormat) { path = path.Replace("/", "|"); } return(path); }
public static void Prefix(ref int width, ref int height) { Debug.Log(" === GridSettings_ResetMod INI === "); // 8x12 default // if () { width = 12 * 32; height = 16 * 32; } return; // ModConfig Config = new ModConfig(ModName); // return; if (Game.Instance == null) { return; } SettingConfig settingConfig = Game.Instance.customSettings.QualitySettings[UseCustomWorldSize]; SettingLevel currentQualitySetting = Game.Instance.customSettings.GetCurrentQualitySetting(UseCustomWorldSize); bool allowCustomSize = settingConfig?.IsDefaultLevel(currentQualitySetting.id) == true; if (!allowCustomSize) { return; } SettingLevel currentQualitySettingX = Game.Instance.customSettings.GetCurrentQualitySetting(WorldsizeX); SettingLevel currentQualitySettingY = Game.Instance.customSettings.GetCurrentQualitySetting(WorldsizeY); if (Int32.TryParse(currentQualitySettingX.id, out width)) { width *= 32; } if (Int32.TryParse(currentQualitySettingY.id, out height)) { height *= 32; } // if (Config.Enabled && Config.CustomWorldSize) //{ // width = Config.width; // height = Config.height; //} }
public static string Query(LambdaQuery.CRLQueryExpression queryExpression) { if (SettingConfig.ExpressionQueryData == null) { throw new Exception("请实现SettingConfig.ExpressionQueryData"); } var data = SettingConfig.ExpressionQueryData(queryExpression); var result = new ResultData() { Data = data, Total = queryExpression.Total }; return(CoreHelper.StringHelper.SerializerToJson(result)); }
public string GetSettingLevelTooltip(string setting_id, string level_id) { SettingConfig settingConfig = QualitySettings[setting_id]; if (settingConfig != null) { SettingLevel level = settingConfig.GetLevel(level_id); if (level != null) { return(level.tooltip); } } Debug.LogWarning("No tooltip string for setting: " + setting_id + " level: " + level_id); return(string.Empty); }
void IDoubleXHosting.OnInit(HttpApplication applaction) { base.OnInit(applaction); //语言资源文件初始 WarmupHelper.LanguageResourceInit(Languages); //初始全局RedisCient RedisHelper.Init(SettingConfig.GetValue(KeyModel.Config.Setting.KeyRedisDefault)); //初始Log4net日志配置 log4net.Config.XmlConfigurator.Configure(); //模块加载(暂默认全部) }
private string GetOtherSettingsCode() { int num = 0; foreach (KeyValuePair <string, string> item in CurrentQualityLevelsBySetting) { SettingConfig settingConfig = QualitySettings[item.Key]; if (settingConfig.coordinate_dimension >= 0 && settingConfig.coordinate_dimension_width >= 0) { SettingLevel level = settingConfig.GetLevel(item.Value); int num2 = settingConfig.coordinate_dimension * level.coordinate_offset; num += num2; } } return(Base10toBase36(num)); }
/// <summary> /// 退款处理 /// </summary> /// <param name="order"></param> public void RefundOrder(PayHistory order) { if (order.Status != OrderStatus.已确认) { return; } object[] parames = new object[] { order.Id }; try { SetRefundStatus(parames); } catch (Exception ero) { CoreHelper.EventLog.Log("更新订单为已退款时发生错误,orderId:" + order.Id + "\t" + ero, true); CoreHelper.Reflection.DynamicVisitor.AddMechodCacheByHandler(SetRefundStatus, parames); } SettingConfig.OnlinePayOrderRefund(order); }
public static void Prefix(ref int width, ref int height) { // 256x512 default Debug.Log(" === CWS: Using custom world size ... === "); //if (!CustomGameSettings.Get().is_custom_game) //if (!CustomGameSettings.Instance.is_custom_game) Debug.Log(" === " + CustomGameSettings.Instance.customGameMode + " === "); if (CustomGameSettings.Instance.customGameMode != CustomGameSettings.CustomGameMode.Custom) { Debug.Log(" === CWS: Nah, no custom game ... === "); return; } //SettingConfig settingConfig = CustomGameSettings.Get().QualitySettings[CustomWorldMod.UseCustomWorldSize]; SettingConfig settingConfig = CustomGameSettings.Instance.QualitySettings[CustomWorldMod.UseCustomWorldSize]; SettingLevel currentQualitySetting = //CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldMod.UseCustomWorldSize); CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldMod.UseCustomWorldSize); bool allowCustomSize = !settingConfig.IsDefaultLevel(currentQualitySetting.id); if (!allowCustomSize) { Debug.Log(" === CWS: No custom size allowed ... === "); return; } //SettingLevel currentQualitySettingX = CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldMod.WorldsizeX); //SettingLevel currentQualitySettingY = CustomGameSettings.Get().GetCurrentQualitySetting(CustomWorldMod.WorldsizeY); SettingLevel currentQualitySettingX = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldMod.WorldsizeX); SettingLevel currentQualitySettingY = CustomGameSettings.Instance.GetCurrentQualitySetting(CustomWorldMod.WorldsizeY); Int32.TryParse(currentQualitySettingX.id, out width); Int32.TryParse(currentQualitySettingY.id, out height); Debug.Log(" === CWS: Using " + width + "/" + height + " as new world size === "); // if (Config.Enabled && Config.CustomWorldSize) //{ // width = Config.width; // height = Config.height; //} }