示例#1
0
        private void LoadActiveSkills()
        {
            ActiveSkillsByID   = new Dictionary <ushort, ActiveSkillInfo>();
            ActiveSkillsByName = new Dictionary <string, ActiveSkillInfo>();
            DataTable activeSkillData = null;

            using (var dbClient = Program.DatabaseManager.GetClient())
            {
                activeSkillData = dbClient.ReadDataTable("SELECT  *FROM activeskill");
            }

            if (activeSkillData != null)
            {
                foreach (DataRow row in activeSkillData.Rows)
                {
                    var info = ActiveSkillInfo.Load(row);
                    if (ActiveSkillsByID.ContainsKey(info.ID) || ActiveSkillsByName.ContainsKey(info.Name))
                    {
                        Log.WriteLine(LogLevel.Warn, "Duplicate ActiveSkill found: {0} ({1})", info.ID, info.Name);
                        continue;
                    }

                    ActiveSkillsByID.Add(info.ID, info);
                    ActiveSkillsByName.Add(info.Name, info);
                }
            }

            Log.WriteLine(LogLevel.Info, "Loaded {0} ActiveSkills.", ActiveSkillsByID.Count);
        }
示例#2
0
 private void LoadActiveSkills()
 {
     ActiveSkillsByID   = new Dictionary <ushort, ActiveSkillInfo>();
     ActiveSkillsByName = new Dictionary <string, ActiveSkillInfo>();
     using (var file = new SHNFile(folder + @"\ActiveSkill.shn"))
     {
         using (DataTableReaderEx reader = new DataTableReaderEx(file))
         {
             while (reader.Read())
             {
                 ActiveSkillInfo info = ActiveSkillInfo.Load(reader);
                 if (ActiveSkillsByID.ContainsKey(info.ID) || ActiveSkillsByName.ContainsKey(info.Name))
                 {
                     Log.WriteLine(LogLevel.Warn, "Duplicate ActiveSkill found: {0} ({1})", info.ID, info.Name);
                     continue;
                 }
                 ActiveSkillsByID.Add(info.ID, info);
                 ActiveSkillsByName.Add(info.Name, info);
             }
         }
     }
     Log.WriteLine(LogLevel.Info, "Loaded {0} ActiveSkills.", ActiveSkillsByID.Count);
 }