Pārlūkot izejas kodu

星火微课 2.6.2

录制和录屏重写不再依赖第三方
打印重写
tags/3.0.0
张剑 pirms 3 gadiem
vecāks
revīzija
62181adfae

+ 2
- 2
XHWK.WKTool/App.config Parādīt failu

@@ -9,8 +9,8 @@
9 9
     <!--参数是否加密 0不加密 1加密-->
10 10
     <add key="IsParameterEncryption" value="0" />
11 11
     <!--版本号-->
12
-    <add key="VersionCode" value="81" />
13
-    <add key="VersionName" value="2.6.1" />
12
+    <add key="VersionCode" value="82" />
13
+    <add key="VersionName" value="2.6.2" />
14 14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15 15
     <add key="SkinStyle" value="0" />
16 16
     <!--是否输出视频记录日志:0否-->

+ 0
- 34
XHWK.WKTool/App.cs Parādīt failu

@@ -348,40 +348,6 @@ namespace XHWK.WKTool
348 348
 
349 349
                 WindowsIdentity identity = WindowsIdentity.GetCurrent();
350 350
                 WindowsPrincipal principal = new WindowsPrincipal(identity);
351
-                //判断当前登录用户是否为管理员
352
-                //if (principal.IsInRole(WindowsBuiltInRole.Administrator))
353
-                //{
354
-                //    //如果是管理员,则直接运行
355
-                //    W_CreateAMicroLessonWindow = new CreateAMicroLessonWindow();
356
-                //    // 定义Application对象作为整个应用程序入口
357
-                //    Application app = new Application();
358
-                //    app.Run(W_CreateAMicroLessonWindow);
359
-                //    //Application.Run(W_CreateAMicroLessonWindow);
360
-                //}
361
-                //else
362
-                //{
363
-                //    //创建启动对象
364
-                //    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
365
-                //    {
366
-                //        UseShellExecute = true,
367
-                //        WorkingDirectory = Environment.CurrentDirectory,
368
-                //        FileName = Assembly.GetExecutingAssembly().Location,
369
-                //        //设置启动动作,确保以管理员身份运行
370
-                //        Verb = "runas"
371
-                //    };
372
-                //    try
373
-                //    {
374
-                //        System.Diagnostics.Process.Start(startInfo);
375
-                //    }
376
-                //    catch
377
-                //    {
378
-                //        return;
379
-                //    }
380
-                //    //退出
381
-                //    //Current.Shutdown();
382
-                //    Environment.Exit(0);
383
-
384
-                //}
385 351
 
386 352
                 #endregion 强制以管理员方式运行 修改人:赵耀 修改时间:2020年9月7日
387 353
 

+ 5
- 5
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs Parādīt failu

@@ -28,11 +28,11 @@ namespace XHWK.WKTool
28 28
             InitializeComponent();
29 29
             ResizeMode = ResizeMode.NoResize;
30 30
        
31
-            if (!APP.CheckScreenCapturerRecorder())
32
-            {
33
-                MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
34
-                //APP.InstallScreenCapturerRecorder();
35
-            }
31
+            //if (!APP.CheckScreenCapturerRecorder())
32
+            //{
33
+            //    MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
34
+            //    //APP.InstallScreenCapturerRecorder();
35
+            //}
36 36
             txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
37 37
             //APP.FFmpeg.GetMToFFmpeg();
38 38
 

Binārs
XHWK.WKTool/Extension/ffmpeg.exe Parādīt failu


+ 0
- 20
XHWK.WKTool/LoginWindow.xaml.cs Parādīt failu

@@ -37,21 +37,6 @@ namespace XHWK.WKTool
37 37
 
38 38
             #endregion 获取服务接口地址 --2021年7月9日赵耀
39 39
 
40
-            //if (APP.SkinStyle == "1")
41
-            //{
42
-            //    GridTitle.Visibility = Visibility.Visible;
43
-            //    GridTitle_Black.Visibility = Visibility.Collapsed;
44
-            //}
45
-            //else if (APP.SkinStyle == "2")
46
-            //{
47
-            //    GridTitle.Visibility = Visibility.Collapsed;
48
-            //    GridTitle_Black.Visibility = Visibility.Visible;
49
-            //}
50
-            //else
51
-            //{
52
-            //    GridTitle.Visibility = Visibility.Visible;
53
-            //    GridTitle_Black.Visibility = Visibility.Collapsed;
54
-            //}
55 40
             Initialize();
56 41
         }
57 42
 
@@ -67,11 +52,6 @@ namespace XHWK.WKTool
67 52
                 }
68 53
             }
69 54
             DataContext = APP.PageContextData;
70
-            //if (GetSettingString("isRemind").Equals("True"))
71
-            //{
72
-            //    ckSaveName.IsChecked = true;
73
-            //    txbAccountNumber.Text = GetSettingString("userName");
74
-            //}
75 55
         }
76 56
 
77 57
         /// <summary>

+ 259
- 465
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Parādīt failu

@@ -1,5 +1,9 @@
1 1
 using Common.system;
2 2
 
3
+using NAudio.Wave;
4
+
5
+using NReco.VideoConverter;
6
+
3 7
 using System;
4 8
 using System.Drawing;
5 9
 using System.IO;
@@ -7,11 +11,13 @@ using System.Threading;
7 11
 using System.Windows;
8 12
 using System.Windows.Forms;
9 13
 using System.Windows.Ink;
14
+using System.Windows.Interop;
10 15
 using System.Windows.Media;
11 16
 using System.Windows.Media.Imaging;
12 17
 using System.Windows.Threading;
13 18
 
14 19
 using XHWK.Model;
20
+using XHWK.WKTool.Utils;
15 21
 
16 22
 namespace XHWK.WKTool
17 23
 {
@@ -28,14 +34,19 @@ namespace XHWK.WKTool
28 34
         private string VideoSavePathName;
29 35
 
30 36
         /// <summary>
31
-        /// 是否首次录屏
37
+        /// 临时视频路径
38
+        /// </summary>
39
+        private string TempVideoPathName;
40
+
41
+        /// <summary>
42
+        /// 临时麦克风路径
32 43
         /// </summary>
33
-        private bool IsFirstRS = true;
44
+        private string TempAudioPathName1;
34 45
 
35 46
         /// <summary>
36
-        /// 是否停止/暂停中
47
+        /// 临时扬声器路径
37 48
         /// </summary>
38
-        private bool IsSuspend = true;
49
+        private string TempAudioPathName2;
39 50
 
40 51
         /// <summary>
41 52
         /// 视频信息
@@ -54,7 +65,8 @@ namespace XHWK.WKTool
54 65
         {
55 66
             Start,
56 67
             Pause,
57
-            End
68
+            End,
69
+            Loading
58 70
         }
59 71
 
60 72
         /// <summary>
@@ -69,8 +81,6 @@ namespace XHWK.WKTool
69 81
         /// </summary>
70 82
         public int flg = 0;
71 83
 
72
-        private System.Timers.Timer timer = new System.Timers.Timer();
73
-
74 84
         #endregion 初始变量
75 85
 
76 86
         #region 初始化
@@ -110,14 +120,11 @@ namespace XHWK.WKTool
110 120
                 Thread.Sleep(100);
111 121
                 Dispatcher.Invoke(() =>
112 122
                 {
113
-                    //Owner = APP.W_PracticeWindow;
114 123
                     Topmost = true;
115 124
                 });
116 125
             }))).Start();
117 126
             APP.W_PracticeWindow.Hide();
118 127
 
119
-            //borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
120
-            //borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
121 128
             flg = 0;
122 129
 
123 130
             k_hook = new KeyboardHookCommon();
@@ -130,10 +137,6 @@ namespace XHWK.WKTool
130 137
             blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
131 138
             drawingAttributes.FitToCurve = true;
132 139
             //隐藏画笔工具栏
133
-            //BtnToolbarDown_Click(null, null);
134
-            //GridSrToobar.Visibility = Visibility.Hidden;
135
-            //gridColour.Visibility = Visibility.Hidden;
136
-            //gridThickness.Visibility = Visibility.Hidden;
137 140
             BtnRecordingScreen.Visibility = Visibility.Visible;
138 141
             BtnRecordingScreenPause.Visibility = Visibility.Collapsed;
139 142
             BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
@@ -144,42 +147,7 @@ namespace XHWK.WKTool
144 147
             BtnPenBlue_CL.Visibility = Visibility.Collapsed;
145 148
             BtnPenRed_CL.Visibility = Visibility.Collapsed;
146 149
             TxbTime.Content = "00:00";
147
-            if (t == null)
148
-            {
149
-                t = new DispatcherTimer();
150
-                t.Tick += OnTimer;
151
-                t.Interval = new TimeSpan(0, 0, 0, 0, 200);
152
-                t.IsEnabled = true;
153
-                t.Start();
154
-            }
155
-            t.Interval = new TimeSpan(0, 0, 0, 0, 200);
156
-        }
157
-
158
-        private void TimerDealy(object o, EventArgs e)
159
-        {
160
-            Dispatcher.Invoke(() =>
161
-            {
162
-                if (Left > 1630)
163
-                {
164
-                    return;
165
-                }
166
-                //获取鼠标在屏幕上的位置
167
-                double mouse_x = Form.MousePosition.X;   //需要添加引用System.Drawing
168
-                double mouse_y = Form.MousePosition.Y;
169
-
170
-                bool is_in_collasped_range = (mouse_y > Left + Height) || (mouse_x < Left || mouse_x > Left + Width);//缩起的条件
171
-                bool is_in_visiable_range = (mouse_y < 1 && mouse_x >= Left && mouse_x <= Left + Width); //展开的条件
172 150
 
173
-                if (Left < 1630 && Left >= 0 && is_in_collasped_range)
174
-                {
175
-                    System.Threading.Thread.Sleep(300);
176
-                    Left += 20 /*-this.ActualWidth - 3*/;
177
-                }
178
-                else if (Left < 0 && is_in_visiable_range)
179
-                {
180
-                    Left = 1;
181
-                }
182
-            });
183 151
         }
184 152
 
185 153
         private void K_hook_KeyDownEvent(object sender, System.Windows.Forms.KeyEventArgs e)
@@ -200,10 +168,6 @@ namespace XHWK.WKTool
200 168
 
201 169
         #region 事件
202 170
 
203
-        /// <summary>
204
-        /// 记录上次执行时间
205
-        /// </summary>
206
-        private DateTime Recorddt = DateTime.Now;
207 171
 
208 172
         private DateTime SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
209 173
 
@@ -214,72 +178,21 @@ namespace XHWK.WKTool
214 178
         /// <param name="e"></param>
215 179
         private void OnTimer(object sender, EventArgs e)
