Пример #1
0
        private static void StoreStaredShooters(List <int> staredList, RangeClass rangeClass)
        {
            var filenameforrange = string.Format("StarShooters{0}.txt", rangeClass.ToString());
            var filename         = Path.Combine(m_starsDir, filenameforrange);
            var staredShooters   = staredList.Select(i => i.ToString()).ToArray();

            File.WriteAllLines(filename, staredShooters);
        }
Пример #2
0
        private static List <int> GetStoredStarShooter(RangeClass rangeClass)
        {
            var result           = new List <int>();
            var filenameforrange = string.Format("StarShooters{0}.txt", rangeClass.ToString());
            var filename         = Path.Combine(m_starsDir, filenameforrange);

            if (File.Exists(filename))
            {
                var allRegs = File.ReadAllLines(filename);
                foreach (var reg in allRegs)
                {
                    int shooterId;
                    if (int.TryParse(reg, out shooterId))
                    {
                        result.Add(shooterId);
                    }
                }
            }

            return(result);
        }