/// <summary> /// Обновление статистики /// </summary> /// <param name="machine"></param> static void AddStat(string machine) { Stat m = Stats.Find(o => o.Name == machine); if (m == null) { m = new Stat(machine); Stats.Add(m); } m.Num++; }
/// <summary> /// Загрузка статистики /// </summary> static void LoadStat() { using (StreamReader file = File.OpenText("Statistics.txt")) { int c = 0; try { c = Convert.ToInt32(file.ReadLine()); } catch { } for (int i = 0; i < c; i++) { try { Stat m = new Stat(file.ReadLine()); m.Num = Convert.ToInt32(file.ReadLine()); Stats.Add(m); } catch { } } } }