Guest User

Untitled

a guest
Jun 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. SECTION_A 256
  2. SECTION_B 344
  3. SECTION_C 556
  4.  
  5. Dictionary<string, int> sectionIndex = new Dictionary<string, int>();
  6. List<string> headers = new List<string>(); // fill these with readline
  7.  
  8. foreach(string header in headers) {
  9. var s = header.Split(new[]{' '});
  10. sectionIndex.Add(s[0], Int32.Parse(s[1]));
  11. }
  12.  
  13. Dictionary<string, int> sectionIndex = new Dictionary<string, int>();
  14. List<string> headers = new List<string>(); // fill these with readline
  15.  
  16. foreach(string header in headers) {
  17. var s = header.Split(new[]{' '});
  18. sectionIndex.Add(s[0], Int32.Parse(s[1]));
  19. }
  20.  
  21. Dictionary<string, int> sectionIndex = new Dictionary<string, int>();
  22. List<string> headers = new List<string>(); // fill these with readline
  23.  
  24. foreach(string header in headers) {
  25. var s = header.Split(new[]{' '});
  26. sectionIndex.Add(s[0], Int32.Parse(s[1]));
  27. }
  28.  
  29. Dictionary<string, int> sectionIndex = new Dictionary<string, int>();
  30. List<string> headers = new List<string>(); // fill these with readline
  31.  
  32. foreach(string header in headers) {
  33. var s = header.Split(new[]{' '});
  34. sectionIndex.Add(s[0], Int32.Parse(s[1]));
  35. }
  36.  
  37. string dataRow = "";
  38.  
  39. try
  40. {
  41. TextReader tr = new StreamReader("filename.txt");
  42.  
  43. while (true)
  44. {
  45. dataRow = tr.ReadLine();
  46. if (dataRow.Substring(1, 8) != "SECTION_")
  47. break;
  48. else
  49. //Parse line for section code and line number and log values
  50. continue;
  51. }
  52. tr.Close();
  53. }
  54. catch (Exception ex)
  55. {
  56. MessageBox.Show(ex.Message);
  57. }
Add Comment
Please, Sign In to add comment