216 180
         {
217
-            switch (_state)
181
+            if (_state == State.Start)
218 182
             {
219
-                case State.Start:
220
-                    {
221
-                        DateTime dt = DateTime.Now;
222
-                        TimeSpan ts = dt.Subtract(Recorddt);//时间差
223
-                        double tsmi = ts.TotalMilliseconds;
224
-                        if (tsmi > 1000.0)
225
-                        {
226
-                            Recorddt = Recorddt.AddMilliseconds(1000);
227
-                            SRTime = SRTime.AddMilliseconds(1000);
228
-                        }
229
-                    }
230
-                    break;
231
-
232
-                case State.Pause:
233
-                    {
234
-                    }
235
-                    break;
236
-
237
-                case State.End:
238
-                    {
239
-                        SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
240
-                        //_timeSpan = new TimeSpan();
241
-                        ////_timeSpan = new TimeSpan(0, 23, 12, 45, 54);
242
-                    }
243
-                    break;
183
+                SRTime = SRTime.AddMilliseconds(1000);
244 184
             }
245
-
246
-            //string time = string.Format("{0:D2}:{1:D2}",/* _timeSpan.Hours,*/ _timeSpan.Minutes, _timeSpan.Seconds);
247
-            //char[] times = time.ToCharArray();
185
+             
248 186
             if (SRTime.Hour > 0)
249 187
             {
250
-                //Dispatcher.Invoke(() =>
251
-                //{
252 188
                 TxbTime.Content = SRTime.ToString("HH:mm:ss");
253
-                //});
254 189
             }
255 190
             else
256 191
             {
257
-                //Dispatcher.Invoke(() =>
258
-                //{
259 192
                 TxbTime.Content = SRTime.ToString("mm:ss");
260
-                //});
261 193
             }
262 194
         }
263 195
 
264
-        /// <summary>
265
-        /// 开始
266
-        /// </summary>
267
-        /// <param name="sender"></param>
268
-        /// <param name="e"></param>
269
-        private void Stack()
270
-        {
271
-            Recorddt = DateTime.Now;
272
-            _state = State.Start;
273
-        }
274
-
275
-        /// <summary>
276
-        /// 暂停
277
-        /// </summary>
278
-        private void TimeOut()
279
-        {
280
-            _state = State.Pause;
281
-        }
282
-
283 196
         /// <summary>
284 197
         /// 结束
285 198
         /// </summary>
@@ -297,16 +210,22 @@ namespace XHWK.WKTool
297 210
         /// </summary>
298 211
         private void SetUpVideoPathName()
299 212
         {
300
-            //FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
213
+            string fileType = ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
301 214
             FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
302 215
             FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temprs/");
303
-            VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
216
+            VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + fileType;
304 217
             int num = 1;
305 218
             while (FileToolsCommon.IsExistFile(VideoSavePathName))
306 219
             {
307
-                VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + "." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
308 220
                 num++;
221
+                VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + "." + fileType;
309 222
             }
223
+
224
+
225
+            TempVideoPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + ".avi";
226
+            TempAudioPathName1 = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + "_1.mp3" ;
227
+            TempAudioPathName2 = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + "_2.mp3";
228
+
310 229
         }
311 230
 
312 231
         /// <summary>
@@ -314,6 +233,17 @@ namespace XHWK.WKTool
314 233
         /// </summary>
315 234
         private bool IsPressButton = false;
316 235
 
236
+        //录制麦克风的声音
237
+        ZAudioRecordHelper helper1 = null;
238
+
239
+        //录制扬声器的声音
240
+        ZAudioRecordHelper helper2 = null;
241
+
242
+        //桌面录制
243
+        ZVideoRecordHelper helper3 = null;
244
+
245
+        public IntPtr winHandle;// 当前窗体指针
246
+
317 247
         /// <summary>
318 248
         /// 开始或暂停录制
319 249
         /// </summary>
@@ -339,78 +269,88 @@ namespace XHWK.WKTool
339 269
 
340 270
             #endregion 防止连击
341 271
 
342
-            if (IsSuspend)
272
+            if (_state == State.End)
343 273
             {
344
-                if (IsFirstRS)
345
-                {
346
-                    #region 检测麦克风扬声器是否可用
274
+                SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
275
+                TxbTime.Content = "00:00";
347 276
 
348
-                    string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
349
-                    FileToolsCommon.CreateDirectory(AudioPath);
350
-                    string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
351
-                    string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
352
-                    try
353
-                    {
354
-                        FileToolsCommon.DeleteFile(audioSpeakerPath);
355
-                        FileToolsCommon.DeleteFile(audioMicrophonePath);
356
-                    }
357
-                    catch (Exception)
358
-                    {
359
-                    }
360
-                    //扬声器
361
-                    if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
362
-                    {
363
-                        APP.FFmpeg.StopRecordAudio(2);
364
-                        //Thread.Sleep(500);
365
-                        //麦克风
366
-                        if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
367
-                        {
368
-                        }
369
-                        else
370
-                        {
371
-                            //无法录制麦克风
372
-                            MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
373
-                            if (Res == MessageBoxResult.Cancel)
374
-                            {
375
-                                return;
376
-                            }
377
-                        }
378
-                        APP.FFmpeg.StopRecordAudio(1);
379
-                    }
380
-                    else
381
-                    {
382
-                        //无法录制扬声器音频
383
-                        MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制音频,是否继续?", "消息提示", MessageBoxButton.OKCancel);
384
-                        if (Res == MessageBoxResult.Cancel)
385
-                        {
386
-                            return;
387
-                        }
388
-                    }
277
+                if (t == null)
278
+                {
279
+                    t = new DispatcherTimer();
280
+                    t.Tick += OnTimer;
281
+                    t.Interval = new TimeSpan(0, 0, 0, 0, 1000);
282
+                    t.IsEnabled = true;
283
+                    t.Start();
284
+                }
285
+                else {
286
+                    t.Interval = new TimeSpan(0, 0, 0, 0, 1000);
287
+                }
288
+             
289
+                _state = State.Loading;
290
+                #region 检测麦克风扬声器是否可用
291
+
292
+                //string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
293
+                //FileToolsCommon.CreateDirectory(AudioPath);
294
+                //string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
295
+                //string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
296
+                //try
297
+                //{
298
+                //    FileToolsCommon.DeleteFile(audioSpeakerPath);
299
+                //    FileToolsCommon.DeleteFile(audioMicrophonePath);
300
+                //}
301
+                //catch (Exception)
302
+                //{
303
+                //}
304
+                //扬声器
305
+                //if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
306
+                //{
307
+                //    APP.FFmpeg.StopRecordAudio(2);
308
+
309
+                //    //麦克风
310
+                //    if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
311
+                //    {
312
+                //    }
313
+                //    else
314
+                //    {
315
+                //        //无法录制麦克风
316
+                //        MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
317
+                //        if (Res == MessageBoxResult.Cancel)
318
+                //        {
319
+                //            return;
320
+                //        }
321
+                //    }
322
+                //    APP.FFmpeg.StopRecordAudio(1);
323
+                //}
324
+                //else
325
+                //{
326
+                //    //无法录制扬声器音频
327
+                //    MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制音频,是否继续?", "消息提示", MessageBoxButton.OKCancel);
328
+                //    if (Res == MessageBoxResult.Cancel)
329
+                //    {
330
+                //        return;
331
+                //    }
332
+                //}
389 333
 
390
-                    #endregion 检测麦克风扬声器是否可用
334
+                #endregion 检测麦克风扬声器是否可用
391 335
 
392
-                    VideoInfo = new Model_Video
393
-                    {
394
-                        VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType")),
395
-                        WkType = Enum_WKVidetype.RecordingScreen
396
-                    };
397
-                    SetUpVideoPathName();
398
-                    k_hook.Start();//安装键盘钩子
336
+                VideoInfo = new Model_Video
337
+                {
338
+                    VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType")),
339
+                    WkType = Enum_WKVidetype.RecordingScreen
340
+                };
341
+                SetUpVideoPathName();
342
+                k_hook.Start();//安装键盘钩子
399 343
 
400
-                    if (APP.W_CountdownWindow == null)
401
-                    {
402
-                        APP.W_CountdownWindow = new CountdownWindow();
403
-                        APP.W_CountdownWindow.Initialize(true, 1800);
404
-                        //APP.W_CountdownWindow.Topmost = true;
405
-                    }
406
-                    else
407
-                    {
408
-                        APP.W_CountdownWindow.Initialize(true, 1800);
409
-                        //APP.W_CountdownWindow.Topmost = true;
410
-                    }
411
-                    APP.W_CountdownWindow.Show();
412
-                }
413
-                IsSuspend = false;
344
+                //if (APP.W_CountdownWindow == null)
345
+                //{
346
+                //    APP.W_CountdownWindow = new CountdownWindow();
347
+                //    APP.W_CountdownWindow.Initialize(true, 1800);
348
+                //}
349
+                //else
350
+                //{
351
+                //    APP.W_CountdownWindow.Initialize(true, 1800);
352
+                //}
353
+                //APP.W_CountdownWindow.Show();
414 354
 
415 355
                 BtnRecordingScreen.Visibility = Visibility.Collapsed;
416 356
                 BtnRecordingScreenPause.Visibility = Visibility.Visible;
@@ -441,108 +381,38 @@ namespace XHWK.WKTool
441 381
 
442 382
                 #endregion 隐藏工具栏
443 383
 
444
-                try
445
-                {
446
-                    #region 4秒内不可点击
384
+                helper1 = new ZAudioRecordHelper(TempAudioPathName1, ZAudioRecordHelper.RecordType.microphone);
385
+                helper2 = new ZAudioRecordHelper(TempAudioPathName2, ZAudioRecordHelper.RecordType.loudspeaker);
447 386
 
448
-                    new Thread(new ThreadStart(new Action(() =>
449
-                    {
450
-                        Dispatcher.Invoke(() =>
451
-                        {
452
-                            BtnRecordingScreen.IsEnabled = true;
453
-                            BtnStopRecordingScreen.IsEnabled = true;
454
-                            BtnRecordingScreenPause.IsEnabled = true;
455
-                        });
456
-                    }))).Start();
387
+                helper1.StartRecordAudio();
388
+                helper2.StartRecordAudio();
457 389
 
458
-                    #endregion 4秒内不可点击
459
-
460
-                    new Thread(new ThreadStart(new Action(() =>
461
-                    {
462
-                        if (IsFirstRS)
463
-                        {
464
-                            Thread.Sleep(800);
465
-                        }
466
-                        if (APP.FFmpeg.myProcess != null)
467
-                        {
468
-                            Thread.Sleep(100);
469
-                        }
470
-                        System.Drawing.Size DesktopSize = PrimaryScreen.DESKTOP;
471
-                        bool IsRecordingSound = FileToolsCommon.GetConfigValue("IsRecordingSound") == "1";
472
-                        bool IsRecordingMicrophone = FileToolsCommon.GetConfigValue("IsRecordingMicrophone") == "1";
473
-                        bool SynRes = APP.FFmpeg.StartRecordingVideo(VideoSavePathName, DesktopSize, IsRecordingSound, IsRecordingMicrophone, out string ErrMessage, APP.MicrophoneName);
390
+                winHandle = new WindowInteropHelper(this).Handle;
391
+                var curScreen = Screen.FromHandle(winHandle);
392
+                int RecordWidth = curScreen.Bounds.Width;
393
+                int RecordHeight = curScreen.Bounds.Height;
394
+                helper3 = new ZVideoRecordHelper(TempVideoPathName, RecordWidth, RecordHeight);
395
+                helper3.StartRecordVideo();
396
+                _state = State.Start;
474 397
 
475
-                        Thread.Sleep(1300);
476
-                        Dispatcher.Invoke(() =>
477
-                        {
478
-                            if (!SynRes)
479
-                            {
480
-                                MessageWindow.Show(ErrMessage);
481
-
482
-                                BtnRecordingScreen.Visibility = Visibility.Visible;
483
-                                BtnRecordingScreenPause.Visibility = Visibility.Collapsed;
484
-                                BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
485
-                                BtnPenBlue.IsEnabled = false;//蓝笔不可点击
486
-                                BtnPenRed.IsEnabled = false;//红笔不可点击
487
-                                BtnPenBlue.Visibility = Visibility.Visible;
488
-                                BtnPenRed.Visibility = Visibility.Visible;
489
-                                BtnPenBlue_CL.Visibility = Visibility.Collapsed;
490
-                                BtnPenRed_CL.Visibility = Visibility.Collapsed;
491
-                                IsSuspend = true;
492
-                                IsFirstRS = true;
493
-                                return;
494
-                            }
495
-                            Stack();
496
-                        });
497
-                    }))).Start();
498
-                }
499
-                catch (Exception ex)
500
-                {
501
-                    MessageWindow.Show(ex.Message);
502
-                }
503
-                IsFirstRS = false;
398
+                Console.WriteLine("TempAudioPathName1:"+ TempAudioPathName1);
399
+                Console.WriteLine("TempAudioPathName2:" + TempAudioPathName2);
400
+                Console.WriteLine("TempVideoPathName:" + TempVideoPathName);
504 401
             }
