public IActionResult SaveItem(SYSConfig model) { string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); SYSConfigModel data = new SYSConfigModel() { Item = model }; if (ModelState.IsValid) { SYSParamsService.SaveConfig(model); TempData["MessageSuccess"] = "Cập nhật thành công"; return(RedirectToAction("SaveItem")); } return(View(data)); }
/// <summary> /// 获取系统配置 /// </summary> /// <returns>SYS.Model.SYSConfig 系统配置表Model</returns> public SYS.Model.SYSConfig Get_SYSConfig() { string sql = "select * from sysconfig"; SYS.Model.SYSConfig sys = new SYSConfig(); DataTable dt = new DataTable(); try { dt = DBHelperSQL.GetDataTable(sql, CommandType.Text); if (dt.Rows.Count > 0) { sys.DYSJ = dt.Rows[0]["DYSJ"].ToString(); int a = 0; int.TryParse(dt.Rows[0]["FCFS"].ToString(), out a); sys.FCFS = a; a = 0; int.TryParse(dt.Rows[0]["QXZ"].ToString(), out a); sys.QXZ = a; a = 0; int.TryParse(dt.Rows[0]["DYJCCS"].ToString(), out a); sys.DYJCCS = a; a = 0; int.TryParse(dt.Rows[0]["Interval"].ToString(), out a); if (a == 0) { sys.Interval = 100; } else { sys.Interval = a; } } return(sys); } catch (Exception) { throw; } }
static SystemConfig() { if (!File.Exists(CONFIG_FILE)) { SYS = new SYSConfig { VERSION = "2.1.3", ADDITIONAL_EFFECTS = 0, BNS_DIR = @"C:\Program Files (x86)\NCSOFT\BNS", UPK_DIR = "", MAIN_UPKS = new string[] { "00003814.upk", "00006660.upk", "00007242.upk", "00007307.upk", "00008841.upk", "00008904.upk", "00009393.upk", "00009801.upk", "00009812.upk", "00010354.upk", "00010504.upk", "00010771.upk", "00010772.upk", "00010869.upk", "00011949.upk", "00012009.upk", "00013263.upk", "00023411.upk", "00023412.upk", "00024690.upk", "00026129.upk", "00031769.upk", "00034433.upk", "00056127.upk", "00059534.upk", "00060548.upk", "00060549.upk", "00060550.upk", "00060551.upk", "00060552.upk", "00060553.upk", "00060554.upk", "00060555.upk", "00060556.upk", "00060557.upk", "00060558.upk", "00060729.upk", "00064738.upk", "00064821.upk", "00067307.upk", "00069254.upk", "00072638.upk", "00072639.upk", "00072642.upk" }, ADDITIONAL_UPKS = new string[] { "00068626.upk", "00068628.upk" }, ANIMATION_UPKS = new List <ANIMATION_UPKS_STRUCT> { new ANIMATION_UPKS_STRUCT() { CLASS = "Assassin", UPK_FILES = new string[] { "00007916.upk", "00056572.upk", "00068516.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Summoner", UPK_FILES = new string[] { "00007917.upk", "00056573.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "KungFuMaster", UPK_FILES = new string[] { "00007912.upk", "00056568.upk", "00064820.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Gunslinger", UPK_FILES = new string[] { "00007915.upk", "00056571.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Destroyer", UPK_FILES = new string[] { "00007914.upk", "00056570.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Forcemaster", UPK_FILES = new string[] { "00007913.upk", "00056569.upk", "00068626.upk", "00068628.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Soulfighter", UPK_FILES = new string[] { "00034408.upk", "00056576.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Archer", UPK_FILES = new string[] { "00064736.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Blademaster", UPK_FILES = new string[] { "00007911.upk", "00056567.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Bladedancer", UPK_FILES = new string[] { "00018601.upk", "00056574.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Warlock", UPK_FILES = new string[] { "00023439.upk", "00056575.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Warden", UPK_FILES = new string[] { "00056577.upk", "00056126.upk", "00056566.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Astromancer", UPK_FILES = new string [] { "00076159.upk", "00069237.upk", "00069238.upk" } } } }; string _JSON = JsonConvert.SerializeObject(SYS, Formatting.Indented); File.WriteAllText(CONFIG_FILE, _JSON); } else { string _JSON = File.ReadAllText(CONFIG_FILE); SYS = JsonConvert.DeserializeObject <SYSConfig>(_JSON); SYS.ANIMATION_UPKS = new List <ANIMATION_UPKS_STRUCT>() { new ANIMATION_UPKS_STRUCT() { CLASS = "Assassin", UPK_FILES = new string[] { "00007916.upk", "00056572.upk", "00068516.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Summoner", UPK_FILES = new string[] { "00007917.upk", "00056573.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "KungFuMaster", UPK_FILES = new string[] { "00007912.upk", "00056568.upk", "00064820.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Gunslinger", UPK_FILES = new string[] { "00007915.upk", "00056571.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Destroyer", UPK_FILES = new string[] { "00007914.upk", "00056570.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Forcemaster", UPK_FILES = new string[] { "00007913.upk", "00056569.upk", "00068626.upk", "00068628.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Soulfighter", UPK_FILES = new string[] { "00034408.upk", "00056576.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Archer", UPK_FILES = new string[] { "00064736.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Blademaster", UPK_FILES = new string[] { "00007911.upk", "00056567.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Bladedancer", UPK_FILES = new string[] { "00018601.upk", "00056574.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Warlock", UPK_FILES = new string[] { "00023439.upk", "00056575.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Warden", UPK_FILES = new string[] { "00056577.upk", "00056126.upk", "00056566.upk" } }, new ANIMATION_UPKS_STRUCT() { CLASS = "Astromancer", UPK_FILES = new string [] { "00076159.upk", "00069237.upk", "00069238.upk" } } }; appendChangesToConfig(); } }
static SystemConfig() { string[] ihatemylife = new string[] { "00009393.upk", "00010869.upk", "00009812.upk", "00003814.upk", "00007242.upk", "00008904.upk", "00024690.upk", "00059534.upk", "00010772.upk", "00011949.upk", "00012009.upk", "00026129.upk", "00061144.upk" }; if (!File.Exists(CONFIG_FILE)) { SYS = new SYSConfig { VERSION = "3.2.2", FINGERPRINT = null, ADDITIONAL_EFFECTS = 0, PATCH_310 = 0, BNS_DIR = "", MAIN_UPKS = ihatemylife, DELTA_PATCHING = 1, NEW_GAME_OPTION = 0, UPDATER_THREADS = 0, MINIMZE_ACTION = 1, PING_CHECK = 1, patch32 = 1, patch64 = 1, CLASSES = new List <BNS_CLASS_STRUCT> { new BNS_CLASS_STRUCT() { CLASS = "Assassin", EFFECTS = new string[] { "00010504.upk", "00060553.upk", "00069254.upk" }, ANIMATIONS = new string[] { "00007916.upk", "00056572.upk", "00068516.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Summoner", EFFECTS = new string[] { "00006660.upk", "00060554.upk", "00080169.upk" }, ANIMATIONS = new string[] { "00007917.upk", "00056573.upk", "00080266.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "KungFuMaster", EFFECTS = new string[] { "00060549.upk", "00010771.upk", "00064821.upk" }, ANIMATIONS = new string[] { "00007912.upk", "00056568.upk", "00064820.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Gunslinger", EFFECTS = new string[] { "00007307.upk", "00060552.upk" }, ANIMATIONS = new string[] { "00007915.upk", "00056571.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Destroyer", EFFECTS = new string[] { "00008841.upk", "00060551.upk", "00067307.upk" }, ANIMATIONS = new string[] { "00007914.upk", "00056570.upk", "00068515.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Forcemaster", EFFECTS = new string[] { "00009801.upk", "00060550.upk", "00072638.upk" }, ANIMATIONS = new string[] { "00007913.upk", "00056569.upk", "00068626.upk", "00068628.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Soulfighter", EFFECTS = new string[] { "00034433.upk", "00060557.upk" }, ANIMATIONS = new string[] { "00034408.upk", "00056576.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Archer", EFFECTS = new string[] { "00064738.upk", "00068166.upk" }, ANIMATIONS = new string[] { "00064736.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Blademaster", EFFECTS = new string[] { "00010354.upk", "00013263.upk", "00060548.upk" }, ANIMATIONS = new string[] { "00007911.upk", "00056567.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Bladedancer", EFFECTS = new string[] { "00031769.upk", "00060555.upk", "00072644.upk", "00072646.upk" }, ANIMATIONS = new string[] { "00018601.upk", "00056574.upk", "00078303.upk", "00078533.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Warlock", EFFECTS = new string[] { "00023411.upk", "00023412.upk", "00060556.upk", "00060729.upk" }, ANIMATIONS = new string[] { "00023439.upk", "00056575.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Warden", EFFECTS = new string[] { "00056127.upk", "00060558.upk", "00020753.upk" }, ANIMATIONS = new string[] { "00056577.upk", "00056126.upk", "00056566.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Astromancer", EFFECTS = new string[] { "00072639.upk", "00072642.upk" }, ANIMATIONS = new string[] { "00076159.upk", "00069237.upk", "00069238.upk" } } } }; string _JSON = JsonConvert.SerializeObject(SYS, Formatting.Indented); File.WriteAllText(CONFIG_FILE, _JSON); } else { try { string _JSON = File.ReadAllText(CONFIG_FILE); SYS = JsonConvert.DeserializeObject <SYSConfig>(_JSON); //This whole section is for patching older clients, eventually will remove. if (SYS.CLASSES == null) { SYS.CLASSES = new List <BNS_CLASS_STRUCT>() { } } ; //Hotfix if (SYS.CLASSES.Count < 1) { SYS.CLASSES = new List <BNS_CLASS_STRUCT> { new BNS_CLASS_STRUCT() { CLASS = "Assassin", EFFECTS = new string[] { "00010504.upk", "00060553.upk", "00069254.upk" }, ANIMATIONS = new string[] { "00007916.upk", "00056572.upk", "00068516.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Summoner", EFFECTS = new string[] { "00006660.upk", "00060554.upk", "00080169.upk" }, ANIMATIONS = new string[] { "00007917.upk", "00056573.upk", "00080266.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "KungFuMaster", EFFECTS = new string[] { "00060549.upk", "00010771.upk", "00064821.upk" }, ANIMATIONS = new string[] { "00007912.upk", "00056568.upk", "00064820.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Gunslinger", EFFECTS = new string[] { "00007307.upk", "00060552.upk" }, ANIMATIONS = new string[] { "00007915.upk", "00056571.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Destroyer", EFFECTS = new string[] { "00008841.upk", "00060551.upk", "00067307.upk" }, ANIMATIONS = new string[] { "00007914.upk", "00056570.upk", "00068515.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Forcemaster", EFFECTS = new string[] { "00009801.upk", "00060550.upk", "00072638.upk" }, ANIMATIONS = new string[] { "00007913.upk", "00056569.upk", "00068626.upk", "00068628.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Soulfighter", EFFECTS = new string[] { "00034433.upk", "00060557.upk" }, ANIMATIONS = new string[] { "00034408.upk", "00056576.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Archer", EFFECTS = new string[] { "00064738.upk", "00068166.upk" }, ANIMATIONS = new string[] { "00064736.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Blademaster", EFFECTS = new string[] { "00010354.upk", "00013263.upk", "00060548.upk" }, ANIMATIONS = new string[] { "00007911.upk", "00056567.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Bladedancer", EFFECTS = new string[] { "00031769.upk", "00060555.upk", "00072644.upk", "00072646.upk" }, ANIMATIONS = new string[] { "00018601.upk", "00056574.upk", "00078303.upk", "00078533.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Warlock", EFFECTS = new string[] { "00023411.upk", "00023412.upk", "00060556.upk", "00060729.upk" }, ANIMATIONS = new string[] { "00023439.upk", "00056575.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Warden", EFFECTS = new string[] { "00056127.upk", "00060558.upk", "00020753.upk" }, ANIMATIONS = new string[] { "00056577.upk", "00056126.upk", "00056566.upk" } }, new BNS_CLASS_STRUCT() { CLASS = "Astromancer", EFFECTS = new string[] { "00072639.upk", "00072642.upk" }, ANIMATIONS = new string[] { "00076159.upk", "00069237.upk", "00069238.upk" } } }; } if (SYS.PATCH_321 == 0) { int ind = SYS.CLASSES.FindIndex(x => x.CLASS == "Summoner"); if (ind != -1) { SYS.CLASSES[ind].EFFECTS = new string[] { "00006660.upk", "00060554.upk", "00080169.upk" }; SYS.CLASSES[ind].ANIMATIONS = new string[] { "00007917.upk", "00056573.upk", "00080266.upk" }; SYS.PATCH_321 = 1; } } if (SYS.PATCH_310 == 0) { int ind = SYS.CLASSES.FindIndex(x => x.CLASS == "Bladedancer"); if (ind != -1) { SYS.CLASSES[ind].EFFECTS = new string[] { "00031769.upk", "00060555.upk", "00072644.upk", "00072646.upk" }; SYS.CLASSES[ind].ANIMATIONS = new string[] { "00018601.upk", "00056574.upk", "00078303.upk", "00078533.upk" }; } SYS.PING_CHECK = 1; SYS.DELTA_PATCHING = 1; //Patch use-ingame-login.xml with KR entry and syntax fix. string xml_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "BnS", "patches", "use-ingame-login.xml"); if (File.Exists(xml_path)) { File.Delete(xml_path); File.WriteAllText(xml_path, Properties.Resources.use_ingame_login); } } appendChangesToConfig(); } catch (Exception) { var dialog = new ErrorPrompt("There was an error reading the config file: settings.json\rIf error persists delete settings.json or check for syntax errors."); dialog.ShowDialog(); Environment.Exit(0); } } }