Guest User

Untitled

a guest
Oct 25th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
  2. string ayudastr = "Parámetros de entradan"+
  3. "Param Descripciónn"+
  4. " -h Ayuda. Este texton"+
  5. " -r Solo mostrar (No eliminar)n" +
  6. " -v Verbose, salida a consola del detalle del proceson"+
  7. " -q No pedir confirmaciones.n" +
  8. " -e Pedir confirmación para eliminar.n" +
  9. " -u '' * Usuario del clienten"+
  10. " -p '' * Contraseña del clienten"+
  11. " -S '' * Host IMAPn"+
  12. " -P '' Puerto del hostn"+
  13. " -s Usar SSLn" +
  14. " -T Usar TLSn" +
  15. " -d '' * Días atrás a eliminarn"+
  16. " -f '' * Carpeta donde buscar mensajes. Case sensitive.";
  17. foreach (string s in args)
  18. Console.Write(s + " ");
  19. Console.WriteLine("");
  20. int iUsr=-1, iPass=-1, iServer=-1, iDias=-1, iFolder=-1, iPuerto=-1;
  21. for (int i = 0; i < args.Count(); i++)
  22. switch (args[i])
  23. {
  24. case "-u":
  25. iUsr = i + 1;
  26. break;
  27. case "-p":
  28. iPass = i + 1;
  29. break;
  30. case "-P":
  31. iPuerto = i + 1;
  32. break;
  33. case "-S":
  34. iServer = i + 1;
  35. break;
  36. case "-d":
  37. iDias = i + 1;
  38. break;
  39. case "-f":
  40. iFolder = i + 1;
  41. break;
  42. }
  43. if (args.Contains("-h"))
  44. {
  45. Console.Write(ayudastr);
  46. Console.ReadLine();
  47. return;
  48. }
  49. string user = "";
  50. string pass = "";
  51. string server = "";
  52. double dias = 0;
  53. string fechastr = "";
  54. string folderemail = "";
  55. try
  56. {
  57. user = args[iUsr];
  58. pass = args[iPass];
  59. server = args[iServer];
  60. dias = -1 * Convert.ToDouble(args[iDias]);
  61. fechastr = DateTime.Now.AddDays(dias).ToString("dd-MMM-yyyy");
  62. folderemail = args[iFolder];
  63. }
  64. catch (Exception ex)
  65. {
  66. Console.WriteLine("Faltan parámetros necesarios");
  67. Console.ReadLine();
  68. return;
  69. }
  70. string puerto = "993";//IMAP default
  71. bool verbose = false;
  72. bool useSSL = false;
  73. bool useTLS = false;
  74. bool validarCert = false;
  75. bool pedirConfirmacionEliminar = false;
  76. bool pedirConfirmacion = false;
  77. bool soloMostrar = false;
  78. if (iPuerto != -1)
  79. puerto = args[iPuerto];
  80. if (args.Contains("-s"))
  81. useSSL = true;
  82. if (args.Contains("-T"))
  83. useTLS = true;
  84. if (args.Contains("-r"))
  85. soloMostrar = true;
  86. if (args.Contains("-e"))
  87. pedirConfirmacionEliminar = true;
  88. if (args.Contains("-q"))
  89. pedirConfirmacion= true;
Add Comment
Please, Sign In to add comment