private void _UpdateHeroInfo() { SkillNames.Clear(); heroNameChars.Clear(); if (Hero != null) { string name = Application.Current.TryFindResource(string.Format("Hero.{0}.Name", Hero.Name)) as string; if (name != null) { foreach (var heroChar in name) { if (heroNameChars.Count > 0 && (char.IsUpper(heroChar) || char.IsLower(heroChar)) && (char.IsUpper(heroNameChars.Last().Last()) || char.IsUpper(heroNameChars.Last().Last()))) { heroNameChars[heroNameChars.Count - 1] += heroChar; } else { heroNameChars.Add(heroChar.ToString()); } } } foreach (var skill in Hero.Skills) { SkillNames.Add(skill.GetType().Name); } } }
internal void UpdateSkillNames() { SkillNames.Clear(); foreach (var skill in SkillCommands) { SkillNames.Add(skill.Skill.GetType().Name); } }
public static bool Load(string path, string key) { SilkroadPath = GetSetting("SilkroadPath", path); MediaPk2Key = GetSetting("MediaPk2Key", key); if (string.IsNullOrEmpty(SilkroadPath) || string.IsNullOrEmpty(MediaPk2Key)) { if (!string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(key)) { SilkroadPath = GetSetting("SilkroadPath", path, true); MediaPk2Key = GetSetting("MediaPk2Key", key, true); } else { return(false); } } _reader = new Pk2Reader(SilkroadPath + @"\Media.pk2", MediaPk2Key); var isUpdate = GetSetting("GameVersion", 0); var needUpdate = isUpdate == 0 || isUpdate < Version(); GameVerison = GetSetting("GameVersion", Version(), needUpdate); GatewayPort = ushort.Parse(GetSetting("GatewayPort", GatePort(), needUpdate).ToString()); DivisionServers = DivisionInfo().ToList(); if (!needUpdate) { return(true); } LiteDatabase.DropCollection(Skills.Name); LiteDatabase.DropCollection(Items.Name); LoadTextData(); Skills.Insert(LoadSkillsData().GroupBy(x => x.Id).Select(x => x.OrderBy(y => y.Id).First())); Items.Insert(LoadItemsData().GroupBy(x => x.Id).Select(x => x.OrderBy(y => y.Id).First())); Characters.Insert(LoadCharacterData().GroupBy(x => x.Id).Select(x => x.OrderBy(y => y.Id).First())); ItemNames.Clear(); SkillNames.Clear(); CharacterNames.Clear(); RegionNames.Clear(); GC.Collect(); GC.WaitForPendingFinalizers(); return(true); }