Example #1
0
        public static IList <DataRow> ReadOneSoresFileToDataRows(string txtFileName)
        {
            DataTable      dt  = SharedData.CreateScoresDataTableWithDefaultColumns();
            List <DataRow> lst = new List <DataRow>();

            foreach (string line in File.ReadLines(txtFileName,
                                                   Encoding.GetEncoding("gb2312")))
            {
                lst.Add(SharedData.SplitScoreLineToRow(dt, line));
            }
            return(lst);
        }
Example #2
0
        public static void ReadAllSoresFileToDataRows()
        {
            Regex          reg = new Regex(@"录入成绩\d#\d.txt");
            DataTable      dt  = SharedData.CreateScoresDataTableWithDefaultColumns();
            List <DataRow> lst = new List <DataRow>();

            foreach (string scoreFileName in
                     Directory.GetFiles(Environment.CurrentDirectory, "*.txt")
                     .Where(x => reg.IsMatch(x)))
            {
                foreach (var row in SharedData.ReadOneSoresFileToDataRows(scoreFileName))
                {
                    lst.Add(row);
                }
            }
            SharedData.AllScoresDatarows = lst;
        }