Count() public method

public Count ( ) : int
return int
Example #1
0
 public void Load()
 {
     if (File.Exists(FileName))
     {
         using (StreamReader reader = File.OpenText(FileName)) {
             reader.ReadLine(); // header
             while (!reader.EndOfStream)
             {
                 string[] fields = reader.ReadLine().Split(',');
                 if (fields.Length == PlayerInfo.fieldCount)
                 {
                     try {
                         PlayerInfo info = new PlayerInfo(world, fields);
                         tree.Add(info.name, info);
                         list.Add(info);
                     } catch (FormatException ex) {
                         world.log.Log("PlayerDB.Load: Could not parse a record: {0}.", LogType.Error, ex.Message);
                     } catch (IOException ex) {
                         world.log.Log("PlayerDB.Load: Error while trying to read from file: {0}.", LogType.Error, ex.Message);
                     }
                 }
             }
         }
         world.log.Log("PlayerDB.Load: Done loading player DB ({0} records).", LogType.Debug, tree.Count());
     }
     else
     {
         world.log.Log("PlayerDB.Load: No player DB file found.", LogType.Warning);
     }
 }