Beispiel #1
0
        public void WriteFile()
        {
            IToolSetting parent    = new MockToolSetting();
            CsvFile      readFile  = new CsvFile();
            CsvFile      writeFile = new CsvFile();

            writeFile.ShowProgress = false;
            readFile.ShowProgress  = false;
            readFile.ID            = "Read";
            readFile.FileName      = System.IO.Path.Combine(m_ApplicationDirectory, "BasicCSV.txt");
            readFile.ColumnFormatAdd(new ColumnFormat
            {
                Name     = "ExamDate",
                DataType = DataType.DateTime,
                Convert  = true
            });
            readFile.GetColumnFormat("ExamDate").ValueFormat.DateFormat = "dd/MM/yyyy";
            readFile.FileFormat.CommentLine = "#";
            readFile.ColumnFormatAdd(new ColumnFormat
            {
                Name     = "Score",
                DataType = DataType.Integer,
                Convert  = true
            });

            readFile.ColumnFormatAdd(new ColumnFormat
            {
                Name     = "Proficiency",
                DataType = DataType.Numeric,
                Convert  = true
            });

            readFile.ColumnFormatAdd(new ColumnFormat
            {
                Name       = "IsNativeLang",
                DataType   = DataType.Boolean,
                IgnoreRead = true,
                Convert    = true
            });

            parent.Input.Add(readFile);

            writeFile    = new CsvFile();
            writeFile.ID = "Write";
            writeFile.ConnectionString = "Read";
            writeFile.Parent           = parent;
            writeFile.ColumnFormatAdd(new ColumnFormat
            {
                Name     = "ExamDate",
                DataType = DataType.DateTime,
                TimePart = "ExamTime"
            });
            writeFile.GetColumnFormat("ExamDate").ValueFormat.DateFormat = "MM/dd/yyyy";
            writeFile.FileName = System.IO.Path.Combine(m_ApplicationDirectory, "BasicCSVOut.txt");

            m_ComHelper.WriteFile(writeFile, false);
        }