示例#1
0
 private void LoadItemInfoServer()
 {
     try
     {
         DataTable itemDataInf = null;
         using (DatabaseClient dbClient = Program.DatabaseManager.GetClient())
         {
             itemDataInf = dbClient.ReadDataTable("SELECT  *FROM data_iteminfoserver");
         }
         foreach (DataRow row in itemDataInf.Rows)
         {
             ushort   itemid = GetDataTypes.GetUshort(row["ID"]);
             ItemInfo item;
             if (ItemsByID.TryGetValue(itemid, out item))
             {
                 for (int i = 0; i < 3; i++)
                 {
                     string groupname = (string)row[dropGroupNames[i]];
                     if (groupname.Length > 2)
                     {
                         DropGroupInfo group;
                         if (DropGroups.TryGetValue(groupname, out group))
                         {
                             group.Items.Add(item);
                         }
                         else
                         {
                             // Log.WriteLine(LogLevel.Warn, "{0} was assigned to unknown DropGroup {1}.", item.InxName, groupname);
                         }
                     }
                 }
             }
             else
             {
                 Log.WriteLine(LogLevel.Warn, "ItemInfoServer has obsolete item ID: {0}.", itemid);
             }
         }
     }
     catch (Exception ex)
     {
         Log.WriteLine(LogLevel.Exception, "Error loading ItemInfoServer.shn: {0}", ex);
     }
 }
示例#2
0
 private void LoadItemInfoServer()
 {
     try
     {
         using (var reader = new DataTableReaderEx(new SHNFile(folder + @"\ItemInfoServer.shn")))
         {
             while (reader.Read())
             {
                 ushort   itemid = (ushort)reader.GetUInt32("ID");
                 ItemInfo item;
                 if (ItemsByID.TryGetValue(itemid, out item))
                 {
                     for (int i = 0; i < 3; i++)
                     {
                         string groupname = reader.GetString(DropGroupNames[i]);
                         if (groupname.Length > 2)
                         {
                             DropGroupInfo group;
                             if (DropGroups.TryGetValue(groupname, out group))
                             {
                                 group.Items.Add(item);
                             }
                             else
                             {
                                 //Log.WriteLine(LogLevel.Warn, "{0} was assigned to unknown DropGroup {1}.", item.InxName, groupname);
                             }
                         }
                     }
                 }
                 else
                 {
                     Log.WriteLine(LogLevel.Warn, "ItemInfoServer has obsolete item ID: {0}.", itemid);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.WriteLine(LogLevel.Exception, "Error loading ItemInfoServer.shn: {0}", ex);
     }
 }