Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. public bool StartRecording
  2. {
  3. get
  4. {
  5. return startrecording;
  6. }
  7. set
  8. {
  9.  
  10. if (RecordingInOperation)
  11. {
  12. StopRecording = true;
  13. }
  14.  
  15. startrecording = value;
  16.  
  17. if (Directory.Exists(DirectoryPath.Substring(0, DirectoryPath.IndexOf("\") + 1)) && value && !this.StopRecording)
  18. {
  19. try
  20. {
  21.  
  22.  
  23. job = new ScreenCaptureJob();
  24.  
  25. Rectangle Resolution = Screen.AllScreens[ScreenID].Bounds;
  26.  
  27. int offset = 0;
  28.  
  29. for (int i = 0; i < ScreenID; i++)
  30. {
  31. offset += Screen.AllScreens[i].Bounds.Width;
  32. }
  33.  
  34.  
  35. job.ScreenCaptureVideoProfile.Quality = this.Quality;
  36. job.ScreenCaptureVideoProfile.FrameRate = this.FrameRate;
  37. ConstantBitrate b = new ConstantBitrate(this.BitRate);
  38. job.ScreenCaptureVideoProfile.Bitrate = b;
  39.  
  40.  
  41. // Sets the top right coordinates of the capture rectangle
  42. int topRightX = offset;
  43. int topRightY = 0;
  44. // Sets the bottom left coordinates of the capture rectangle
  45. int BottomLeftX = topRightX + Resolution.Width;
  46. int BottomLeftY = topRightY + Resolution.Height;
  47.  
  48. //job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
  49. job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
  50.  
  51. job.ScreenCaptureVideoProfile.AutoFit = true;
  52.  
  53. job.ShowFlashingBoundary = false;
  54.  
  55.  
  56.  
  57. job.OutputScreenCaptureFileName = DirectoryPath + @"" + FileNamePrefix + "_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".xesc";
  58. job.Start();
  59.  
  60. startTim = DateTime.Now;
  61. recording = true;
  62. try
  63. {
  64. RecordingStatusChanged();
  65. }
  66. catch (Exception)
  67. {
  68.  
  69. }
  70.  
  71. }
  72. catch (Exception)
  73. {
  74. throw;
  75. }
  76. this.StartRecording = false;
  77. }
  78. }
  79. }
  80.  
  81. public bool StopRecording
  82. {
  83. get
  84. {
  85. return stoprecording;
  86. }
  87. set
  88. {
  89. stoprecording = value;
  90.  
  91. if (value && !this.StartRecording)
  92. {
  93. try
  94. {
  95. recording = false;
  96. job.Stop();
  97. try
  98. {
  99. RecordingStatusChanged();
  100. }
  101. catch (Exception)
  102. {
  103.  
  104. }
  105. }
  106. catch(Exception)
  107. {
  108. throw;
  109. }
  110. this.StopRecording = false;
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement