Program.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace MethodDeikstraEXZ
  9. {
  10. internal class Program
  11. {
  12. public static int[][] Matrix(string[] matrix) => matrix.Select(line => line.Split(' ').Select(int.Parse).ToArray()).ToArray();
  13. static void Main(string[] args)
  14. {
  15. Trace.Listeners.Add(new TextWriterTraceListener("Trace and debug.txt"));
  16. Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
  17. Trace.AutoFlush = true;
  18. string inputPath = "Input.txt";
  19. string outputPath = "Output.txt";
  20. string[] allLines = File.ReadAllLines(inputPath);
  21. int separator = Array.IndexOf(allLines, "-");
  22. string[] matrixOne = allLines.Take(separator).ToArray();
  23. string[] matrixTwo = allLines.Skip(separator + 1).ToArray();
  24. int[][] intMatrixOne = Matrix(matrixOne);
  25. int[][] intMatrixTwo = Matrix(matrixTwo);
  26. AlgDeikstra obj = new AlgDeikstra(intMatrixOne);
  27. obj.RealizationAlg();
  28. Trace.WriteLine("Trace\n" + obj.ToString());
  29. Debug.WriteLine("Debug\n" + obj.ToString());
  30. File.WriteAllText(outputPath, obj.ToString());
  31. Console.ReadKey();
  32. }
  33. }
  34. }