Advertisement
Guest User

Untitled

a guest
May 28th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. public static class Global
  2. {
  3. public const string ArgsDocument = @"-d:";
  4. public const string ArgsReport = @"-r:";
  5. public const string ArgsDoc2xPath = @"-conv:";
  6. public const string ArgsDebug = @"-Debug";
  7. public const string ArgsOutput = @"-o:";
  8. }
  9.  
  10. public static bool LoadCommandLineParams(string[] pArgs)
  11. {
  12. try
  13. {
  14. if (pArgs.Length == 0)
  15. {
  16. Console.Out.WriteLine("{0} version: {1}",
  17. System.Reflection.Assembly.GetExecutingAssembly().GetName().Name,
  18. System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
  19. Console.Out.WriteLine("Keys:");
  20. Console.Out.WriteLine("\t" + Global.ArgsDebug + "\t" + "Enables debug mode");
  21. Console.Out.WriteLine("\t" + Global.ArgsDocument + "\t" + "Path to document");
  22. Console.Out.WriteLine("\t" + Global.ArgsReport + "\t" + "Path to ESign report for document");
  23. Console.Out.WriteLine("\t" + Global.ArgsDoc2xPath + "\t" + "Path to Doc2x.exe.");
  24. Console.Out.WriteLine("\t" + Global.ArgsOutput + "\t" + "Path to result file.");
  25. return false;
  26. }
  27.  
  28. foreach (string vRes in pArgs)
  29. {
  30. if (vRes.StartsWith(Global.ArgsDocument))
  31. {
  32. Global.InDocument = vRes.Substring(Global.ArgsDocument.Length);
  33. continue;
  34. }
  35. if (vRes.StartsWith(Global.ArgsReport))
  36. {
  37. Global.InReport = vRes.Substring(Global.ArgsReport.Length);
  38. continue;
  39. }
  40. if (vRes.StartsWith(Global.ArgsDoc2xPath))
  41. {
  42. Global.Doc2xPath = vRes.Substring(Global.ArgsDoc2xPath.Length);
  43. continue;
  44. }
  45. if (vRes.StartsWith(Global.ArgsOutput))
  46. {
  47. Global.OutResult = vRes.Substring(Global.ArgsOutput.Length);
  48. continue;
  49. }
  50. if (vRes.StartsWith(Global.ArgsDebug))
  51. {
  52. Global.DebugMode = true;
  53. //continue;
  54. }
  55. }
  56.  
  57.  
  58.  
  59. return true;
  60. }
  61. catch (Exception)
  62. {
  63. return false;
  64.  
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement