Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace ProbaParse
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.            
  15.             List<string[]> savedData = new List<string[]>();
  16.  
  17.            
  18.  
  19.             StreamReader sr = new StreamReader("../../Navigation.csv");
  20.             string data = sr.ReadLine();
  21.             while (data != null)
  22.             {
  23.                 string[] newData = data.Split(';');
  24.                 savedData.Add(newData);
  25.                 data = sr.ReadLine();
  26.             }
  27.  
  28.             int highestParentId = 0;
  29.             string currentData = "";
  30.             int dataIndex = 0;
  31.  
  32.             for (int i = 0; i < savedData.Count; i++)
  33.             {
  34.                 highestParentId = 0;
  35.                 currentData = "";
  36.                 dataIndex = 0;
  37.                 if(savedData[i][2] == "NULL")
  38.                 {
  39.                     Console.WriteLine(". " + savedData[i][1]);
  40.                     currentData = savedData[i][1];
  41.                     savedData.RemoveAt(i);
  42.  
  43.                     for (int k = 0; k < savedData.Count; k++)
  44.                     {
  45.                         if (savedData[k][2] == savedData[k][0])
  46.                         {
  47.                             Console.WriteLine(".... " + savedData[k][1]);
  48.                             currentData = savedData[k][1];
  49.                             savedData.RemoveAt(k);
  50.                         }
  51.                         else Console.WriteLine("blabla");
  52.  
  53.                     }
  54.                 }
  55.                
  56.                 //for (int g = 0; g < savedData.Count; g++)
  57.                 //{
  58.                 //    if(savedData[i][2] == "1")
  59.                 //    {
  60.                 //        Console.WriteLine(".... " + savedData[i][1]);
  61.                 //        currentData = savedData[i][1];
  62.                 //        savedData.RemoveAt(i);
  63.                 //    }
  64.                 //    for (int h = 0; h < savedData.Count; h++)
  65.                 //    {
  66.                 //        if (savedData[i][2] == "2")
  67.                 //        {
  68.                 //            Console.WriteLine("....... " + savedData[i][1]);
  69.                 //            currentData = savedData[i][1];
  70.                 //            savedData.RemoveAt(i);
  71.                 //        }
  72.                 //    }
  73.                 //}
  74.                
  75.  
  76.                     // REMOVED: for(int j = 0; j < savedData[i][4].Length; j++)
  77.                     //for (int j = 0; j < savedData.Count; j++)
  78.                     //{
  79.                     //    int whatever;
  80.                     //    if (Int32.TryParse(savedData[j][2], out whatever) == true && highestParentId < whatever
  81.                     //        && savedData[j][4].Contains(currentData) == true && currentData != "")
  82.                     //    {
  83.                     //        highestParentId = whatever;
  84.                     //        dataIndex = j;
  85.                     //    }
  86.                     //}
  87.                
  88.             }
  89.  
  90.             Console.WriteLine(highestParentId);
  91.  
  92.             for (int i = 0; i < savedData.Count; i++)
  93.             {
  94.                 for (int j = 0; j < savedData[i].Length; j++)
  95.                 {
  96.                     Console.Write(savedData[i][j] + " ");
  97.                 }
  98.                 Console.WriteLine("\n");
  99.             }
  100.  
  101.             Console.ReadLine();
  102.  
  103.         }
  104.  
  105.         public static void writeLine(int parentId, string text)
  106.         {
  107.             for (int i = 1; i < parentId * 3; i++)
  108.             {
  109.                 Console.Write(".");
  110.             }
  111.             Console.Write(" " + text + "\n");
  112.         }
  113.     }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement