Hello,
I am developing a small code which reads data from 2 different files. One file is .CSV and the other is.DAT.
I am storing the data from these 2 files into multidimensional array depending on their values. then creating a text file that should contain this data.
I wrote the following code, but i do not see any result in the console, Thanks in Advance
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.IO;
- using System.Windows.Forms;
- using dowStepType;
- using MySql.Data;
- using MySql.Data.MySqlClient;
- using System.Data;
- using System.Diagnostics;
-
-
-
-
-
-
-
- namespace ConsoleApplication1
- {
-
- public static class Program
- {
-
-
-
- [STAThread]
-
-
-
- public static void Main(string[] argv)
- {
-
-
-
-
- string[,] Result;
-
-
-
- var lineCount = File.ReadLines(@"D:\Profiles\cdg033\Desktop\MQS Project\BRST26_CXB1413C7M.rslt.07-15-2014.11.08.24.CSV").Count();
-
- Program.ReadDATA(out Result);
- Program.GenerateCSV(out Result);
-
-
- }
-
-
-
-
-
-
- static string ReadDATA(out string[,] Result)
- {
-
-
-
-
-
-
- StreamReader reader1 = new StreamReader (@"D:\Profiles\cdg033\Desktop\MQS Project\PARAM-20160906-000505.DAT");
- StreamReader reader2 = new StreamReader (@"D:\Profiles\cdg033\Desktop\MQS Project\BRST26_CXB1413C7M.rslt.07-15-2014.11.08.24.CSV");
-
- string line1;
- string line2;
- int Profile_Index = 1;
- string[,] Result = new string[lineCount, 16];
-
-
-
-
- while ((line1 = reader1.ReadLine()) != null && (line2 = reader2.ReadLine()) != null)
- {
- string[] fields1 = line1.Split('|');
- string[] fields2 = line2.Split(',');
- for (int i = 0; i < lineCount - 1; i++)
- {
- for (int j = 1; j < 16; j++)
- {
-
- Result[0, 0] == "PATS_TEST";
- if (fields1[0].Contains("G"))
- {
- Result[i, 1] == fields1[1];
- Result[i, 2] == fields1[5];
- Result[i, 3] == fields1[4];
- Result[i, 4] == "1";
- Result[i, 5] == fields1[12];
- Result[i, 6] == fields2[6];
- Result[i, 7] == fields1[2];
- Result[i, 8] == "1";
- Result[i, 9] == "0";
- Result[i, 10] == "1";
- Result[i, 11] == "TEST TIME";
- Result[i, 12] == fields1[7];
- Result[i, 13] == "1";
- Result[i, 14] == "0";
- Result[i, 15] == Profile_Index;
-
- }
-
- else if (fields1[0].Contains("END-OF-LINE"))
- {
-
- Result[i, end] = "";
-
- }
-
- else if (fields1[0].Contains("Records"))
- {
-
- break;
- }
- else {
-
- Result[i, 1] == fields1[0];
- Result[i, 2] == fields2[2];
- Result[i, 3] == fields1[0];
- Result[i, 4] == fields1[6];
- Result[i, 5] == fields2[5];
- Result[i, 6] == fields2[6];
- Result[i, 7] == fields1[5];
- Result[i, 8] == "1";
- Result[i, 9] == "0";
- Result[i, 10] == "1";
- Result[i, 11] == "TEST TIME";
- Result[i, 12] == "Attempts";
- Result[i, 13] == "1";
- Result[i, 14] == "0";
- Result[i, 15] == Profile_Index;
-
-
- }
- }
- }
- Console.WriteLine("The Contents of the buffer are" + Result[i, j]);
- Profile_Index++;
-
- }
-
- reader1.Close();
- reader2.Close();
-
-
-
-
- }
-
-
- static void generatecsv(string[,] Result)
- {
- string ProgramPfad = (@"D:\Profiles\cdg033\Desktop\MQS Project\Test_Result.CSV");
-
- ReadDATA (out Result);
- string[,] buffer = new string[Result.GetLength(0),Result.GetLength(1)];
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(ProgramPfad))
- {
-
-
- for (int i = 0; i < buffer.Length - 1; i++)
- {
- for (int j=0; j< buffer.Length -1; j++ )
-
- {
- buffer[i,j] = Result[i,j];
- file.WriteLine(buffer[i,j]);
-
-
- Console.WriteLine("The Contents of the buffer are" + buffer[i]);
- }
- }
- }
-
- }
-
-
-
- }
- }