Exemplo n.º 1
0
        public static void readTestFile(DelimitedFile df)
        {
            df.readFile();

            Console.WriteLine("Headers" + "\n");

            String[] headers = df.headersInOrder();

            Console.WriteLine( getHeaders(headers, df.delimiter) );

            /*
            for(int i = 0; i < headers.Length; ++i)
            {
                String s = headers[i];
                if(i < headers.Length - 1)
                    Console.WriteLine(s + df.delimiter);
                else
                    Console.WriteLine(s);
            }
            */

            /*
            String[] fileContents = df.fileContentsInOrder();
            foreach (String s in fileContents)
            {
                Console.WriteLine(s);
            }
            */
        }
Exemplo n.º 2
0
        //Outputs file with different column headings
        public static void test3()
        {
            String fileName3R = @"C:\WFMCustomAccelerator\PB Accelerator Files\Test Files\TestFileR1.csv";
            String fileName3W = @"C:\WFMCustomAccelerator\PB Accelerator Files\Test Files\TestFileW3.csv";
            DelimitedFile df3 = new DelimitedFile(fileName3R, ",");

            Console.WriteLine("Reading File=" + fileName3R);
            readTestFile(df3);

            String headerFileNameBefore = @"C:\WFMCustomAccelerator\PB Accelerator Files\Test Files\TestFileH3B.csv";

            File.WriteAllLines(headerFileNameBefore, df3.headersInOrder());

            df3.replaceColName("Ticker", "Bloomberg Ticker");
            df3.replaceColName(@"Long/Short", "LS");
            df3.replaceColName("Investment", "Security");

            String headerFileNameAfter = @"C:\WFMCustomAccelerator\PB Accelerator Files\Test Files\TestFileH3A.csv";

            File.WriteAllLines(headerFileNameAfter, df3.headersInOrder());

            //Console.WriteLine( getHeaders(df3.headersInOrder(), df3.delimiter) );

            df3.fileName = fileName3W;
            writeTestFile(df3);

            Console.WriteLine(lastMsg);
            Console.ReadLine();
        }