505
-            else
402
+            else if (_state == State.Start)
506 403
             {
507
-                TimeOut();
508
-                IsSuspend = true;
509
-                BtnRecordingScreen.Visibility = Visibility.Visible;
510
-                BtnRecordingScreenPause.Visibility = Visibility.Collapsed;
511
-                BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
512
-                //imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
513
-                //btnBlackPenOne.IsEnabled = false;//蓝笔不可点击
514
-                //imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
515
-                //btnBlackPenTwo.IsEnabled = false;//红笔不可点击
516
-
517
-                #region 2秒内不可点击
518
-
519
-                new Thread(new ThreadStart(new Action(() =>
520
-                {
521
-                    //Dispatcher.Invoke(() =>
522
-                    //{
523
-                    //    ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
524
-                    //    BtnRecordingScreen.IsEnabled = false;
525
-                    //    BtnStopRecordingScreen.IsEnabled = false;
526
-                    //});
527
-                    //Thread.Sleep(2000);
528
-                    Dispatcher.Invoke(() =>
529
-                    {
530
-                        BtnRecordingScreen.IsEnabled = true;
531
-                        BtnStopRecordingScreen.IsEnabled = true;
532
-                    });
533
-                }))).Start();
534
-
535
-                #endregion 2秒内不可点击
536
-
537
-                try
538
-                {
539
-                    APP.FFmpeg.SuspendFFmpeg();
540
-                }
541
-                catch (Exception ex)
542
-                {
543
-                    MessageWindow.Show(ex.Message);
544
-                }
404
+                _state = State.Pause;
405
+                helper1.PauseRecordAudio();
406
+                helper2.PauseRecordAudio();
407
+                helper3.PauseRecordVideo();
408
+            }
409
+            else if (_state == State.Pause) {
410
+                _state = State.Start;
411
+                helper1.ResumeRecordAudio();
412
+                helper2.ResumeRecordAudio();
413
+                helper3.ResumeRecordVideo();
545 414
             }
415
+
546 416
         }
547 417
 
548 418
         /// <summary>
@@ -572,9 +442,8 @@ namespace XHWK.WKTool
572 442
 
573 443
             BtnRecordingScreen.ToolTip = "开始";
574 444
             k_hook.Stop();
575
-            IsSuspend = true;
576 445
             TxbTime.Content = "00:00";
577
-            End();
446
+   
578 447
             if (APP.W_PracticeWindow != null)
579 448
             {
580 449
                 if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
@@ -583,13 +452,7 @@ namespace XHWK.WKTool
583 452
                     APP.W_PracticeWindow.ReturnPractice();
584 453
                 }
585 454
             }
586
-            //if (gridToolbar.Visibility == Visibility.Visible)
587
-            //{
588
-            //    GridSrToobar.Visibility = Visibility.Visible;
589
-            //    gridToolbar.Visibility = Visibility.Hidden;
590
-            //    gridColour.Visibility = Visibility.Hidden;
591
-            //    gridThickness.Visibility = Visibility.Hidden;
592
-            //}
455
+
593 456
             if (APP.W_XHMicroLessonSystemWindow == null)
594 457
             {
595 458
                 APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
@@ -598,77 +461,63 @@ namespace XHWK.WKTool
598 461
             APP.W_XHMicroLessonSystemWindow.InitPen();
599 462
             APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
600 463
             APP.W_XHMicroLessonSystemWindow.Show();
601
-            if (!IsFirstRS)
602
-            {
603
-                try
604
-                {
605
-                    if (SRTime.Hour > 0 || SRTime.Minute > 0 || SRTime.Second > 3)
464
+
465
+            if (_state == State.Pause || _state == State.Start) {
466
+                t.Stop();
467
+                t = null;
468
+                Console.WriteLine("停止录制");
469
+                helper1.StopRecordAudio();
470
+                helper2.StopRecordAudio();
471
+                helper3.StopRecordVideo();
472
+                FFMpegConverter ffMpeg = new FFMpegConverter();
473
+       
474
+                FFMpegInput[] input = new FFMpegInput[] {
475
+                    new FFMpegInput(TempVideoPathName),
476
+                    new FFMpegInput(TempAudioPathName1),
477
+                    new FFMpegInput(TempAudioPathName1),
478
+                };
479
+    
480
+                // 多路音频混音
481
+                ffMpeg.ConvertMedia(
482
+                    input,
483
+                    VideoSavePathName,
484
+                    "mp4",
485
+                    new OutputSettings()
606 486
                     {
607
-                        try
608
-                        {
609
-                            APP.FFmpeg.StopFFmpeg(VideoSavePathName);
610
-                        }
611
-                        catch (Exception ex)
612
-                        {
613
-                            LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
614
-                        }
615
-                        IsFirstRS = true;
616
-                        //生成缩略图
617
-                        string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
618
-                        FileToolsCommon.CreateDirectory(ThumbnailPath);
619
-                        //缩略图存储位置
620
-                        string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
621
-                        new Thread(new ThreadStart(new Action(() =>
622
-                        {
623
-                            while (!FileToolsCommon.IsExistFile(VideoSavePathName))
624
-                            {
625
-                                Thread.Sleep(100);
626
-                            }
627
-                            FileToolsCommon.DeleteFile(ThumbnailPathName);
628
-                            //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
629
-                            VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
630
-                            VideoInfo.VideoPath = VideoSavePathName;
631
-                            VideoInfo.ThumbnailPath = ThumbnailPathName;
632
-                            APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
633
-                            VideoInfo.FileGuid = Guid.NewGuid().ToString();
634
-                            VideoInfo.IsUpload = false;
635
-                            VideoInfo.Uploaded = 0;
636
-                            //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
637
-                            if (!APP.VideoList.Exists(x => x.FileGuid == VideoInfo.FileGuid) || !APP.VideoList.Exists(x => x.VideoPath == VideoInfo.VideoPath))
638
-                            {
639
-                                APP.VideoList.Add(VideoInfo);
640
-                                //保存数据
641
-                                APP.SaveWkData();
642
-                            }
643
-                        }))).Start();
644
-                        Click_stopRecordingScreen();
487
+                        CustomOutputArgs = "-filter_complex amix=inputs=2:duration=first:dropout_transition=2"
645 488
                     }
646
-                    else
489
+                );
490
+                //生成缩略图
491
+                string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
492
+                FileToolsCommon.CreateDirectory(ThumbnailPath);
493
+                //缩略图存储位置
494
+                string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
495
+                new Thread(new ThreadStart(new Action(() =>
496
+                {
497
+
498
+                    FileToolsCommon.DeleteFile(ThumbnailPathName);
499
+                    VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
500
+                    VideoInfo.VideoPath = VideoSavePathName;
501
+                    VideoInfo.ThumbnailPath = ThumbnailPathName;
502
+                    APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
503
+                    VideoInfo.FileGuid = Guid.NewGuid().ToString();
504
+                    VideoInfo.IsUpload = false;
505
+                    VideoInfo.Uploaded = 0;
506
+                    if (!APP.VideoList.Exists(x => x.FileGuid == VideoInfo.FileGuid) || !APP.VideoList.Exists(x => x.VideoPath == VideoInfo.VideoPath))
647 507
                     {
648
-                        //视频过短
649
-                        APP.FFmpeg.SuspendFFmpeg();
650
-                        IsFirstRS = true;
651
-                        MessageWindow.Show("录屏时间过短,请重新录制!");
508
+                        APP.VideoList.Add(VideoInfo);
509
+                        //保存数据
510
+                        APP.SaveWkData();
652 511
                     }
653 512
 
654
-                    new Thread(new ThreadStart(new Action(() =>
655
-                    {
656
-                        Thread.Sleep(700);
657
-                        Dispatcher.Invoke(() =>
658
-                        {
659
-                            if (APP.W_MinToolbar != null)
660
-                            {
661
-                                APP.W_MinToolbar.Hide();
662
-                            }
663
-                        });
664
-                    }))).Start();
665
-                }
666
-                catch (Exception ex)
667
-                {
668
-                    LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
669
-                }
513
+                    FileToolsCommon.DeleteFile(TempAudioPathName1);
514
+                    FileToolsCommon.DeleteFile(TempAudioPathName2);
515
+                    FileToolsCommon.DeleteFile(TempVideoPathName);
516
+                }))).Start();
517
+                Click_stopRecordingScreen();
670 518
             }
671 519
             Hide();
520
+            End();
672 521
         }
673 522
 
674 523
         public void MaxToobar()
@@ -703,79 +552,76 @@ namespace XHWK.WKTool
703 552
         /// </summary>
704 553
         public void PenPractice()
705 554
         {
706
-            if (!IsFirstRS)
555
+            if (flg != 11 && flg != 10)
707 556
             {
708
-                if (flg != 11 && flg != 10)
709
-                {
710
-                    #region 防止连击
557
+                #region 防止连击
711 558
 
712
-                    if (IsPressButton)
713
-                    {
714
-                        return;
715
-                    }
716
-                    else
559
+                if (IsPressButton)
560
+                {
561
+                    return;
562
+                }
563
+                else
564
+                {
565
+                    IsPressButton = true;
566
+                    new Thread(new ThreadStart(new Action(() =>
717 567
                     {
718
-                        IsPressButton = true;
719
-                        new Thread(new ThreadStart(new Action(() =>
720
-                        {
721
-                            Thread.Sleep(500);
722
-                            IsPressButton = false;
723
-                        }))).Start();
724
-                    }
568
+                        Thread.Sleep(500);
569
+                        IsPressButton = false;
570
+                    }))).Start();
571
+                }
725 572
 
726
-                    #endregion 防止连击
573
+                #endregion 防止连击
727 574
 
728
-                    string time = GetTimeStamp();
729
-                    string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
730
-                    if (!Directory.Exists(tempPath))
575
+                string time = GetTimeStamp();
576
+                string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
577
+                if (!Directory.Exists(tempPath))
578
+                {
579
+                    Directory.CreateDirectory(tempPath);
580
+                }
581
+                try
582
+                {
583
+                    Dispatcher.Invoke(() =>
731 584
                     {
732
-                        Directory.CreateDirectory(tempPath);
733
-                    }
734
-                    try
585
+                        //borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
586
+                        //borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
587
+                        if (APP.W_PracticeWindow == null)
588
+                        {
589
+                            APP.W_PracticeWindow = new PracticeWindow
590
+                            {
591
+                                Width = pwidth,
592
+                                Height = pHeight,
593
+                                Left = 0,
594
+                                Top = 0
595
+                            };
596
+                            //practiceWin.Owner = this;
597
+                        }
598
+                        //APP.W_PracticeWindow.InitPen();
599
+                        //APP.W_PracticeWindow.InitTQLPPen();
600
+                        APP.W_PracticeWindow.Initialize();// imagePath);
601
+                        flg = 11;
602
+                        APP.W_PracticeWindow.Blue();
603
+                        APP.W_PracticeWindow.Show();
604
+                        APP.W_PracticeWindow.Topmost = true;
605
+                        APP.W_PracticeWindow.Focus();
606
+                    });
607
+
608
+                    new Thread(new ThreadStart(new Action(() =>
735 609
                     {
736 610
                         Dispatcher.Invoke(() =>
737 611
                         {
738
-                            //borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
739
-                            //borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
740
-                            if (APP.W_PracticeWindow == null)
741
-                            {
742
-                                APP.W_PracticeWindow = new PracticeWindow
743
-                                {
744
-                                    Width = pwidth,
745
-                                    Height = pHeight,
746
-                                    Left = 0,
747
-                                    Top = 0
748
-                                };
749
-                                //practiceWin.Owner = this;
750
-                            }
751
-                            //APP.W_PracticeWindow.InitPen();
752
-                            //APP.W_PracticeWindow.InitTQLPPen();
753
-                            APP.W_PracticeWindow.Initialize();// imagePath);
754
-                            flg = 11;
755
-                            APP.W_PracticeWindow.Blue();
756
-                            APP.W_PracticeWindow.Show();
757
-                            APP.W_PracticeWindow.Topmost = true;
758
-                            APP.W_PracticeWindow.Focus();
612
+                            APP.W_PracticeWindow.Topmost = false;
759 613
                         });
760
-
761
-                        new Thread(new ThreadStart(new Action(() =>
614
+                        Thread.Sleep(500);
615
+                        Dispatcher.Invoke(() =>
762 616
                         {
763
-                            Dispatcher.Invoke(() =>
764
-                            {
765
-                                APP.W_PracticeWindow.Topmost = false;
766
-                            });
767
-                            Thread.Sleep(500);
768
-                            Dispatcher.Invoke(() =>
769
-                            {
770
-                                //Owner = APP.W_PracticeWindow;
771
-                                Topmost = true;
772
-                            });
773
-                        }))).Start();
774
-                    }
775
-                    catch (Exception ex)
776
-                    {
777
-                        LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
778
-                    }
617
+                            //Owner = APP.W_PracticeWindow;
618
+                            Topmost = true;
619
+                        });
620
+                    }))).Start();
621
+                }
622
+                catch (Exception ex)
623
+                {
624
+                    LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
779 625
                 }
