Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            string fmt = "yyMMdd";

            if (args.Length == 1)
            {
                fmt = args[0];
            }
            TTaker.ReadTestType("testType.txt");
            Program.ReadMap("mapString.txt");
            foreach (string path in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.txt"))
            {
                string file = Path.GetFileName(path);
                if (fmt.Length < file.Length)
                {
                    string   d = file.Substring(0, fmt.Length);
                    DateTime dt;
                    if (DateTime.TryParseExact(d, "yyMMdd", CultureInfo.CurrentCulture, DateTimeStyles.None, out dt))
                    {
                        List <TTaker> takers = TTaker.ParseMultipleLines(File.ReadAllLines(file));
                        StringBuilder sb     = new StringBuilder();
                        Console.WriteLine("{0} takers {1}", file + ".txt", takers.Count);
                        foreach (TTaker t in takers)
                        {
                            sb.Append(t.ToString() + "\n");
                        }
                        File.WriteAllText(file + ".txt", sb.ToString());
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static List <TTaker> ParseMultipleLines(string[] lines)
        {
            List <TTaker> takers = new List <TTaker>();

            foreach (string line in lines)
            {
                if (TTaker.ParseTestDate(line))
                {
                    continue;
                }
                TTaker t = new TTaker();
                if (t.ParseLine(line))
                {
                    takers.Add(t);
                }
            }
            return(takers);
        }