Program.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using AggregatorFinal;
  2. using AggregatorFinal.DataAggregator;
  3. using AggregatorFinal.Rec;
  4. using ConsoleApplication6;
  5. using ConsoleApplication6.SecondPhase;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.IO;
  9. using System.IO.Compression;
  10. using System.Linq;
  11. using System.Net;
  12. using System.Net.Sockets;
  13. using System.Text;
  14. using System.Threading;
  15. using System.Threading.Tasks;
  16. namespace AgrigateData
  17. {
  18. class Program
  19. {
  20. static void Main(string[] args)
  21. {
  22. try
  23. {
  24. DirectoryInfo terget = Directory.CreateDirectory(Aggregator.targetFolder);
  25. Directory.CreateDirectory(Aggregator.resultFolder);
  26. DirectoryInfo report = Directory.CreateDirectory(Aggregator.reportFolder);
  27. Console.WriteLine("Enter: LocalIP LocalPort");
  28. String temp = Console.ReadLine();
  29. char[] splitter = { ' ' };
  30. String[] parts = temp.Split(splitter, StringSplitOptions.None);
  31. string port = parts[1];
  32. string ip = parts[0];
  33. new MainThread(ip, port);
  34. Console.WriteLine();
  35. Console.WriteLine("Opt 1: 'ag' to aggregate");
  36. Console.WriteLine("Opt 2: 'report1' to get hourly report");
  37. while (true)
  38. {
  39. temp = Console.ReadLine();
  40. if (temp == "report1")
  41. {
  42. SecondPhase.gethoursDiagram(terget.FullName, report.FullName + "/hourlyReport.txt", report.FullName + "/hourlyOnlineReport.txt");
  43. }
  44. if (temp == "ag")
  45. {
  46. new Aggregator();
  47. }
  48. }
  49. }
  50. catch (Exception es)
  51. {
  52. Console.WriteLine("Fatel Error: "+ es.Message);
  53. }
  54. }
  55. }
  56. }