780 626
             }
781 627
         }
@@ -1109,14 +955,7 @@ namespace XHWK.WKTool
1109 955
         /// </summary>
1110 956
         public event StopRecordingScreen Click_stopRecordingScreen;
1111 957
 
1112
-        /// <summary>
1113
-        /// 黑笔
1114
-        /// </summary>
1115
-        /// <param name="sender"></param>
1116
-        /// <param name="e"></param>
1117
-        private void BtnBlackPen_Click(object sender, RoutedEventArgs e)
1118
-        {
1119
-        }
958
+
1120 959
 
1121 960
         /// <summary>
1122 961
         /// 移动工具栏
@@ -1180,43 +1019,25 @@ namespace XHWK.WKTool
1180 1019
             {
1181 1020
                 if (flg == 10)
1182 1021
                 {
1183
-                    //Dispatcher.Invoke(() =>
1184
-                    //{
1185
-                    //    borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
1186
-                    //    borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
1187
-                    //});
1188 1022
                     flg = 0;
1189
-                    //this.Owner = null;
1190 1023
                     APP.W_PracticeWindow.ReturnPractice();
1191 1024
                 }
1192 1025
                 else if (flg == 11)
1193 1026
                 {
1194
-                    //Dispatcher.Invoke(() =>
1195
-                    //{
1196
-                    //    borTwo.Background = new SolidColorBrush(Colors.LightSkyBlue);
1197
-                    //    borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
1198
-                    //});
1199 1027
                     flg = 10;
1200 1028
                     APP.W_PracticeWindow.Red();
1201 1029
                 }
1202 1030
                 else
1203 1031
                 {
1204
-                    //Dispatcher.Invoke(() =>
1205
-                    //{
1206
-                    //    borTwo.Background = new SolidColorBrush(Colors.LightSkyBlue);
1207
-                    //    borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
1208
-                    //});
1209 1032
                     if (APP.W_PracticeWindow == null)
1210 1033
                     {
1211 1034
                         APP.W_PracticeWindow = new PracticeWindow
1212 1035
                         {
1213
-                            //APP.W_PracticeWindow.Topmost = true;
1214 1036
                             Width = pwidth,
1215 1037
                             Height = pHeight,
1216 1038
                             Left = 0,
1217 1039
                             Top = 0
1218 1040
                         };
1219
-                        //practiceWin.Owner = this;
1220 1041
                     }
1221 1042
                     APP.W_PracticeWindow.InitPen();
1222 1043
                     APP.W_PracticeWindow.InitTQLPPen();
@@ -1249,7 +1070,7 @@ namespace XHWK.WKTool
1249 1070
         /// <param name="e"></param>
1250 1071
         private void BtnReturn_Click(object sender, RoutedEventArgs e)
1251 1072
         {
1252
-            if (!IsFirstRS)
1073
+            if (_state==State.Pause || _state == State.Start)
1253 1074
             {
1254 1075
                 MessageBoxResult br = MessageWindow.Show("退出将取消保存当前录屏,是否继续?", "提示", MessageBoxButton.OKCancel);
1255 1076
                 if (br == MessageBoxResult.Cancel)
@@ -1258,7 +1079,7 @@ namespace XHWK.WKTool
1258 1079
                 }
1259 1080
                 k_hook.Stop();
1260 1081
                 BtnRecordingScreen.ToolTip = "开始";
1261
-                IsSuspend = true;
1082
+
1262 1083
                 TxbTime.Content = "00:00";
1263 1084
                 End();
1264 1085
                 APP.W_PracticeWindow.ReturnPractice();
@@ -1289,7 +1110,7 @@ namespace XHWK.WKTool
1289 1110
                     {
1290 1111
                         LogHelper.WriteErrLog("【录屏返回】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
1291 1112
                     }
1292
-                    IsFirstRS = true;
1113
+         
1293 1114
                     new Thread(new ThreadStart(new Action(() =>
1294 1115
                     {
1295 1116
                         VideoInfo = null;
@@ -1320,23 +1141,6 @@ namespace XHWK.WKTool
1320 1141
             Hide();
1321 1142
         }
1322 1143
 
1323
-        /// <summary>
1324
-        /// 批注退出 废弃
1325
-        /// </summary>
1326
-        public void ReturnPractice()
1327
-        {
1328
-            new Thread(new ThreadStart(new Action(() =>
1329
-            {
1330
-                flg = 0;
1331
-                Thread.Sleep(500);
1332
-                Dispatcher.Invoke(() =>
1333
-                {
1334
-                    Owner = null;
1335
-                    APP.W_PracticeWindow.Hide();
1336
-                });
1337
-            }))).Start();
1338
-        }
1339
-
1340 1144
         /// <summary>
1341 1145
         /// 修改笔状态
1342 1146
         /// </summary>
@@ -1361,17 +1165,7 @@ namespace XHWK.WKTool
1361 1165
                     }
1362 1166
                     APP.W_MinToolbar.Topmost = true;
1363 1167
                     double MinToolTop = Top;
1364
-                    //int ColorType = 0;
1365
-                    //if (APP.SkinStyle == "1")
1366
-                    //{
1367
-                    //    ColorType = 0;
1368
-                    //    MinToolTop = this.Top + ((this.ActualHeight - btnReturn.ActualHeight) / 2);
1369
-                    //}
1370
-                    //else if (APP.SkinStyle == "2")
1371
-                    //{
1372
-                    //    ColorType = 1;
1373
-                    //    MinToolTop = this.Top + ((this.ActualHeight - VbxBlack.ActualHeight) / 2);
1374
-                    //}
1168
+
1375 1169
                     new Thread(new ThreadStart(new Action(() =>
1376 1170
                     {
1377 1171
                         Thread.Sleep(500);

+ 75
- 0
XHWK.WKTool/Utils/ZAsposeUtil.cs Parādīt failu

@@ -0,0 +1,75 @@
1
+using Aspose.Words.Saving;
2
+
3
+using Common.system;
4
+
5
+using System;
6
+using System.Collections.Generic;
7
+using System.IO;
8
+
9
+namespace XHWK.WKTool.Utils
10
+{
11
+    class ZAsposeUtil
12
+    {
13
+        /// <summary>
14
+        /// 将Word文档转换为图片的方法(该方法基于第三方DLL),
15
+        /// 你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\","ImageFile", 1, 20);
16
+        /// </summary>
17
+        /// <param name="pdfInputPath">Word文件路径</param>
18
+        /// <param name="imageOutputPath">图片输出路径,如果为空,默认值为Word所在路径</param>
19
+        /// <param name="imageName">图片的名字,不需要带扩展名,如果为空,默认值为Word的名称</param>
20
+        /// <param name="startPageNum">从PDF文档的第几页开始转换,如果为0,默认值为1</param>
21
+        /// <param name="endPageNum">从PDF文档的第几页开始停止转换,如果为0,默认值为Word总页数</param>
22
+        /// <param name="imageFormat">设置所需图片格式,如果为null,默认格式为PNG</param>
23
+        /// <param name="resolution">设置图片的像素,数字越大越清晰,如果为0,默认值为128,建议最大值不要超过1024</param>
24
+        public static List<string> ConvertWordToImage(
25
+            string wordInputPath,
26
+            string imageOutputPath,
27
+            string imageName,
28
+            int startPageNum = 0,
29
+            int endPageNum = 0,
30
+            Aspose.Words.SaveFormat imageFormat = Aspose.Words.SaveFormat.Png,
31
+            float resolution = 128
32
+            )
33
+        {
34
+            // 返回的图片绝对路径集合
35
+            List<string> images = new List<string>();
36
+            try
37
+            {
38
+                // open word file
39
+                Aspose.Words.Document doc = new Aspose.Words.Document(wordInputPath);
40
+
41
+                // validate parameter
42
+                if (doc == null) { throw new Exception("Word文件无效或者Word文件被加密!"); }
43
+                if (imageOutputPath.Trim().Length == 0) { imageOutputPath = System.IO.Path.GetDirectoryName(wordInputPath); }
44
+                if (!Directory.Exists(imageOutputPath)) { Directory.CreateDirectory(imageOutputPath); }
45
+                if (imageName.Trim().Length == 0) { imageName = System.IO.Path.GetFileNameWithoutExtension(wordInputPath); }
46
+                if (startPageNum <= 0) { startPageNum = 1; }
47
+                if (endPageNum > doc.PageCount || endPageNum <= 0) { endPageNum = doc.PageCount; }
48
+                if (startPageNum > endPageNum) { int tempPageNum = startPageNum; startPageNum = endPageNum; endPageNum = startPageNum; }
49
+                if (resolution <= 0) { resolution = 128; }
50
+
51
+                ImageSaveOptions imageSaveOptions = new ImageSaveOptions(imageFormat)
52
+                {
53
+                    Resolution = resolution
54
+                };
55
+
56
+                // start to convert each page
57
+                for (int i = startPageNum; i <= endPageNum; i++)
58
+                {
59
+                    imageSaveOptions.PageIndex = i - 1;
60
+                    string savepath = System.IO.Path.Combine(imageOutputPath, imageName) + "_" + i + "." + imageFormat.ToString();
61
+                    doc.Save(savepath, imageSaveOptions);
62
+                    images.Add(savepath);
63
+                }
64
+                imageSaveOptions = null;
65
+                doc = null;
66
+            }
67
+            catch (Exception ex)
68
+            {
69
+                MessageWindow.Show("该文件无法使用!");
70
+                LogHelper.WriteErrLog("【导入方法(ConvertWordToImage)】错误日志:" + ex.Message, ex);
71
+            }
72
+            return images;
73
+        }
74
+    }
75
+}

+ 130
- 0
XHWK.WKTool/Utils/ZAudioRecordHelper.cs Parādīt failu

@@ -0,0 +1,130 @@
1
+using System;
2
+
3
+using NAudio.Wave;
4
+
5
+namespace XHWK.WKTool.Utils
6
+{
7
+    public class ZAudioRecordHelper
8
+    {
9
+        public enum RecordType
10
+        {
11
+            loudspeaker = 0, // 扬声器
12
+            microphone = 1 //麦克风
13
+        }
14
+
15
+        public enum RecordState
16
+        {
17
+            stop = 0,
18
+            start = 1,
19
+            pause = 2
20
+        }
21
+
22
+        //录制的类型
23
+        RecordType _t = RecordType.microphone;
24
+
25
+        RecordState _state = RecordState.stop;
26
+
27
+        //录制麦克风的声音
28
+        WaveInEvent waveIn = null; //new WaveInEvent();
29
+                                   //录制扬声器的声音
30
+        WasapiLoopbackCapture capture = null; //new WasapiLoopbackCapture();
31
+                                              //生成音频文件的对象
32
+        WaveFileWriter writer = null;
33
+
34
+        string audioFile = "";
35
+
36
+        public ZAudioRecordHelper(string filePath,RecordType type)
37
+        {
38
+            _t = type;
39
+            audioFile = filePath;
40
+        }
41
+
42
+        /// <summary>
43
+        /// 开始录制
44
+        /// </summary>
45
+        public void StartRecordAudio()
46
+        {
47
+            _state = RecordState.start;
48
+            try
49
+            {
50
+                if (_t == RecordType.microphone)
51
+                {
52
+                    waveIn = new WaveInEvent();
53
+                    writer = new WaveFileWriter(audioFile, waveIn.WaveFormat);
54
+                    //开始录音,写数据
55
+                    waveIn.DataAvailable += (s, a) =>
56
+                    {
57
+                        if (_state == RecordState.start) {
58
+                            writer.Write(a.Buffer, 0, a.BytesRecorded);
59
+                        }
60
+                    };
61
+
62
+                    //结束录音
63
+                    waveIn.RecordingStopped += (s, a) =>
64
+                    {
65
+                        writer.Dispose();
66
+                        writer = null;
67
+                        waveIn.Dispose();
68
+                    };
69
+
70
+                    waveIn.StartRecording();
71
+                }
72
+                else
73
+                {
74
+                    capture = new WasapiLoopbackCapture();
75
+                    writer = new WaveFileWriter(audioFile, capture.WaveFormat);
76
+
77
+                    capture.DataAvailable += (s, a) =>
78
+                    {
79
+                        if (_state == RecordState.start)
80
+                        {
81
+                            writer.Write(a.Buffer, 0, a.BytesRecorded);
82
+                        }
83
+                    };
84
+                    //结束录音
85
+                    capture.RecordingStopped += (s, a) =>
86
+                    {
87
+                        writer.Dispose();
88
+                        writer = null;
89
+                        capture.Dispose();
90
+                    };
91
+                    capture.StartRecording();
92
+                } 
93
+            }
94
+            catch (Exception ex)
95
+            {
96
+            }
97
+        }
98
+
99
+        /// <summary>
100
+        /// 结束录制
101
+        /// </summary>
102
+        public void StopRecordAudio()
103
+        {
104
+            _state = RecordState.stop;
105
+            if (_t == RecordType.microphone)
106
+            {
107
+                waveIn.StopRecording();
108
+            }
109
+            else
110
+            {
111
+                capture.StopRecording();
112
+            }
113
+        }
114
+
115
+        /// <summary>
116
+        /// 暂停录制
117
+        /// </summary>
118
+        public void PauseRecordAudio()
119
+        {
120
+            _state = RecordState.pause;
121
+        }
122
+
123
+        /// <summary>
124
+        /// 恢复录制
125
+        /// </summary>
126
+        public void ResumeRecordAudio() {
127
+            _state = RecordState.start;
128
+        }
129
+    }
130
+}

XHWK.WKTool/Utils/PrintUtils.cs → XHWK.WKTool/Utils/ZPrintUtils.cs Parādīt failu

@@ -1,18 +1,17 @@
1
-using System;
2
-using System.Collections.Generic;
1
+using System.Collections.Generic;
3 2
 using System.Drawing.Printing;
4 3
 using System.Runtime.InteropServices;
5 4
 
6 5
 namespace XHWK.WKTool.Utils
7 6
 {
8
-    class PrintUtils
7
+    class ZPrintUtils
9 8
     {
10 9
         private static PrintDocument fPrintDocument = new PrintDocument();
11 10
         /// <summary>
12 11
         /// 获取本机默认打印机名称
13 12
         /// </summary>
14 13
         /// <returns></returns>
15
-        public static String DefaultPrinter()
14
+        public static string DefaultPrinter()
16 15
         {
17 16
             return fPrintDocument.PrinterSettings.PrinterName;
18 17
         }

+ 157
- 0
XHWK.WKTool/Utils/ZVideoRecordHelper.cs Parādīt failu

@@ -0,0 +1,157 @@
1
+using System;
2
+using System.Runtime.InteropServices;
3
+
4
+using Accord.Video;
5
+using Accord.Video.FFMPEG;
6
+
7
+namespace XHWK.WKTool.Utils
8
+{
9
+    public class ZVideoRecordHelper
10
+    {
11
+
12
+        public enum RecordState
13
+        {
14
+            stop = 0,
15
+            start = 1,
16
+            pause = 2
17
+        }
18
+
19
+        RecordState _state = RecordState.stop;
20
+
21
+        string _filePath = "";
22
+        int _width = 0;
23
+        int _height = 0;
24
+        //录制帧率
25
+        int _rate = 5;
26
+        //录制质量
27
+        int _quality = 8;
28
+        bool _captureMouse = false;
29
+
30
+        private VideoFileWriter videoWriter = new VideoFileWriter();//视频写入
31
+        private ScreenCaptureStream videoStreamer;//视频捕获
32
+
33
+        public ZVideoRecordHelper(string filePath, int width,int height,int rate = 5,int quality=8, bool captureMouse = false)
34
+        {
35
+            _filePath = filePath;
36
+            _width = width / 2 * 2;
37
+            _height = height / 2 * 2;
38
+            _rate = rate;
39
+            _quality = quality;
40
+            _captureMouse = captureMouse;
41
+        }
42
+
43
+        /// <summary>
44
+        /// 开始录制
45
+        /// </summary>
46
+        public bool StartRecordVideo()
47
+        {
48
+            _state = RecordState.start;
49
+            try
50
+            {
51
+                // 打开写入
52
+                lock (this)
53
+                {
54
+                    videoWriter.Open(
55
+                        _filePath,
56
+                        _width,
57
+                        _height,
58
+                        _rate,
59
+                        VideoCodec.MPEG4,
60
+                        _width * _height * _quality
61
+                    );
62
+                }
63
+
64
+                System.Drawing.Rectangle rec = new System.Drawing.Rectangle(0,0,_width,_height);
65
+                videoStreamer = new ScreenCaptureStream(rec, 1000 / _rate);//帧间隔需要和帧率关联,不然录的10秒视频文件不是10s
66
+                videoStreamer.NewFrame += VideoNewFrame;
67
+                videoStreamer.Start();
68
+            }
69
+            catch (Exception ex)
70
+            {
71
+                return false;
72
+            }
73
+
74
+            return true;
75
+        }
76
+
77
+
78
+        [DllImport("user32.dll")]
79
+        private static extern bool GetCursorInfo(out CURSORINFO pci);
80
+
81
+        [StructLayout(LayoutKind.Sequential)]
82
+        private struct POINT
83
+        {
84
+            public Int32 x;
85
+            public Int32 y;
86
+        }
87
+
88
+        [StructLayout(LayoutKind.Sequential)]
89
+        private struct CURSORINFO
90
+        {
91
+            public Int32 cbSize;
92
+            public Int32 flags;
93
+            public IntPtr hCursor;
94
+            public POINT ptScreenPos;
95
+        }
96
+
97
+        // 帧返回时绘制上鼠标
98
+        private void VideoNewFrame(object sender, NewFrameEventArgs e)
99
+        {
100
+            if (_state == RecordState.start)
101
+            {
102
+                if (_captureMouse)
103
+                {
104
+                    var g = System.Drawing.Graphics.FromImage(e.Frame);
105
+                    CURSORINFO pci;
106
+                    pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
107
+                    GetCursorInfo(out pci);
108
+                    try
109
+                    {
110
+                        System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor);
111
+                        cur.Draw(
112
+                            g,
113
+                            new System.Drawing.Rectangle(
114
+                                System.Windows.Forms.Cursor.Position.X - 10,
115
+                                System.Windows.Forms.Cursor.Position.Y - 10,
116
+                                cur.Size.Width,
117
+                                cur.Size.Height
118
+                            )
119
+                        );
120
+                    }
121
+                    catch { }//打开任务管理器时会导致异常
122
+                }
123
+                videoWriter.WriteVideoFrame(e.Frame);
124
+            }
125
+        }
126
+
127
+        /// <summary>
128
+        /// 结束录制
129
+        /// </summary>
130
+        public void StopRecordVideo()
131
+        {
132
+            _state = RecordState.stop;
133
+            // 停止
134
+            videoStreamer.Stop();
135
+
136
+            //结束写入
137
+            videoWriter.Close();
138
+            videoWriter.Dispose();
139
+        }
140
+
141
+        /// <summary>
142
+        /// 暂停录制
143
+        /// </summary>
144
+        public void PauseRecordVideo()
145
+        {
146
+            _state = RecordState.pause;
147
+        }
148
+
149
+        /// <summary>
150
+        /// 恢复录制
151
+        /// </summary>
152
+        public void ResumeRecordVideo()
153
+        {
154
+            _state = RecordState.start;
155
+        }
156
+    }
157
+}

+ 94
- 263
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Parādīt failu

@@ -1,7 +1,6 @@
1 1
 using Accord.Video.FFMPEG;
2 2
 
3 3
 using Aspose.Slides;
4
-using Aspose.Words.Saving;
5 4
 
6 5
 using ComeCapture;
7 6
 
@@ -13,16 +12,11 @@ using NReco.VideoConverter;
13 12
 
14 13
 using RobotpenGateway;
15 14
 
16
-using Spire.Pdf;
17
-using Spire.Pdf.Print;
18
-
19 15
 using System;
20 16
 using System.Collections.Generic;
21 17
 using System.Data;
22 18
 using System.Diagnostics;
23 19
 using System.Drawing;
24
-using System.Drawing.Imaging;
25
-using System.Drawing.Printing;
26 20
 using System.IO;
27 21
 using System.Linq;
28 22
 using System.Text.RegularExpressions;
@@ -148,9 +142,10 @@ namespace XHWK.WKTool
148 142
         /// </summary>
149 143
         public XHMicroLessonSystemWindow()
150 144
         {
151
-            new Aspose.Words.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
152
-            new Aspose.Pdf.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
153
-            new Aspose.Slides.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
145
+            byte[] license = Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=");
146
+            new Aspose.Words.License().SetLicense(new MemoryStream(license));
147
+            new Aspose.Pdf.License().SetLicense(new MemoryStream(license));
148
+            new Aspose.Slides.License().SetLicense(new MemoryStream(license));
154 149
             InitializeComponent();
155 150
 
156 151
             #region 调整文字大小
@@ -663,22 +658,6 @@ namespace XHWK.WKTool
663 658
                     InitializePrint("", GridM.ActualWidth, gridActHeight);
664 659
                 }
665 660
             }
666
-            //if (APP.W_PrintWindow == null)
667
-            //{
668
-            //    APP.W_PrintWindow = new PrintWindow
669
-            //    {
670
-            //        Owner = this
671
-            //    };
672
-            //}
673
-            //if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PageImagePath))
674
-            //{
675
-            //    APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PageImagePath, GridM.ActualWidth, GridM.ActualHeight);
676
-            //}
677
-            //else
678
-            //{
679
-            //    APP.W_PrintWindow.Initialize("", GridM.ActualWidth, gridActHeight);
680
-            //}
681
-            //APP.W_PrintWindow.ShowDialog();
682 661
         }
683 662
 
684 663
         /// <summary>
@@ -1446,10 +1425,7 @@ namespace XHWK.WKTool
1446 1425
                             // 图片绝对路径集合
1447 1426
                             List<string> images = new List<string>();
1448 1427
                             string directoryPath = pathTemp;
1449
-                            //aspose许可证
1450
-                            //Aspose.Pdf.License l = new Aspose.Pdf.License();
1451
-                            //string licenseName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Aspose.Total.Product.Family.lic");
1452
-                            //l.SetLicense(licenseName);
1428
+
1453 1429
                             //定义Jpeg转换设备
1454 1430
                             Aspose.Pdf.Document document = new Aspose.Pdf.Document(path);
1455 1431
                             Aspose.Pdf.Devices.JpegDevice device = new Aspose.Pdf.Devices.JpegDevice();
@@ -1770,7 +1746,8 @@ namespace XHWK.WKTool
1770 1746
                         try
1771 1747
                         {
1772 1748
                             string paths = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
1773
-                            string[] page = ConvertWordToImage(filepath, paths, "", 0, 0, null, 0).ToArray();
1749
+                            WordImgNum += 1;
1750
+                            string[] page = ZAsposeUtil.ConvertWordToImage(filepath, paths, "" + WordImgNum, 0, 0).ToArray();
1774 1751
                             int num = 0;
1775 1752
                             Dispatcher.Invoke(new Action(() =>
1776 1753
                             {
@@ -1868,6 +1845,11 @@ namespace XHWK.WKTool
1868 1845
             APP.myloading.Hide();
1869 1846
         }
1870 1847
 
1848
+        /// <summary>
1849
+        /// 防止图片地址重复
1850
+        /// </summary>
1851
+        private long WordImgNum = 9999;
1852
+
1871 1853
         /// <summary>
1872 1854
         /// 导入文档
1873 1855
         /// </summary>
@@ -2089,7 +2071,8 @@ namespace XHWK.WKTool
2089 2071
                                   try
2090 2072
                                   {
2091 2073
                                       string paths = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
2092
-                                      string[] page = ConvertWordToImage(filepath, paths, "", 0, 0, null, 0).ToArray();
2074
+                                      WordImgNum += 1;
2075
+                                      string[] page = ZAsposeUtil.ConvertWordToImage(filepath, paths, "" + WordImgNum, 0, 0).ToArray();
2093 2076
                                       int num = 0;
2094 2077
                                       for (int i = 0 + APP.PageContextData.pagenum; i < page.Length + APP.PageContextData.pagenum; i++)//给画板模型加图片路径
2095 2078
                                       {
@@ -2198,101 +2181,6 @@ namespace XHWK.WKTool
2198 2181
             }
2199 2182
         }
2200 2183
 
2201
-        /// <summary>
2202
-        /// 防止图片地址重复
2203
-        /// </summary>
2204
-        private long WordImgNum = 9999;
2205
-
2206
-        /// <summary>
2207
-        /// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\",
2208
-        /// "ImageFile", 1, 20, ImageFormat.Png, 256);
2209
-        /// </summary>
2210
-        /// <param name="pdfInputPath">Word文件路径</param>
2211
-        /// <param name="imageOutputPath">图片输出路径,如果为空,默认值为Word所在路径</param>
2212
-        /// <param name="imageName">图片的名字,不需要带扩展名,如果为空,默认值为Word的名称</param>
2213
-        /// <param name="startPageNum">从PDF文档的第几页开始转换,如果为0,默认值为1</param>
2214
-        /// <param name="endPageNum">从PDF文档的第几页开始停止转换,如果为0,默认值为Word总页数</param>
2215
-        /// <param name="imageFormat">设置所需图片格式,如果为null,默认格式为PNG</param>
2216
-        /// <param name="resolution">设置图片的像素,数字越大越清晰,如果为0,默认值为128,建议最大值不要超过1024</param>
2217
-        public List<string> ConvertWordToImage(string wordInputPath, string imageOutputPath,
2218
-            string imageName, int startPageNum, int endPageNum, ImageFormat imageFormat, float resolution)
2219
-        {
2220
-            // 返回的图片绝对路径集合
2221
-            List<string> images = new List<string>();
2222
-            try
2223
-            {
2224
-                // open word file
2225
-                Aspose.Words.Document doc = new Aspose.Words.Document(wordInputPath);
2226
-
2227
-                // validate parameter
2228
-                if (doc == null) { throw new Exception("Word文件无效或者Word文件被加密!"); }
2229
-                if (imageOutputPath.Trim().Length == 0) { imageOutputPath = System.IO.Path.GetDirectoryName(wordInputPath); }
2230
-                if (!Directory.Exists(imageOutputPath)) { Directory.CreateDirectory(imageOutputPath); }
2231
-                if (imageName.Trim().Length == 0) { imageName = System.IO.Path.GetFileNameWithoutExtension(wordInputPath); }
2232
-                if (startPageNum <= 0) { startPageNum = 1; }
2233
-                if (endPageNum > doc.PageCount || endPageNum <= 0) { endPageNum = doc.PageCount; }
2234
-                if (startPageNum > endPageNum) { int tempPageNum = startPageNum; startPageNum = endPageNum; endPageNum = startPageNum; }
2235
-                if (imageFormat == null) { imageFormat = ImageFormat.Png; }
2236
-                if (resolution <= 0) { resolution = 128; }
2237
-
2238
-                ImageSaveOptions imageSaveOptions = new ImageSaveOptions(GetSaveFormat(imageFormat))
2239
-                {
2240
-                    Resolution = resolution
2241
-                };
2242
-
2243
-                // start to convert each page
2244
-                for (int i = startPageNum; i <= endPageNum; i++)
2245
-                {
2246
-                    imageSaveOptions.PageIndex = i - 1;
2247
-                    doc.Save(System.IO.Path.Combine(imageOutputPath, imageName) + "_" + WordImgNum.ToString() + "." + imageFormat.ToString(), imageSaveOptions);
2248
-                    images.Add(System.IO.Path.Combine(imageOutputPath, imageName) + "_" + WordImgNum.ToString() + "." + imageFormat.ToString());
2249
-                    WordImgNum++;
2250
-                }
2251
-                imageSaveOptions = null;
2252
-                doc = null;
2253
-            }
2254
-            catch (Exception ex)
2255
-            {
2256
-                //if(ex.Message.ToString().Equals("{\"The document appears to be corrupted and cannot be loaded.\"}"))
2257
-                //{
2258
-                //    MessageWindow.Show("Word文件无效或者Word文件被加密!");
2259
-                //}
2260
-                //else
2261
-                //{
2262
-                MessageWindow.Show("该文件无法使用!");
2263
-                //}
2264
-                LogHelper.WriteErrLog("【导入方法(ConvertWordToImage)】错误日志:" + ex.Message, ex);
2265
-            }
2266
-            return images;
2267
-        }
2268
-
2269
-        private static Aspose.Words.SaveFormat GetSaveFormat(ImageFormat imageFormat)
2270
-        {
2271
-            Aspose.Words.SaveFormat sf;// = SaveFormat.Unknown;
2272
-            if (imageFormat.Equals(ImageFormat.Png))
2273
-            {
2274
-                sf = Aspose.Words.SaveFormat.Png;
2275
-            }
2276
-            else if (imageFormat.Equals(ImageFormat.Jpeg))
2277
-            {
2278
-                sf = Aspose.Words.SaveFormat.Jpeg;
2279
-            }
2280
-            else if (imageFormat.Equals(ImageFormat.Tiff))
2281
-            {
2282
-                sf = Aspose.Words.SaveFormat.Tiff;
2283
-            }
2284
-            else if (imageFormat.Equals(ImageFormat.Bmp))
2285
-            {
2286
-                sf = Aspose.Words.SaveFormat.Bmp;
2287
-            }
2288
-            else
2289
-            {
2290
-                sf = Aspose.Words.SaveFormat.Unknown;
2291
-            }
2292
-
2293
-            return sf;
2294
-        }
2295
-
2296 2184
         #endregion 导入转换图片
2297 2185
 
2298 2186
         #endregion 导入截图
@@ -3210,12 +3098,12 @@ namespace XHWK.WKTool
3210 3098
         private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
3211 3099
         {
3212 3100
             Record();
3213
-            if (!APP.CheckScreenCapturerRecorder())
3214
-            {
3215
-                MessageWindow.Show("使用此功能需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");
3216
-                //APP.InstallScreenCapturerRecorder();
3217
-                return;
3218
-            }
3101
+            //if (!APP.CheckScreenCapturerRecorder())
3102
+            //{
3103
+            //    MessageWindow.Show("使用此功能需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");
3104
+            //    //APP.InstallScreenCapturerRecorder();
3105
+            //    return;
3106
+            //}
3219 3107
 
3220 3108
             k_hook.Stop();
3221 3109
             if (APP.W_ScreenRecordingToolbarWindow == null)
@@ -3279,20 +3167,19 @@ namespace XHWK.WKTool
3279 3167
         #region 变量
3280 3168
 
3281 3169
         /// <summary>
3282
-        /// 音频保存路径名
3170
+        /// 视频合成前路径名
3283 3171
         /// </summary>
3284
-        private string AudioPathName;
3172
+        private string TempVideoPathName;
3285 3173
 
3286 3174
         /// <summary>
3287
-        /// 频保存路径名
3175
+        /// 频保存路径名
3288 3176
         /// </summary>
3289
-        private string VideoSavePathName;
3177
+        private string TempAudioPathName;
3290 3178
 
3291 3179
         /// <summary>
3292
-        /// 视频合成路径名
3180
+        /// 视频保存路径名
3293 3181
         /// </summary>
3294
-        private string VideoSynthesisPathName;
3295
-
3182
+        private string VideoSavePathName;
3296 3183
         /// <summary>
3297 3184
         /// 截图定时器
3298 3185
         /// </summary>
@@ -3340,7 +3227,7 @@ namespace XHWK.WKTool
3340 3227
                 IsPressButton = true;
3341 3228
                 new Thread(new ThreadStart(new Action(() =>
3342 3229
                 {
3343
-                    Thread.Sleep(3000);
3230
+                    Thread.Sleep(1000);
3344 3231
                     IsPressButton = false;
3345 3232
                 }))).Start();
3346 3233
             }
@@ -3370,30 +3257,30 @@ namespace XHWK.WKTool
3370 3257
 
3371 3258
                 #region 检测麦克风扬声器是否可用
3372 3259
 
3373
-                string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
3374
-                FileToolsCommon.CreateDirectory(AudioPath);
3375
-                string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
3376
-                try
3377
-                {
3378
-                    FileToolsCommon.DeleteFile(audioMicrophonePath);
3379
-                }
3380
-                catch (Exception)
3381
-                {
3382
-                }
3383
-                //麦克风
3384
-                if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
3385
-                {
3386
-                    APP.FFmpeg.StopRecordAudio(1);
3387
-                }
3388
-                else
3389
-                {
3390
-                    //无法录制麦克风
3391
-                    MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
3392
-                    if (Res == MessageBoxResult.Cancel)
3393
-                    {
3394
-                        return;
3395
-                    }
3396
-                }
3260
+                //string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
3261
+                //FileToolsCommon.CreateDirectory(AudioPath);
3262
+                //string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
3263
+                //try
3264
+                //{
3265
+                //    FileToolsCommon.DeleteFile(audioMicrophonePath);
3266
+                //}
3267
+                //catch (Exception)
3268
+                //{
3269
+                //}
3270
+                ////麦克风
3271
+                //if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
3272
+                //{
3273
+                //    APP.FFmpeg.StopRecordAudio(1);
3274
+                //}
3275
+                //else
3276
+                //{
3277
+                //    //无法录制麦克风
3278
+                //    MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
3279
+                //    if (Res == MessageBoxResult.Cancel)
3280
+                //    {
3281
+                //        return;
3282
+                //    }
3283
+                //}
3397 3284
 
3398 3285
                 #endregion 检测麦克风扬声器是否可用
3399 3286
 
@@ -3432,10 +3319,9 @@ namespace XHWK.WKTool
3432 3319
                 new Thread(new ThreadStart(new Action(() =>
3433 3320
                 {
3434 3321
                     Thread.Sleep(3000);
3435
-                   
3322
+
3436 3323
                     Dispatcher.Invoke(() =>
3437 3324
                     {
3438
-                       
3439 3325
                         TxbType.Text = "正在录制";
3440 3326
                     });
3441 3327
                     RecordType = 1;
@@ -3446,7 +3332,6 @@ namespace XHWK.WKTool
3446 3332
             {
3447 3333
                 //录制中暂停
3448 3334
                 RecordType = 2;
3449
-     
3450 3335
             }
3451 3336
             else if (RecordType == 2)
3452 3337
             {
@@ -3465,6 +3350,9 @@ namespace XHWK.WKTool
3465 3350
             else if (RecordType == 1)
3466 3351
             {
3467 3352
                 TxbType.Text = "录制中";
3353
+                BtnRecord.Content = "暂停录制";
3354
+                BtnRecord.Visibility = Visibility.Collapsed;
3355
+                BtnRecordSuspend.Visibility = Visibility.Visible;
3468 3356
             }
3469 3357
             else if (RecordType == 2)
3470 3358
             {
@@ -3540,29 +3428,28 @@ namespace XHWK.WKTool
3540 3428
                 WkType = Enum_WKVidetype.RecordingLessons
3541 3429
             };
3542 3430
 
3543
-     
3544 3431
             FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
3545 3432
             FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
3546 3433
 
3547 3434
             VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制." + VideoInfo.VideoType.ToString();
3548 3435
 
3549
-            VideoSynthesisPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn.avi";
3436
+            TempVideoPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn.avi";
3550 3437
             int num = 1;
3551 3438
             while (FileToolsCommon.IsExistFile(VideoSavePathName))
3552 3439
             {
3553 3440
                 VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制_" + num + "." + VideoInfo.VideoType.ToString();
3554
-                VideoSynthesisPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn_" + num + ".avi";
3441
+                TempVideoPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn_" + num + ".avi";
3555 3442
                 num++;
3556 3443
             }
3557 3444
 
3558
-            AudioPathName = VideoSynthesisPathName.Replace(".avi", ".mp3");
3445
+            TempAudioPathName = TempVideoPathName.Replace(".avi", ".mp3");
3559 3446
             gridActWidth = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f) / 2) * 2;
3560 3447
             gridActHeight = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f) / 2) * 2;
3561 3448
 
3562 3449
             lock (this)
3563 3450
             {
3564 3451
                 videoWriter.Open(
3565
-                    VideoSynthesisPathName,
3452
+                    TempVideoPathName,
3566 3453
                     gridActWidth,
3567 3454
                     gridActHeight,
3568 3455
                     5,
@@ -3571,7 +3458,7 @@ namespace XHWK.WKTool
3571 3458
                 );
3572 3459
 
3573 3460
                 waveIn = new WaveInEvent();
3574
-                writer = new WaveFileWriter(AudioPathName, waveIn.WaveFormat);
3461
+                writer = new WaveFileWriter(TempAudioPathName, waveIn.WaveFormat);
3575 3462
                 //开始录音,写数据
3576 3463
                 waveIn.DataAvailable += (s, a) =>
3577 3464
                 {
@@ -3598,7 +3485,7 @@ namespace XHWK.WKTool
3598 3485
             });
3599 3486
 
3600 3487
             ///启动截图
3601
-            timer = new System.Threading.Timer(new TimerCallback(Timer_Elapsed), null, 0, 20);
3488
+            timer = new System.Threading.Timer(new TimerCallback(Timer_Elapsed), null, 0, 200);
3602 3489
         }
3603 3490
 
3604 3491
         /// <summary>
@@ -3614,34 +3501,25 @@ namespace XHWK.WKTool
3614 3501
         {
3615 3502
             if (RecordType == 1)
3616 3503
             {
3617
-                DateTime dt = DateTime.Now;
3618
-                TimeSpan ts = dt.Subtract(Recorddt);//时间差
3619
-                double tsmi = ts.TotalMilliseconds;
3620
-                if (tsmi >= 200.0)
3504
+                Dispatcher.Invoke(() =>
3621 3505
                 {
3622
-                    Dispatcher.Invoke(() =>
3623
-                    {
3624
-
3625
-                        SRTime = SRTime.AddMilliseconds(200);
3626
-
3627
-                        if (SRTime.Hour > 0)
3628
-                        {
3629
-                            TxbTime.Text = SRTime.ToString("HH:mm:ss");
3630
-                        }
3631
-                        else
3632
-                        {
3633
-                            TxbTime.Text = SRTime.ToString("mm:ss");
3634
-                        }
3506
+                    SRTime = SRTime.AddMilliseconds(200);
3635 3507
 
3636
-                    });
3637
-                    Recorddt = Recorddt.AddMilliseconds(200);
3638
-
3639
-                    ThreadPool.QueueUserWorkItem(o =>
3640
-                        {
3641
-                            RecordSaveImage();
3642
-                        });
3508
+                    if (SRTime.Hour > 0)
3509
+                    {
3510
+                        TxbTime.Text = SRTime.ToString("HH:mm:ss");
3643 3511
                     }
3644
-                }
3512
+                    else
3513
+                    {
3514
+                        TxbTime.Text = SRTime.ToString("mm:ss");
3515
+                    }
3516
+                });
3517
+
3518
+                ThreadPool.QueueUserWorkItem(o =>
3519
+                {
3520
+                    RecordSaveImage();
3521
+                });
3522
+            }
3645 3523
         }
3646 3524
 
3647 3525
         /// <summary>
@@ -3651,30 +3529,23 @@ namespace XHWK.WKTool
3651 3529
         {
3652 3530
             try
3653 3531
             {
3654
-                #region 设置大小
3655
-
3656
-                int RsW = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f) / 2) * 2;
3657
-                int RsH = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f) / 2) * 2;
3658
-
3659
-                #endregion 设置大小
3660 3532
 
3661 3533
                 //保存图片
3662 3534
 
3663
-                try {
3535
+                try
3536
+                {
3664 3537
                     Dispatcher.Invoke(() =>
3665 3538
                     {
3666
-
3667
-                        Bitmap bm = ImageHelper.SaveUI2Bitmap(GridMain, RsW, RsH);
3539
+                        Bitmap bm = ImageHelper.SaveUI2Bitmap(GridMain, gridActWidth, gridActHeight);
3668 3540
 
3669 3541
                         videoWriter.WriteVideoFrame(bm);
3670 3542
                         bm.Dispose();
3671 3543
                     });
3672 3544
                 }
3673
-                catch (Exception e) {
3545
+                catch (Exception e)
3546
+                {
3674 3547
                     Console.WriteLine(e.Message);
3675 3548
                 }
3676
-
3677
-                
3678 3549
             }
3679 3550
             catch (Exception ex)
3680 3551
             {
@@ -3748,32 +3619,23 @@ namespace XHWK.WKTool
3748 3619
                     timer.Dispose();
3749 3620
 
3750 3621
                     TxbTime.Text = "00:00";
3751
-
3752 3622
                     TxbType.Text = "保存中";
3753 3623
                 });
3754 3624
 
3755
-                //合成视频
3756
-                Dispatcher.Invoke(() =>
3757
-                {
3758
-                    TxbType.Text = "转码中";
3759
-                });
3760
-
3761 3625
                 FileToolsCommon.DeleteFile(ThumbnailPathName);
3762 3626
                 VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
3763 3627
                 VideoInfo.VideoPath = VideoSavePathName;
3764 3628
                 VideoInfo.ThumbnailPath = ThumbnailPathName;
3765 3629
                 Console.WriteLine("生成缩略图");
3766
-                //生成缩略图
3767
-                bool ThuRes = APP.FFmpeg.GenerateThumbnails(VideoSynthesisPathName, ThumbnailPathName, 200, 130);
3768
-                Thread.Sleep(500);
3630
+
3769 3631
                 Console.WriteLine("合并音视频 gridActWidth:" + gridActWidth + " gridActHeight:" + gridActHeight);
3770 3632
 
3771 3633
                 //APP.FFmpeg.VideoAudioMerge(VideoSynthesisPathName, AudioPathName, VideoSavePathName, gridActWidth, gridActHeight);
3772 3634
                 FFMpegConverter ffMpeg = new FFMpegConverter();
3773 3635
                 //ffMpeg.ConvertProgress += FfMpeg_ConvertProgress;
3774 3636
                 FFMpegInput[] input = new FFMpegInput[] {
3775
-                    new FFMpegInput(VideoSynthesisPathName),
3776
-                    new FFMpegInput(AudioPathName)
3637
+                    new FFMpegInput(TempVideoPathName),
3638
+                    new FFMpegInput(TempAudioPathName)
3777 3639
                 };
3778 3640
 
3779 3641
                 // 音视频合并
@@ -3781,9 +3643,12 @@ namespace XHWK.WKTool
3781 3643
                     input,
3782 3644
                     VideoSavePathName,
3783 3645
                     "mp4",
3784
-                    new OutputSettings(){}
3646
+                    new OutputSettings() { }
3785 3647
                 );
3786 3648
 
3649
+                //生成缩略图
3650
+                bool ThuRes = APP.FFmpeg.GenerateThumbnails(TempVideoPathName, ThumbnailPathName, 200, 130);
3651
+
3787 3652
                 VideoInfo.FileGuid = Guid.NewGuid().ToString();
3788 3653
                 VideoInfo.IsUpload = false;
3789 3654
                 VideoInfo.Uploaded = 0;
@@ -3795,6 +3660,9 @@ namespace XHWK.WKTool
3795 3660
                     APP.SaveWkData();
3796 3661
                 }
3797 3662
 
3663
+                FileToolsCommon.DeleteFile(TempVideoPathName);
3664
+                FileToolsCommon.DeleteFile(TempAudioPathName);
3665
+
3798 3666
                 Dispatcher.Invoke(() =>
3799 3667
                 {
3800 3668
                     BtnRecord.IsEnabled = true;
@@ -6092,7 +5960,7 @@ namespace XHWK.WKTool
6092 5960
         public void InitPrint()
6093 5961
         {
6094 5962
             ResizeMode = ResizeMode.NoResize;
6095
-            List<string> defaList = PrintUtils.GetLocalPrinters();
5963
+            List<string> defaList = ZPrintUtils.GetLocalPrinters();
6096 5964
             if (defaList.Count > 0)
6097 5965
             {
6098 5966
                 printlist.Columns.Add("Value");
@@ -6312,7 +6180,7 @@ namespace XHWK.WKTool
6312 6180
                         string fileName = strs[i];
6313 6181
 
6314 6182
                         //打印文件
6315
-                        PrintUtils.Print(fileName, PrinterName);
6183
+                        ZPrintUtils.Print(fileName, PrinterName);
6316 6184
                     }
6317 6185
 
6318 6186
                     Dispatcher.Invoke(() =>
@@ -6403,43 +6271,6 @@ namespace XHWK.WKTool
6403 6271
             #endregion 拓思德打印
6404 6272
         }
6405 6273
 
6406
-        /// <summary>
6407
-        /// 调用打印机打印
6408
-        /// </summary>
6409
-        /// <param name="PDFPath">PDF文件路径</param>
6410
-        /// <param name="PrinterName">打印机名称</param>
6411
-        private void Print(string PDFPath, string PrinterName, short PrinterNum = 1)
6412
-        {
6413
-            Console.WriteLine("PDFPath:" + PDFPath);
6414
-            //PDFPath = "D:/123.pdf";
6415
-            //加载PDF文档
6416
-            PdfDocument doc = new PdfDocument();
6417
-            doc.LoadFromFile(PDFPath);
6418
-
6419
-            //指定打印机
6420
-            doc.PrintSettings.PrinterName = PrinterName;
6421
-
6422
-            //静默打印PDF文档
6423
-            doc.PrintSettings.PrintController = new StandardPrintController();
6424
-
6425
-            ////设置文档打印页码范围
6426
-            //doc.PrintSettings.SelectPageRange(1, 5);
6427
-
6428
-            //打印不连续的页面
6429
-            //doc.PrintSettings.SelectSomePages(new int[] { 1, 3, 5, 7 });
6430
-
6431
-            //设置打印份数为2份
6432
-            doc.PrintSettings.Copies = PrinterNum;
6433
-
6434
-            doc.PrintSettings.PrinterResolutionKind = PdfPrinterResolutionKind.High;
6435
-            //获取原文档第一页的纸张大小,这里的单位是Point
6436
-
6437
-            doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.ActualSize, true);
6438
-            //打印PDF文档
6439
-
6440
-            doc.Print();
6441
-        }
6442
-
6443 6274
         /// <summary>
6444 6275
         /// 生成图片
6445 6276
         /// </summary>

+ 4
- 7
XHWK.WKTool/XHWK.WKTool.csproj Parādīt failu

@@ -156,12 +156,6 @@
156 156
       <SpecificVersion>False</SpecificVersion>
157 157
       <HintPath>..\DLL\Robot\RobotpenGateway.dll</HintPath>
158 158
     </Reference>
159
-    <Reference Include="Spire.License, Version=1.3.8.40, Culture=neutral, PublicKeyToken=b1144360237c8b3f, processorArchitecture=MSIL">
160
-      <HintPath>..\packages\FreeSpire.PDF.7.2.0\lib\net40\Spire.License.dll</HintPath>
161
-    </Reference>
162
-    <Reference Include="Spire.Pdf, Version=7.2.6.0, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
163
-      <HintPath>..\packages\FreeSpire.PDF.7.2.0\lib\net40\Spire.Pdf.dll</HintPath>
164
-    </Reference>
165 159
     <Reference Include="System" />
166 160
     <Reference Include="System.Configuration" />
167 161
     <Reference Include="System.Data" />
@@ -333,7 +327,10 @@
333 327
     <Compile Include="UploadWindow.xaml.cs">
334 328
       <DependentUpon>UploadWindow.xaml</DependentUpon>
335 329
     </Compile>
336
-    <Compile Include="Utils\PrintUtils.cs" />
330
+    <Compile Include="Utils\ZAsposeUtil.cs" />
331
+    <Compile Include="Utils\ZVideoRecordHelper.cs" />
332
+    <Compile Include="Utils\ZAudioRecordHelper.cs" />
333
+    <Compile Include="Utils\ZPrintUtils.cs" />
337 334
     <Compile Include="VideoClipWindow.xaml.cs">
338 335
       <DependentUpon>VideoClipWindow.xaml</DependentUpon>
339 336
     </Compile>

+ 0
- 1
XHWK.WKTool/packages.config Parādīt failu

@@ -14,7 +14,6 @@
14 14
   <package id="Aspose.Slides.NET" version="19.10.0" targetFramework="net452" />
15 15
   <package id="Aspose.Words" version="19.1.0" targetFramework="net452" />
16 16
   <package id="BouncyCastle" version="1.8.6.1" targetFramework="net452" />
17
-  <package id="FreeSpire.PDF" version="7.2.0" targetFramework="net452" />
18 17
   <package id="ICSharpCode.SharpZipLib.dll" version="0.85.4.369" targetFramework="net452" />
19 18
   <package id="iTextSharp" version="5.5.13.2" targetFramework="net452" />
20 19
   <package id="log4net" version="2.0.12" targetFramework="net452" />

+ 93
- 11
打包脚本/Inno Setup星火微课.iss Parādīt failu

@@ -3,7 +3,7 @@
3 3
 
4 4
 #define MyAppName "星火微课"  
5 5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "2.6.1"
6
+#define MyAppVersion "2.6.2"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9 9
 #define MySourcePath "D:\Project\C#\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
@@ -45,8 +45,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip
45 45
 
46 46
 [Files]
47 47
 Source: "{#MySourcePath}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
48
-Source: "{#MySourcePath}*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
49
-; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”
48
+Source: "{#MySourcePath}*"; Excludes: "ffmpeg.exe,\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
50 49
 
51 50
 [Icons]
52 51
 Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
@@ -56,28 +55,111 @@ Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Fil
56 55
 [Run]
57 56
 Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
58 57
 
59
-[Code]   
58
+[Code]  
59
+// Indicates whether the specified version and service pack of the .NET Framework is installed.
60
+//
61
+// version -- Specify one of these strings for the required .NET Framework version:
62
+//    'v1.1'          .NET Framework 1.1
63
+//    'v2.0'          .NET Framework 2.0
64
+//    'v3.0'          .NET Framework 3.0
65
+//    'v3.5'          .NET Framework 3.5
66
+//    'v4\Client'     .NET Framework 4.0 Client Profile
67
+//    'v4\Full'       .NET Framework 4.0 Full Installation
68
+//    'v4.5'          .NET Framework 4.5
69
+//    'v4.5.1'        .NET Framework 4.5.1
70
+//    'v4.5.2'        .NET Framework 4.5.2
71
+//    'v4.6'          .NET Framework 4.6
72
+//    'v4.6.1'        .NET Framework 4.6.1
73
+//    'v4.6.2'        .NET Framework 4.6.2
74
+//    'v4.7'          .NET Framework 4.7
75
+//    'v4.7.1'        .NET Framework 4.7.1
76
+//    'v4.7.2'        .NET Framework 4.7.2
77
+//    'v4.8'          .NET Framework 4.8
78
+//
79
+// service -- Specify any non-negative integer for the required service pack level:
80
+//    0               No service packs required
81
+//    1, 2, etc.      Service pack 1, 2, etc. required
82
+function IsDotNetDetected(version: string; service: cardinal): boolean;
83
+var
84
+    key, versionKey: string;
85
+    install, release, serviceCount, versionRelease: cardinal;
86
+    success: boolean;
87
+begin
88
+    versionKey := version;
89
+    versionRelease := 0;
90
+
91
+    // .NET 1.1 and 2.0 embed release number in version key
92
+    if version = 'v1.1' then begin
93
+        versionKey := 'v1.1.4322';
94
+    end
95
+    else if version = 'v2.0' then begin
96
+        versionKey := 'v2.0.50727';
97
+    end
98
+
99
+    // .NET 4.5 and newer install as update to .NET 4.0 Full
100
+    else if Pos('v4.', version) = 1 then begin
101
+        versionKey := 'v4\Full';
102
+        case version of
103
+          'v4.5':   versionRelease := 378389;
104
+          'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
105
+          'v4.5.2': versionRelease := 379893;
106
+          'v4.6':   versionRelease := 393295; // 393297 on Windows 8.1 and older
107
+          'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
108
+          'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
109
+          'v4.7':   versionRelease := 460798; // Windows 10
110
+          'v4.7.1': versionRelease := 461308; // Windows 10
111
+          'v4.7.2': versionRelease := 461808; // Windows 10
112
+          'v4.8'  : versionRelease := 528040; // Windows 10
113
+        end;
114
+    end;
115
+
116
+    // installation key group for all .NET versions
117
+    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
118
+
119
+    // .NET 3.0 uses value InstallSuccess in subkey Setup
120
+    if Pos('v3.0', version) = 1 then begin
121
+        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
122
+    end else begin
123
+        success := RegQueryDWordValue(HKLM, key, 'Install', install);
124
+    end;
125
+
126
+    // .NET 4.0 and newer use value Servicing instead of SP
127
+    if Pos('v4', version) = 1 then begin
128
+        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
129
+    end else begin
130
+        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
131
+    end;
132
+
133
+    // .NET 4.5 and newer use additional value Release
134
+    if versionRelease > 0 then begin
135
+        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
136
+        success := success and (release >= versionRelease);
137
+    end;
138
+
139
+    result := success and (install = 1) and (serviceCount >= service);
140
+end;
141
+
60 142
 function InitializeSetup: Boolean;   
61 143
 var Path:string;   
62 144
     ResultCode: Integer;   
63 145
 begin  
64
-  if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Screen Capturer Recorder_is1', 'DisplayName') then  
146
+  if  IsDotNetDetected('v4.5.2', 0) then  
65 147
   begin  
66 148
     Result := true;   
67 149
   end  
68 150
   else  
69 151
   begin  
70
-    if MsgBox('系统检测到您没有安装录制环境,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
152
+    if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
71 153
     begin  
72 154
       Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
73
-      Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/Setup%20Screen%20Capturer%20Recorder%20v0.12.10.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
74
-      MsgBox('请安装好录制环境后,再运行本安装包程序!',mbInformation,MB_OK);   
155
+      Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
156
+      MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);   
75 157
       Result := false;   
76 158
     end  
77 159
     else  
78 160
     begin  
79
-      MsgBox('取消后请手动安装录制环境!',mbInformation,MB_OK);   
80
-      Result := true;   
161
+      MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);   
162
+      Result := false;   
81 163
     end;   
82 164
   end;
83
-end;
165
+end;

Notiek ielāde…
Atcelt
Saglabāt