Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace ProbaParse
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string[]> savedData = new List<string[]>();
- StreamReader sr = new StreamReader("../../Navigation.csv");
- string data = sr.ReadLine();
- while (data != null)
- {
- string[] newData = data.Split(';');
- savedData.Add(newData);
- data = sr.ReadLine();
- }
- int highestParentId = 0;
- string currentData = "";
- int dataIndex = 0;
- for (int i = 0; i < savedData.Count; i++)
- {
- highestParentId = 0;
- currentData = "";
- dataIndex = 0;
- if(savedData[i][2] == "NULL")
- {
- Console.WriteLine(". " + savedData[i][1]);
- currentData = savedData[i][1];
- savedData.RemoveAt(i);
- for (int k = 0; k < savedData.Count; k++)
- {
- if (savedData[k][2] == savedData[k][0])
- {
- Console.WriteLine(".... " + savedData[k][1]);
- currentData = savedData[k][1];
- savedData.RemoveAt(k);
- }
- else Console.WriteLine("blabla");
- }
- }
- //for (int g = 0; g < savedData.Count; g++)
- //{
- // if(savedData[i][2] == "1")
- // {
- // Console.WriteLine(".... " + savedData[i][1]);
- // currentData = savedData[i][1];
- // savedData.RemoveAt(i);
- // }
- // for (int h = 0; h < savedData.Count; h++)
- // {
- // if (savedData[i][2] == "2")
- // {
- // Console.WriteLine("....... " + savedData[i][1]);
- // currentData = savedData[i][1];
- // savedData.RemoveAt(i);
- // }
- // }
- //}
- // REMOVED: for(int j = 0; j < savedData[i][4].Length; j++)
- //for (int j = 0; j < savedData.Count; j++)
- //{
- // int whatever;
- // if (Int32.TryParse(savedData[j][2], out whatever) == true && highestParentId < whatever
- // && savedData[j][4].Contains(currentData) == true && currentData != "")
- // {
- // highestParentId = whatever;
- // dataIndex = j;
- // }
- //}
- }
- Console.WriteLine(highestParentId);
- for (int i = 0; i < savedData.Count; i++)
- {
- for (int j = 0; j < savedData[i].Length; j++)
- {
- Console.Write(savedData[i][j] + " ");
- }
- Console.WriteLine("\n");
- }
- Console.ReadLine();
- }
- public static void writeLine(int parentId, string text)
- {
- for (int i = 1; i < parentId * 3; i++)
- {
- Console.Write(".");
- }
- Console.Write(" " + text + "\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement