Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Diagnostics;
  3. using System.Management;
  4. using TestConsoleApp;
  5. namespace databaseconnection
  6. {
  7. class Program
  8. {
  9. static string ProcessName = "AcroRd32";
  10. static string UserID = "";
  11. static void Main(string[] args)
  12. {
  13. var parser = new QueryParser();
  14. var stopWatch = Stopwatch.StartNew();
  15. var columns=parser.Parse();
  16. var time = stopWatch.Elapsed.TotalMilliseconds;
  17. Console.WriteLine(columns);
  18. //var anInstanceofMyClass = new Program();
  19. //anInstanceofMyClass.checkAcrobatProcess();
  20. //Console.WriteLine("Hello World!");
  21. //Console.WriteLine("localDate - " + localDate);
  22. }
  23. private void checkAcrobatProcess()
  24. {
  25. if (OperatingSystem.IsWindows())
  26. {
  27. try
  28. {
  29. //CatchStackOverflow1();
  30. foreach (Process process in Process.GetProcessesByName(ProcessName))
  31. {
  32. if ((process.MainWindowTitle).Equals("Adobe Acrobat Reader DC (32-bit)"))
  33. {
  34. Console.WriteLine("checkAcrobatProcess DEBUG: Adobe Acrobat Standard DC (32-bit) is launched");
  35. ObjectQuery objQuery = new ObjectQuery("Select * From Win32_Process where ProcessId='" + process.Id + "'");
  36. ManagementObjectSearcher mos = new ManagementObjectSearcher(objQuery);
  37. foreach (ManagementObject mo in mos.Get())
  38. {
  39. string[] s = new string[2];
  40. mo.InvokeMethod("GetOwner", (object[])s);
  41. UserID = s[0].ToLower().ToString();
  42. Console.WriteLine("checkAcrobatProcess DEBUG: " + UserID + " launched the acrobat");
  43. break;
  44. }
  45. Console.WriteLine("checkAcrobatProcess DEBUG: waitforexit");
  46. process.WaitForExit();
  47. break;
  48. }
  49. }
  50. }
  51. catch (Exception ex)
  52. {
  53. Console.WriteLine("checkAcrobatProcess DEBUG: Failed!! " + ex.Message);
  54. }
  55. }
  56. checkAcrobatProcess();
  57. }
  58. public static void CatchStackOverflow1()
  59. {
  60. try
  61. {
  62. throw new StackOverflowException();
  63. }
  64. catch (StackOverflowException) //catch (StackOverflowException ex)
  65. {
  66. }
  67. }
  68. }
  69. }