Browse Source

视频录制采用实时录制方式

减小安装包体积
tags/3.0.0
张剑 3 years ago
parent
commit
37269761d8
40 changed files with 368 additions and 913 deletions
  1. 3
    3
      XHWK.WKTool/App.config
  2. 0
    51
      XHWK.WKTool/Config/ZConfig.cs
  3. 44
    23
      XHWK.WKTool/CountdownWindow.xaml
  4. 3
    8
      XHWK.WKTool/CountdownWindow.xaml.cs
  5. 2
    9
      XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs
  6. BIN
      XHWK.WKTool/Extension/CheckPoint.dll
  7. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/AppVersionType.ini
  8. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OID PG.ini
  9. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPDFFileGenerator.dll
  10. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPGHelper.dll
  11. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPatternGenerator.bin
  12. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPatternGenerator.dll
  13. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPublishImageGenerator.dll
  14. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDScanConverter.dll
  15. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDTiffConvertor.dll
  16. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDVectorDiagramGenerator.dll
  17. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/PDFReader.dll
  18. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/PluginEntry.xml
  19. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/certifyforDll.dll
  20. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/libeay32.dll
  21. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/oida.bin
  22. 0
    0
      XHWK.WKTool/Extension/OIDPublishImageGenerator/ssleay32.dll
  23. BIN
      XHWK.WKTool/Extension/RbtBezier.dll
  24. BIN
      XHWK.WKTool/Extension/RobotDotMatrix.dll
  25. BIN
      XHWK.WKTool/Extension/RobotUsbWrapper.dll
  26. BIN
      XHWK.WKTool/Extension/SonixUSB.dll
  27. BIN
      XHWK.WKTool/Extension/TQLComm.dll
  28. BIN
      XHWK.WKTool/Extension/TStudyDigitalPen.dll
  29. BIN
      XHWK.WKTool/Extension/TStudyDigitalPenInter.dll
  30. BIN
      XHWK.WKTool/Extension/TStudyDigitalPenLic.dll
  31. BIN
      XHWK.WKTool/Extension/ffmpeg.exe
  32. BIN
      XHWK.WKTool/Extension/ffmpegx32.zip
  33. 133
    502
      XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs
  34. 26
    53
      XHWK.WKTool/XHWK.WKTool.csproj
  35. 5
    0
      XHWK.WKTool/packages.config
  36. 76
    23
      XHWK.WKTool/system/FFMpeg.cs
  37. 2
    0
      XHWK.WKTool/system/FileToolsCommon.cs
  38. 45
    228
      XHWK.WKTool/system/ImageHelper.cs
  39. 0
    10
      XHWK.sln
  40. 29
    3
      打包脚本/Inno Setup星火微课.iss

+ 3
- 3
XHWK.WKTool/App.config View File

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

+ 0
- 51
XHWK.WKTool/Config/ZConfig.cs View File

@@ -1,51 +0,0 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-
7
-namespace XHWK.WKTool.Config
8
-{
9
-    internal class ZConfig
10
-    {
11
-        public static bool isDebug = true;
12
-
13
-        /// <summary>
14
-        /// 当前版本号
15
-        /// </summary>
16
-        public static int versionCode = 1;
17
-
18
-        public static string versionName = "1.0.0";
19
-
20
-        //接口地址
21
-        public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : "http://schoolapi.xhkjedu.com";
22
-
23
-        //图片地址
24
-        public static string uploadUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/" : "http://schoolfile.xhkjedu.com/";
25
-
26
-        public static string showImageUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/static/" : "http://schoolfile.xhkjedu.com/static/";
27
-
28
-        public static string secretKey = "nanhuakaizhangjianwangni";
29
-        public static string fileStorageAddress = "";
30
-
31
-        //认证接口地址
32
-        public static string certapiUrl = isDebug ? "http://certapitest.xhkjedu.com" : "http://certapi.xhkjedu.com";
33
-
34
-        /// <summary>
35
-        /// 数据存放目录
36
-        /// </summary>
37
-        public static string dataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Signature\\";
38
-
39
-        public static string basePath = AppDomain.CurrentDomain.BaseDirectory;
40
-
41
-        //缓存图片地址
42
-        public static string tempPath = basePath + "temp\\";
43
-
44
-        public static string nginxHtml = $"{basePath}nginx\\html\\";
45
-
46
-   
47
-        public static string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
48
-
49
-        public static string tongPingBasePath = $"{nginxHtml}tongping\\";
50
-    }
51
-}

+ 44
- 23
XHWK.WKTool/CountdownWindow.xaml View File

@@ -1,27 +1,48 @@
1
-<Window x:Class="XHWK.WKTool.CountdownWindow"
2
-        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
-        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
-        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
-        xmlns:local="clr-namespace:XHWK.WKTool"
7
-        xmlns:gifLib="http://wpfanimatedgif.codeplex.com"
8
-        mc:Ignorable="d"
9
-        Title="CountdownWindow" Height="904.335" Width="1235.26"  AllowsTransparency="True"
1
+<Window
2
+    x:Class="XHWK.WKTool.CountdownWindow"
3
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7
+    Title="CountdownWindow"
8
+    Width="600"
9
+    Height="600"
10
+    AllowsTransparency="True"
11
+    Background="Transparent"
10 12
     ShowInTaskbar="False"
11
-        Topmost="True"
12
-    WindowStartupLocation="CenterOwner" WindowState="Maximized"
13
-    WindowStyle="None">
14
-    <Window.Background>
15
-        <SolidColorBrush Opacity="0.10" Color="#292C2E" />
16
-    </Window.Background>
13
+    Topmost="True"
14
+    WindowStartupLocation="CenterScreen"
15
+    WindowState="Normal"
16
+    WindowStyle="None"
17
+    mc:Ignorable="d">
18
+
17 19
     <Grid>
18
-        <!--<Image x:Name="ImgGif"
19
-                    Width="600"
20
-                    Height="600"
21
-                    gifLib:ImageBehavior.AnimatedSource=".\Images\countdown.gif" MediaElement.MediaEnded="Image_MediaEnded"/>-->
22
-        <Image x:Name="imgLoding"
23
-                    Source=".\Images\countdown3_1.png" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" />
24
-        <Border x:Name="borShortcut" Margin="0,450,0,0" Height="60" Width="550" Opacity="0.3"  Background="#999999"  CornerRadius="30"/>
25
-        <Label x:Name="lblShortcut" Content="开始/暂停:Ctrl+F5     停止:Ctrl+S" Height="60" Margin="0,450,0,0" Width="682" FontWeight="Bold" Foreground="#FFFFFF"   FontSize="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Visibility="Visible"/>
20
+
21
+        <Image
22
+            x:Name="imgLoding"
23
+            Width="300"
24
+            HorizontalAlignment="Center"
25
+            VerticalAlignment="Center"
26
+            Source=".\Images\countdown3_1.png" />
27
+        <Border
28
+            x:Name="borShortcut"
29
+            Width="550"
30
+            Height="60"
31
+            Margin="0,450,0,0"
32
+            Background="#999999"
33
+            CornerRadius="30"
34
+            Opacity="0.3"
35
+            Visibility="Hidden" />
36
+        <Label
37
+            x:Name="lblShortcut"
38
+            Height="60"
39
+            Margin="0,450,0,0"
40
+            HorizontalContentAlignment="Center"
41
+            VerticalContentAlignment="Center"
42
+            Content="开始/暂停:Ctrl+F5     停止:Ctrl+S"
43
+            FontSize="26"
44
+            FontWeight="Bold"
45
+            Foreground="#FFFFFF"
46
+            Visibility="Hidden" />
26 47
     </Grid>
27 48
 </Window>

+ 3
- 8
XHWK.WKTool/CountdownWindow.xaml.cs View File

@@ -22,7 +22,7 @@ namespace XHWK.WKTool
22 22
         /// 计时器
23 23
         /// </summary>
24 24
         private int ImgNum = 22;
25
-        public void Initialize(bool ShowlblShortcut = false, int changeTime = 2000)
25
+        public void Initialize(bool ShowlblShortcut = false, int changeTime = 3000)
26 26
         {
27 27
             if (ShowlblShortcut)
28 28
             {
@@ -42,7 +42,7 @@ namespace XHWK.WKTool
42 42
                 {
43 43
                     try
44 44
                     {
45
-                        if (ImgNum >= 1)
45
+                        if (ImgNum >= 0)
46 46
                         {
47 47
                             loadingImg(ImgNum);
48 48
                             ImgNum--;
@@ -66,12 +66,7 @@ namespace XHWK.WKTool
66 66
                     }
67 67
                 }
68 68
             }))).Start();
69
-            //timer = new System.Timers.Timer(changeTime/21);//设置执行一次(false)还是一直执行(true)
70
-            //timer.AutoReset = true;//设置是否执行System.Timers.Timer.Elapsed事件
71
-            //timer.Elapsed +=new System.Timers.ElapsedEventHandler(Timer_Elapsed);
72
-            ////timer.Interval = changeTime/21;
73
-            //timer.Enabled = true; //启动计时器
74
-            //ImgNum = 21;
69
+
75 70
         }
76 71
 
77 72
         private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)

+ 2
- 9
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs View File

@@ -27,18 +27,11 @@ namespace XHWK.WKTool
27 27
         {
28 28
             InitializeComponent();
29 29
             ResizeMode = ResizeMode.NoResize;
30
-            new Thread(o =>
31
-            {
32
-                if (!FileToolsCommon.IsExistDirectory(FileToolsCommon.GetFileAbsolutePath("/ffmpeg/")))
33
-                {
34
-                    //32
35
-                    ZipHelper.UnZip(FileToolsCommon.GetFileAbsolutePath("/ffmpegx32.zip"), FileToolsCommon.GetFileAbsolutePath());
36
-                }
37
-            }).Start();
30
+       
38 31
             if (!APP.CheckScreenCapturerRecorder())
39 32
             {
40 33
                 MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
41
-                APP.InstallScreenCapturerRecorder();
34
+                //APP.InstallScreenCapturerRecorder();
42 35
             }
43 36
             txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
44 37
             //APP.FFmpeg.GetMToFFmpeg();

BIN
XHWK.WKTool/Extension/CheckPoint.dll View File


XHWK.WKTool/OIDPublishImageGenerator/AppVersionType.ini → XHWK.WKTool/Extension/OIDPublishImageGenerator/AppVersionType.ini View File


XHWK.WKTool/OIDPublishImageGenerator/OID PG.ini → XHWK.WKTool/Extension/OIDPublishImageGenerator/OID PG.ini View File


XHWK.WKTool/OIDPublishImageGenerator/OIDPDFFileGenerator.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPDFFileGenerator.dll View File


XHWK.WKTool/OIDPublishImageGenerator/OIDPGHelper.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPGHelper.dll View File


XHWK.WKTool/OIDPublishImageGenerator/OIDPatternGenerator.bin → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPatternGenerator.bin View File


XHWK.WKTool/OIDPublishImageGenerator/OIDPatternGenerator.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPatternGenerator.dll View File


XHWK.WKTool/OIDPublishImageGenerator/OIDPublishImageGenerator.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDPublishImageGenerator.dll View File


XHWK.WKTool/OIDPublishImageGenerator/OIDScanConverter.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDScanConverter.dll View File


XHWK.WKTool/OIDPublishImageGenerator/OIDTiffConvertor.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDTiffConvertor.dll View File


XHWK.WKTool/OIDPublishImageGenerator/OIDVectorDiagramGenerator.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/OIDVectorDiagramGenerator.dll View File


XHWK.WKTool/OIDPublishImageGenerator/PDFReader.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/PDFReader.dll View File


XHWK.WKTool/OIDPublishImageGenerator/PluginEntry.xml → XHWK.WKTool/Extension/OIDPublishImageGenerator/PluginEntry.xml View File


XHWK.WKTool/OIDPublishImageGenerator/certifyforDll.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/certifyforDll.dll View File


XHWK.WKTool/OIDPublishImageGenerator/libeay32.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/libeay32.dll View File


XHWK.WKTool/OIDPublishImageGenerator/oida.bin → XHWK.WKTool/Extension/OIDPublishImageGenerator/oida.bin View File


XHWK.WKTool/OIDPublishImageGenerator/ssleay32.dll → XHWK.WKTool/Extension/OIDPublishImageGenerator/ssleay32.dll View File


BIN
XHWK.WKTool/Extension/RbtBezier.dll View File


BIN
XHWK.WKTool/Extension/RobotDotMatrix.dll View File


BIN
XHWK.WKTool/Extension/RobotUsbWrapper.dll View File


BIN
XHWK.WKTool/Extension/SonixUSB.dll View File


BIN
XHWK.WKTool/Extension/TQLComm.dll View File


BIN
XHWK.WKTool/Extension/TStudyDigitalPen.dll View File


BIN
XHWK.WKTool/Extension/TStudyDigitalPenInter.dll View File


BIN
XHWK.WKTool/Extension/TStudyDigitalPenLic.dll View File


BIN
XHWK.WKTool/SSCR/Setup Screen Capturer Recorder v0.12.10.exe → XHWK.WKTool/Extension/ffmpeg.exe View File


BIN
XHWK.WKTool/Extension/ffmpegx32.zip View File


+ 133
- 502
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -1,4 +1,6 @@
1
-using Aspose.Slides;
1
+using Accord.Video.FFMPEG;
2
+
3
+using Aspose.Slides;
2 4
 using Aspose.Words.Saving;
3 5
 
4 6
 using ComeCapture;
@@ -545,22 +547,7 @@ namespace XHWK.WKTool
545 547
             {
546 548
                 MessageWindow.Show("当前正在录制,请先停止录制。");
547 549
                 return;
548
-                //MessageBoxResult dr = MessageWindow.Show("当前正在录制,是否停止录制?", "提示", MessageBoxButton.OKCancel);
549
-                //if (dr == MessageBoxResult.OK)
550
-                //{
551
-                //    APP.SaveWkData();
552
-                //    APP.SaveDraw();
553
-                //    BtnStop_Click(null, null);
554
-                //    while (!IsFirstR)
555
-                //    {
556
-                //        Thread.Sleep(100);
557
-                //    }
558
-                //    System.Environment.Exit(0);
559
-                //}
560
-                //else
561
-                //{
562
-                //    return;
563
-                //}
550
+              
564 551
             }
565 552
         }
566 553
 
@@ -3196,15 +3183,7 @@ namespace XHWK.WKTool
3196 3183
 
3197 3184
         #region 变量
3198 3185
 
3199
-        /// <summary>
3200
-        /// 视频保存路径
3201
-        /// </summary>
3202
-        //string RecordingPath;
3203
-        /// <summary>
3204
-        /// 图片保存路径
3205
-        /// </summary>
3206
-        private string ImgPath;
3207
-
3186
+  
3208 3187
         /// <summary>
3209 3188
         /// 音频保存路径名
3210 3189
         /// </summary>
@@ -3230,10 +3209,7 @@ namespace XHWK.WKTool
3230 3209
         /// </summary>
3231 3210
         private bool IsFirstR = true;
3232 3211
 
3233
-        /// <summary>
3234
-        /// 图片
3235
-        /// </summary>
3236
-        private List<string> RsImgName = null;
3212
+    
3237 3213
 
3238 3214
         /// <summary>
3239 3215
         /// 是否开始截图计数
@@ -3285,36 +3261,10 @@ namespace XHWK.WKTool
3285 3261
             if (!APP.CheckScreenCapturerRecorder())
3286 3262
             {
3287 3263
                 MessageWindow.Show("使用此功能需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");
3288
-                APP.InstallScreenCapturerRecorder();
3264
+                //APP.InstallScreenCapturerRecorder();
3289 3265
                 return;
3290 3266
             }
3291 3267
 
3292
-            #region 限制只允许录制一个录屏  废弃
3293
-
3294
-            //string RecordScreenPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
3295
-            //if (FileToolsCommon.IsExistFile(RecordScreenPathName))
3296
-            //{
3297
-            //    MessageBoxResult dr = MessageWindow.Show("已存在录屏,是否覆盖?", "提示", MessageBoxButton.OKCancel);
3298
-            //    if (dr == MessageBoxResult.OK)
3299
-            //    {
3300
-            //        try
3301
-            //        {
3302
-            //            FileToolsCommon.DeleteFile(RecordScreenPathName);
3303
-            //            APP.VideoList.RemoveAll(x => x.VideoPath == RecordScreenPathName);
3304
-            //        }
3305
-            //        catch (Exception ex)
3306
-            //        {
3307
-            //            LogHelper.WriteErrLog("【录屏】(BtnRecordingScreen_Click)无法移除视频," + ex.Message, ex);
3308
-            //        }
3309
-            //    }
3310
-            //    else
3311
-            //    {
3312
-            //        return;
3313
-            //    }
3314
-            //}
3315
-
3316
-            #endregion 限制只允许录制一个录屏  废弃
3317
-
3318 3268
             k_hook.Stop();
3319 3269
             if (APP.W_ScreenRecordingToolbarWindow == null)
3320 3270
             {
@@ -3392,7 +3342,7 @@ namespace XHWK.WKTool
3392 3342
                 IsPressButton = true;
3393 3343
                 new Thread(new ThreadStart(new Action(() =>
3394 3344
                 {
3395
-                    Thread.Sleep(500);
3345
+                    Thread.Sleep(3000);
3396 3346
                     IsPressButton = false;
3397 3347
                 }))).Start();
3398 3348
             }
@@ -3403,7 +3353,7 @@ namespace XHWK.WKTool
3403 3353
             if (!APP.CheckScreenCapturerRecorder())
3404 3354
             {
3405 3355
                 MessageWindow.Show("使用此功能需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");
3406
-                APP.InstallScreenCapturerRecorder();
3356
+                //APP.InstallScreenCapturerRecorder();
3407 3357
                 return;
3408 3358
             }
3409 3359
             if (APP.PageContextData.currpage > 0)
@@ -3443,7 +3393,6 @@ namespace XHWK.WKTool
3443 3393
                 if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
3444 3394
                 {
3445 3395
                     APP.FFmpeg.StopRecordAudio(2);
3446
-                    //Thread.Sleep(500);
3447 3396
                     //麦克风
3448 3397
                     if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
3449 3398
                     {
@@ -3527,12 +3476,7 @@ namespace XHWK.WKTool
3527 3476
             }
3528 3477
         }
3529 3478
 
3530
-        /// <summary>
3531
-        /// 设置录屏文件地址
3532
-        /// </summary>
3533
-        private void SetUpVideoPathName()
3534
-        {
3535
-        }
3479
+        private VideoFileWriter videoWriter = new VideoFileWriter();//视频写入
3536 3480
 
3537 3481
         /// <summary>
3538 3482
         /// 开始录制和暂停录制
@@ -3552,14 +3496,15 @@ namespace XHWK.WKTool
3552 3496
                         WkType = Enum_WKVidetype.RecordingLessons
3553 3497
                     };
3554 3498
 
3555
-                    ImgPath = APP.WKData.WkPath + "temp/Image/";
3499
+                 
3556 3500
                     AudioPathName = APP.WKData.WkPath + "temp/audio/";
3557 3501
                     FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
3558 3502
                     FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
3559
-                    FileToolsCommon.CreateDirectory(ImgPath);
3503
+   
3560 3504
                     FileToolsCommon.CreateDirectory(AudioPathName);
3561 3505
                     AudioPathName += APP.WKData.WkName + ".MP3";
3562 3506
                     VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制." + VideoInfo.VideoType.ToString();
3507
+  
3563 3508
                     VideoSynthesisPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn." + VideoInfo.VideoType.ToString();
3564 3509
                     int num = 1;
3565 3510
                     while (FileToolsCommon.IsExistFile(VideoSavePathName))
@@ -3568,6 +3513,22 @@ namespace XHWK.WKTool
3568 3513
                         VideoSynthesisPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn_" + num + "." + VideoInfo.VideoType.ToString();
3569 3514
                         num++;
3570 3515
                     }
3516
+                    int RsW = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f) / 2) * 2;
3517
+                    int RsH = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f) / 2) * 2;
3518
+
3519
+                    Console.WriteLine("RsW:"+ RsW+ " RsH:"+ RsH);
3520
+
3521
+                    lock (this)
3522
+                    {
3523
+                        videoWriter.Open(
3524
+                            VideoSynthesisPathName,
3525
+                            RsW,
3526
+                            RsH,
3527
+                            5,
3528
+                            VideoCodec.MPEG4,
3529
+                            RsW * RsH * 10
3530
+                        );
3531
+                    }
3571 3532
 
3572 3533
                     #region 禁用按钮
3573 3534
 
@@ -3606,12 +3567,10 @@ namespace XHWK.WKTool
3606 3567
                         {
3607 3568
                             APP.W_CountdownWindow = new CountdownWindow();
3608 3569
                             APP.W_CountdownWindow.Initialize();
3609
-                            //APP.W_CountdownWindow.Topmost = true;
3610 3570
                         }
3611 3571
                         else
3612 3572
                         {
3613 3573
                             APP.W_CountdownWindow.Initialize();
3614
-                            //APP.W_CountdownWindow.Topmost = true;
3615 3574
                         }
3616 3575
                         APP.W_CountdownWindow.Show();
3617 3576
                     });
@@ -3619,15 +3578,12 @@ namespace XHWK.WKTool
3619 3578
                     #endregion 录像倒计时
3620 3579
 
3621 3580
                     IsFirstR = false;
3622
-                    RsImgName = new List<string>();
3581
+                
3623 3582
                     SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
3624 3583
                     ///启动截图
3625 3584
                     timer = new System.Threading.Timer(new TimerCallback(Timer_Elapsed), null, 0, 20);
3626 3585
                 }
3627 3586
 
3628
-                //继续录制
3629
-                //IsSuspendR = false;
3630
-                //BtnRecording.Content = "暂停录制";
3631 3587
                 Dispatcher.Invoke(() =>
3632 3588
                 {
3633 3589
                     TxbType.Text = "准备录制";
@@ -3652,8 +3608,7 @@ namespace XHWK.WKTool
3652 3608
                         }
3653 3609
                         Recorddt = DateTime.Now;
3654 3610
                         IsStartCount = true;
3655
-                        //Stack();
3656
-                        //timer.Start();
3611
+                     
3657 3612
                     });
3658 3613
                 }
3659 3614
                 catch (Exception ex)
@@ -3664,15 +3619,13 @@ namespace XHWK.WKTool
3664 3619
             else if (Type == 2)
3665 3620
             {
3666 3621
                 //暂停
3667
-                //IsSuspendR = true;
3668 3622
                 Dispatcher.Invoke(() =>
3669 3623
                 {
3670 3624
                     TxbType.Text = "暂停中";
3671 3625
                     BtnRecord.Visibility = Visibility.Visible;
3672 3626
                     BtnRecordSuspend.Visibility = Visibility.Collapsed;
3673 3627
                 });
3674
-                //TimeOut();
3675
-
3628
+          
3676 3629
                 #region 2秒内不可点击
3677 3630
 
3678 3631
                 //new Thread(new ThreadStart(new Action(() =>
@@ -3695,14 +3648,13 @@ namespace XHWK.WKTool
3695 3648
                 try
3696 3649
                 {
3697 3650
                     APP.FFmpeg.SuspendFFmpeg();
3698
-                    //new Thread(new ThreadStart(new Action(() =>
3699
-                    //{
3651
+             
3700 3652
                     while (APP.FFmpeg.myProcess != null)
3701 3653
                     {
3702 3654
                         Thread.Sleep(100);
3703 3655
                     }
3704 3656
                     IsStartCount = false;
3705
-                    //}))).Start();
3657
+          
3706 3658
                 }
3707 3659
                 catch (Exception ex)
3708 3660
                 {
@@ -3714,264 +3666,7 @@ namespace XHWK.WKTool
3714 3666
             }
3715 3667
         }
3716 3668
 
3717
-        /// <summary>
3718
-        /// 开始录制和暂停录制
3719
-        /// </summary>
3720
-        private void StartRecordOld(int Type)
3721
-        {
3722
-            if (Type == 1)
3723
-            {
3724
-                if (IsFirstR)//是否第一次录制  初始化录制
3725
-                {
3726
-                    #region 检测麦克风扬声器是否可用
3727
-
3728
-                    string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
3729
-                    FileToolsCommon.CreateDirectory(AudioPath);
3730
-                    string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
3731
-                    string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
3732
-                    try
3733
-                    {
3734
-                        FileToolsCommon.DeleteFile(audioSpeakerPath);
3735
-                        FileToolsCommon.DeleteFile(audioMicrophonePath);
3736
-                    }
3737
-                    catch (Exception)
3738
-                    {
3739
-                    }
3740
-                    //扬声器
3741
-                    if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
3742
-                    {
3743
-                        APP.FFmpeg.StopRecordAudio(2);
3744
-                        //Thread.Sleep(500);
3745
-                        //麦克风
3746
-                        if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
3747
-                        {
3748
-                        }
3749
-                        else
3750
-                        {
3751
-                            //无法录制麦克风
3752
-                            MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
3753
-                            if (Res == MessageBoxResult.Cancel)
3754
-                            {
3755
-                                return;
3756
-                            }
3757
-                        }
3758
-                        APP.FFmpeg.StopRecordAudio(1);
3759
-                    }
3760
-                    else
3761
-                    {
3762
-                        //无法录制扬声器音频
3763
-                        MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制音频,是否继续?", "消息提示", MessageBoxButton.OKCancel);
3764
-                        if (Res == MessageBoxResult.Cancel)
3765
-                        {
3766
-                            return;
3767
-                        }
3768
-                    }
3769
-
3770
-                    #endregion 检测麦克风扬声器是否可用
3771
-
3772
-                    //电子版切换笔模式
3773
-                    deviceHand();
3774
-                    //TxbTime.Visibility = Visibility.Visible;
3775
-                    //ImgLZImg.Visibility = Visibility.Visible;
3776
-
3777
-                    VideoInfo = new Model_Video
3778
-                    {
3779
-                        VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType")),
3780
-                        WkType = Enum_WKVidetype.RecordingLessons
3781
-                    };
3782
-
3783
-                    ImgPath = APP.WKData.WkPath + "temp/Image/";
3784
-                    AudioPathName = APP.WKData.WkPath + "temp/audio/";
3785
-                    FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
3786
-                    FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
3787
-                    FileToolsCommon.CreateDirectory(ImgPath);
3788
-                    FileToolsCommon.CreateDirectory(AudioPathName);
3789
-                    AudioPathName += APP.WKData.WkName + ".MP3";
3790
-                    VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制." + VideoInfo.VideoType.ToString();
3791
-                    VideoSynthesisPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn." + VideoInfo.VideoType.ToString();
3792
-                    int num = 1;
3793
-                    while (FileToolsCommon.IsExistFile(VideoSavePathName))
3794
-                    {
3795
-                        VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制_" + num + "." + VideoInfo.VideoType.ToString();
3796
-                        VideoSynthesisPathName = APP.WKData.WkPath + APP.WKData.WkName + "_录制Syn_" + num + "." + VideoInfo.VideoType.ToString();
3797
-                        num++;
3798
-                    }
3799
-
3800
-                    #region 禁用按钮
3801
-
3802
-                    BtnPrint.IsEnabled = false;
3803
-                    BtnScreenshot.IsEnabled = false;
3804
-                    BtnImport.IsEnabled = false;
3805
-                    BtnScreenRecording.IsEnabled = false;
3806
-                    BtnUpload.IsEnabled = false;
3807
-                    BtnSetUp.IsEnabled = false;
3808
-                    BtnDevice.IsEnabled = false;
3809
-                    BtnLoginType.IsEnabled = false;
3810
-                    blackboard_canvas.Visibility = Visibility.Visible;//zxyceshi
3811
-
3812
-                    //myblackboard = new BlackboardNew(blackboard_canvas);
3813
-                    //DataContext = APP.pageData;
3814
-                    //drawingAttributes = new DrawingAttributes();
3815
-                    ////将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
3816
-                    ////InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
3817
-                    //blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
3818
-                    //blackboard_canvas.UseCustomCursor = true;
3819
-                    //drawingAttributes.FitToCurve = true;
3820
-                    //drawingAttributes.IgnorePressure = false;
3821
-                    //drawingAttributes.Width = PenSize;
3822
-                    //drawingAttributes.Height = PenSize;
3823
-                    //drawingAttributes.Color = Color;
3824
-                    //blackboard_canvas.Cursor = System.Windows.Input.Cursors.Pen;
3825
-
3826
-                    #endregion 禁用按钮
3827
-
3828
-                    #region 设置录制大小
3829
-
3830
-                    //gridActWidth = (int)GridMain.ActualWidth==0?1276: (int)GridMain.ActualWidth;
3831
-                    //gridActHeight = (int)GridMain.ActualHeight==0?898: (int)GridMain.ActualHeight;
3832
-                    gridActWidth = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f));
3833
-                    gridActHeight = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f));
3834
-                    gridActWidth = gridActWidth % 2 > 0 ? gridActWidth - 1 : gridActWidth;
3835
-                    gridActHeight = gridActHeight % 2 > 0 ? gridActHeight - 1 : gridActHeight;
3836
-
3837
-                    #endregion 设置录制大小
3838
-
3839
-                    #region 录像倒计时
3840
-
3841
-                    if (APP.W_CountdownWindow == null)
3842
-                    {
3843
-                        APP.W_CountdownWindow = new CountdownWindow();
3844
-                        APP.W_CountdownWindow.Initialize();
3845
-                        //APP.W_CountdownWindow.Topmost = true;
3846
-                    }
3847
-                    else
3848
-                    {
3849
-                        APP.W_CountdownWindow.Initialize();
3850
-                        //APP.W_CountdownWindow.Topmost = true;
3851
-                    }
3852
-                    APP.W_CountdownWindow.Show();
3853
-
3854
-                    #endregion 录像倒计时
3855
-
3856
-                    IsFirstR = false;
3857
-                    RsImgName = new List<string>();
3858
-                    SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
3859
-                    //TxbTime.Visibility = Visibility.Visible;
3860
-                    //ImgLZImg.Visibility = Visibility.Visible;
3861
-                    ///启动截图
3862
-                    timer = new System.Threading.Timer(new TimerCallback(Timer_Elapsed), null, 0, 20);
3863
-                    //{
3864
-                    //    AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
3865
-                    //};//设置执行一次(false)还是一直执行(true)
3866
-                    //timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
3867
-                    //timer.Enabled = true; //启动计时器
3868
-                }
3869
-
3870
-                //继续录制
3871
-                //IsSuspendR = false;
3872
-                //BtnRecording.Content = "暂停录制";
3873
-                TxbType.Text = "准备录制";
3874
-                BtnRecord.Visibility = Visibility.Collapsed;
3875
-                BtnRecordSuspend.Visibility = Visibility.Visible;
3876
-
3877
-                #region 4秒内不可点击
3878
-
3879
-                //new Thread(new ThreadStart(new Action(() =>
3880
-                //{
3881
-                //    Dispatcher.Invoke(() =>
3882
-                //    {
3883
-                //        BtnRecord.IsEnabled = false;
3884
-                //        btnStop.IsEnabled = false;
3885
-                //        ImgStop.Visibility = Visibility.Visible;
3886
-                //        ImgStopTwo.Visibility = Visibility.Collapsed;
3887
-                //    });
3888
-                //}))).Start();
3889
-                new Thread(new ThreadStart(new Action(() =>
3890
-                {
3891
-                    //Thread.Sleep(4000);
3892
-                    Dispatcher.Invoke(() =>
3893
-                    {
3894
-                        BtnRecord.IsEnabled = true;
3895
-                        BtnStop.IsEnabled = true;
3896
-                    });
3897
-                }))).Start();
3898
-
3899
-                #endregion 4秒内不可点击
3900
-
3901
-                try
3902
-                {
3903
-                    new Thread(new ThreadStart(new Action(() =>
3904
-                    {
3905
-                        Thread.Sleep(1000);
3906
-                        bool IsRecordingSound = FileToolsCommon.GetConfigValue("IsRecordingSound") == "1";
3907
-                        bool IsRecordingMicrophone = FileToolsCommon.GetConfigValue("IsRecordingMicrophone") == "1";
3908
-                        IsRecordAudio = APP.FFmpeg.StartRecordingAudio(AudioPathName, out string ErrMessage, IsRecordingSound, IsRecordingMicrophone, APP.MicrophoneName);
3909
-                        Thread.Sleep(1000);
3910
-                        Dispatcher.Invoke(() =>
3911
-                        {
3912
-                            TxbType.Text = "正在录制";
3913
-                            if (!IsRecordAudio)
3914
-                            {
3915
-                                MessageWindow.Show(ErrMessage);
3916
-                            }
3917
-                            Recorddt = DateTime.Now;
3918
-                            IsStartCount = true;
3919
-                            //Stack();
3920
-                            //timer.Start();
3921
-                        });
3922
-                    }))).Start();
3923
-                }
3924
-                catch (Exception ex)
3925
-                {
3926
-                    MessageWindow.Show(ex.Message);
3927
-                }
3928
-            }
3929
-            else if (Type == 2)
3930
-            {
3931
-                //暂停
3932
-                //IsSuspendR = true;
3933
-                TxbType.Text = "暂停中";
3934
-                BtnRecord.Visibility = Visibility.Visible;
3935
-                BtnRecordSuspend.Visibility = Visibility.Collapsed;
3936
-                //TimeOut();
3937
-
3938
-                #region 2秒内不可点击
3939
-
3940
-                new Thread(new ThreadStart(new Action(() =>
3941
-                {
3942
-                    Dispatcher.Invoke(() =>
3943
-                    {
3944
-                        BtnRecord.IsEnabled = false;
3945
-                        BtnStop.IsEnabled = false;
3946
-                    });
3947
-                    Thread.Sleep(2000);
3948
-                    Dispatcher.Invoke(() =>
3949
-                    {
3950
-                        BtnRecord.IsEnabled = true;
3951
-                        BtnStop.IsEnabled = true;
3952
-                    });
3953
-                }))).Start();
3954
-
3955
-                #endregion 2秒内不可点击
3956
-
3957
-                try
3958
-                {
3959
-                    APP.FFmpeg.SuspendFFmpeg();
3960
-                    new Thread(new ThreadStart(new Action(() =>
3961
-                    {
3962
-                        while (APP.FFmpeg.myProcess != null)
3963
-                        {
3964
-                            Thread.Sleep(100);
3965
-                        }
3966
-                        IsStartCount = false;
3967
-                    }))).Start();
3968
-                }
3969
-                catch (Exception ex)
3970
-                {
3971
-                    MessageWindow.Show(ex.Message);
3972
-                }
3973
-            }
3974
-        }
3669
+      
3975 3670
 
3976 3671
         /// <summary>
3977 3672
         /// 记录上次截图时间
@@ -3989,12 +3684,13 @@ namespace XHWK.WKTool
3989 3684
                 DateTime dt = DateTime.Now;
3990 3685
                 TimeSpan ts = dt.Subtract(Recorddt);//时间差
3991 3686
                 double tsmi = ts.TotalMilliseconds;
3992
-                if (tsmi > 200.0)
3687
+                if (tsmi >= 200.0)
3993 3688
                 {
3994 3689
                     Recorddt = Recorddt.AddMilliseconds(200);
3995
-                    Thread thread = new Thread(RecordSaveImage);
3996
-                    //开启线程
3997
-                    thread.Start();
3690
+                  
3691
+                    ThreadPool.QueueUserWorkItem(o=> {
3692
+                        RecordSaveImage();
3693
+                    });
3998 3694
                 }
3999 3695
             }
4000 3696
         }
@@ -4008,28 +3704,22 @@ namespace XHWK.WKTool
4008 3704
             {
4009 3705
                 if (IsStartCount)
4010 3706
                 {
4011
-                    string FilePathName = ImgPath + RsImgName.Count + ".png";
4012
-                    RsImgName.Add(FilePathName);
4013
-
3707
+      
4014 3708
                     #region 设置大小
4015 3709
 
4016
-                    double RsW = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f));
4017
-                    double RsH = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f));
4018
-                    if (RsW > 1266)
4019
-                    {
4020
-                        double Proportion = RsH / RsW;
4021
-                        RsW = 1266;
4022
-                        RsH = RsW * Proportion;
4023
-                        RsH = ((int)RsH) % 2 > 0 ? (int)RsH - 1 : (int)RsH;
4024
-                        //RsH = 898;
4025
-                    }
4026
-
3710
+                    int RsW = (int)(GridMain.ActualWidth * (PrimaryScreen.DpiX / 96f) / 2)*2;
3711
+                    int RsH = (int)(GridMain.ActualHeight * (PrimaryScreen.DpiY / 96f) / 2) *2;
3712
+                
4027 3713
                     #endregion 设置大小
4028 3714
 
4029 3715
                     Dispatcher.Invoke(() =>
4030 3716
                     {
4031 3717
                         //保存图片
4032
-                        ImageHelper.SaveUI2(GridMain, FilePathName, gridActWidth, gridActHeight, (int)RsW, (int)RsH);
3718
+ 
3719
+                        Bitmap bm = ImageHelper.SaveUI2Bitmap(GridMain, RsW, RsH);
3720
+
3721
+                        videoWriter.WriteVideoFrame(bm);
3722
+                        bm.Dispose();
4033 3723
 
4034 3724
                         SRTime = SRTime.AddMilliseconds(200);
4035 3725
 
@@ -4095,163 +3785,104 @@ namespace XHWK.WKTool
4095 3785
 
4096 3786
                     #endregion 清空画板数据
4097 3787
 
4098
-                    //根据录制时间长度确定是否保存
4099
-                    if (SRTime.Hour > 0 || SRTime.Minute > 0 || SRTime.Second > 3)
3788
+                    Dispatcher.Invoke(() =>
4100 3789
                     {
4101
-                        #region 2秒内不可点击
3790
+                        BtnRecord.IsEnabled = false;
3791
+                        BtnStop.IsEnabled = false;
3792
+                        BtnScreenRecording.IsEnabled = false;
3793
+                    });
4102 3794
 
4103
-                        Dispatcher.Invoke(() =>
4104
-                        {
4105
-                            BtnRecord.IsEnabled = false;
4106
-                            BtnStop.IsEnabled = false;
4107
-                            BtnScreenRecording.IsEnabled = false;
4108
-                        });
3795
+                    //缩略图
3796
+                    string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
3797
+                    FileToolsCommon.CreateDirectory(ThumbnailPath);
3798
+                    //缩略图存储位置
3799
+                    string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
3800
+                    try
3801
+                    {
3802
+                        APP.FFmpeg.StopFFmpeg(AudioPathName);
3803
+                    }
3804
+                    catch (Exception ex)
3805
+                    {
3806
+                        LogHelper.WriteErrLog("【录制停止】:录音生成失败," + ex.Message, ex);
3807
+                    }
3808
+                    IsStartCount = false;
3809
+                    //停止截图
3810
+                    while (APP.FFmpeg.myProcess != null)
3811
+                    {
3812
+                        Thread.Sleep(100);
3813
+                    }
3814
+                    Dispatcher.Invoke(() =>
3815
+                    {
3816
+                        timer.Change(-1, 0);
3817
+                        timer.Dispose();
4109 3818
 
4110
-                        #endregion 2秒内不可点击
3819
+                        videoWriter.Close();
4111 3820
 
4112
-                        //缩略图
4113
-                        string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
4114
-                        FileToolsCommon.CreateDirectory(ThumbnailPath);
4115
-                        //缩略图存储位置
4116
-                        string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
4117
-                        try
4118
-                        {
4119
-                            APP.FFmpeg.StopFFmpeg(AudioPathName);
4120
-                        }
4121
-                        catch (Exception ex)
4122
-                        {
4123
-                            LogHelper.WriteErrLog("【录制停止】:合并音频你文件失败," + ex.Message, ex);
4124
-                        }
4125
-                        IsStartCount = false;
4126
-                        //停止截图
4127
-                        while (APP.FFmpeg.myProcess != null)
4128
-                        {
4129
-                            Thread.Sleep(100);
4130
-                        }
4131
-                        Dispatcher.Invoke(() =>
4132
-                        {
4133
-                            timer.Change(-1, 0);
4134
-                            timer.Dispose();
4135
-                            //End();
4136
-                            TxbTime.Text = "00:00";
4137
-                            //TxbTime.Visibility = Visibility.Hidden;
4138
-                            //ImgLZImg.Visibility = Visibility.Hidden;
4139
-                            //TxbType.Visibility = Visibility.Visible;
4140
-                            TxbType.Text = "保存中";
4141
-                        });
4142
-                        //new Thread(new ThreadStart(new Action(() =>
4143
-                        //{
4144
-                        //判断音频是否存在 判断音频临时文件夹是否存在
4145
-                        if (IsRecordAudio)
4146
-                        {
4147
-                            if (!FileToolsCommon.IsExistFile(AudioPathName))
4148
-                            {
4149
-                                Thread.Sleep(100);
4150
-                            }
4151
-                            if (FileToolsCommon.IsExistDirectory(FileToolsCommon.GetDirectoryName(AudioPathName) + "temp/"))
4152
-                            {
4153
-                                Thread.Sleep(100);
4154
-                            }
4155
-                        }
4156
-                        else
4157
-                        {
4158
-                            //没有录制音频
4159
-                            AudioPathName = null;
4160
-                        }
4161
-                        //合成视频
4162
-                        bool SynRes = APP.FFmpeg.SynthesisVideo(ImgPath, AudioPathName, VideoSynthesisPathName, 5, gridActWidth, gridActHeight, out string ErrMessage);
4163
-                        //}))).Start();
4164
-                        //new Thread(new ThreadStart(new Action(() =>
4165
-                        //{
4166
-                        if (!SynRes)
4167
-                        {
4168
-                            Dispatcher.Invoke(() =>
4169
-                            {
4170
-                                MessageWindow.Show("录制失败," + ErrMessage);
4171
-                                BtnRecord.IsEnabled = true;
4172
-                                BtnStop.IsEnabled = false;
4173
-                                BtnPrint.IsEnabled = false;
4174
-                                BtnScreenRecording.IsEnabled = true;
4175
-                                TxbType.Text = "准备就绪";
4176
-                                BtnRecord.Visibility = Visibility.Visible;
4177
-                                BtnRecordSuspend.Visibility = Visibility.Collapsed;
4178
-                            });
4179
-                            return;
4180
-                        }
4181
-                        Dispatcher.Invoke(() =>
4182
-                        {
4183
-                            TxbType.Text = "转码中";
4184
-                        });
4185
-                        while (!FileToolsCommon.IsExistFile(VideoSynthesisPathName))
3821
+                        TxbTime.Text = "00:00";
3822
+
3823
+                        TxbType.Text = "保存中";
3824
+                    });
3825
+
3826
+                    //判断音频是否存在 判断音频临时文件夹是否存在
3827
+                    if (IsRecordAudio)
3828
+                    {
3829
+                        if (!FileToolsCommon.IsExistFile(AudioPathName))
4186 3830
                         {
4187 3831
                             Thread.Sleep(100);
4188 3832
                         }
4189
-                        while (FileToolsCommon.IsExistDirectory(FileToolsCommon.GetDirectoryName(VideoSynthesisPathName) + "temp/"))
3833
+                        if (FileToolsCommon.IsExistDirectory(FileToolsCommon.GetDirectoryName(AudioPathName) + "temp/"))
4190 3834
                         {
4191 3835
                             Thread.Sleep(100);
4192 3836
                         }
4193
-                        FileToolsCommon.DeleteFile(ThumbnailPathName);
4194
-                        VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
4195
-                        Thread.Sleep(500);
4196
-                        //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
4197
-                        VideoInfo.VideoPath = VideoSavePathName;
4198
-                        VideoInfo.ThumbnailPath = ThumbnailPathName;
4199
-                        //生成缩略图
4200
-                        bool ThuRes = APP.FFmpeg.GenerateThumbnails(VideoSynthesisPathName, ThumbnailPathName, 200, 130);
4201
-                        Thread.Sleep(500);
4202
-
4203
-                        APP.FFmpeg.VideoTranscode(VideoSynthesisPathName, VideoSavePathName, gridActWidth, gridActHeight);
4204
-                        VideoInfo.FileGuid = Guid.NewGuid().ToString();
4205
-                        VideoInfo.IsUpload = false;
4206
-                        VideoInfo.Uploaded = 0;
4207
-                        //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
4208
-                        if (!APP.VideoList.Exists(x => x.FileGuid == VideoInfo.FileGuid) || !APP.VideoList.Exists(x => x.VideoPath == VideoInfo.VideoPath))
4209
-                        {
4210
-                            APP.VideoList.Add(VideoInfo);
4211
-                            //保存数据
4212
-                            APP.SaveWkData();
4213
-                        }
4214
-                        IsFirstR = true;
4215
-                        Dispatcher.Invoke(() =>
4216
-                        {
4217
-                            BtnRecord.IsEnabled = true;
4218
-                            BtnStop.IsEnabled = false;
4219
-                            BtnPrint.IsEnabled = false;
4220
-                            BtnScreenRecording.IsEnabled = true;
4221
-                            TxbType.Text = "准备就绪";
4222
-                            BtnRecord.Visibility = Visibility.Visible;
4223
-                            BtnRecordSuspend.Visibility = Visibility.Collapsed;
4224
-                        });
4225 3837
                     }
4226 3838
                     else
4227 3839
                     {
4228
-                        APP.FFmpeg.SuspendFFmpeg();
4229
-                        IsStartCount = false;
4230
-                        timer.Change(-1, 0);
4231
-                        timer.Dispose();
4232
-                        IsFirstR = true;
4233
-                        IsStartCount = false;
4234
-                        //停止截图
4235
-                        while (APP.FFmpeg.myProcess != null)
4236
-                        {
4237
-                            Thread.Sleep(100);
4238
-                        }
4239
-                        Dispatcher.Invoke(() =>
4240
-                        {
4241
-                            BtnRecord.IsEnabled = true;
4242
-                            BtnStop.IsEnabled = false;
4243
-                            BtnPrint.IsEnabled = false;
4244
-                            BtnScreenRecording.IsEnabled = true;
4245
-                            MessageWindow.Show("录制时间过短,请重新录制!");
4246
-                            TxbType.Text = "准备就绪";
4247
-                            BtnRecord.Visibility = Visibility.Visible;
4248
-                            BtnRecordSuspend.Visibility = Visibility.Collapsed;
4249
-                            TxbTime.Text = "00:00";
4250
-                            //TxbTime.Visibility = Visibility.Hidden;
4251
-                            //ImgLZImg.Visibility = Visibility.Hidden;
4252
-                        });
3840
+                        //没有录制音频
3841
+                        AudioPathName = null;
4253 3842
                     }
4254
-                    //List<Model_Video> VideoList
3843
+                    //合成视频
3844
+                    Dispatcher.Invoke(() =>
3845
+                    {
3846
+                        TxbType.Text = "转码中";
3847
+                    });
3848
+
3849
+                    while (!FileToolsCommon.IsExistFile(VideoSynthesisPathName))
3850
+                    {
3851
+                        Thread.Sleep(100);
3852
+                    }
3853
+
3854
+                    FileToolsCommon.DeleteFile(ThumbnailPathName);
3855
+                    VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
3856
+                    VideoInfo.VideoPath = VideoSavePathName;
3857
+                    VideoInfo.ThumbnailPath = ThumbnailPathName;
3858
+                    Console.WriteLine("生成缩略图");
3859
+                    //生成缩略图
3860
+                    bool ThuRes = APP.FFmpeg.GenerateThumbnails(VideoSynthesisPathName, ThumbnailPathName, 200, 130);
3861
+                    Thread.Sleep(500);
3862
+                    Console.WriteLine("合并音视频 gridActWidth:"+ gridActWidth+ " gridActHeight:"+ gridActHeight);
3863
+
3864
+                    APP.FFmpeg.VideoAudioMerge(VideoSynthesisPathName, AudioPathName, VideoSavePathName, gridActWidth, gridActHeight);
3865
+                    VideoInfo.FileGuid = Guid.NewGuid().ToString();
3866
+                    VideoInfo.IsUpload = false;
3867
+                    VideoInfo.Uploaded = 0;
3868
+       
3869
+                    if (!APP.VideoList.Exists(x => x.FileGuid == VideoInfo.FileGuid) || !APP.VideoList.Exists(x => x.VideoPath == VideoInfo.VideoPath))
3870
+                    {
3871
+                        APP.VideoList.Add(VideoInfo);
3872
+                        //保存数据
3873
+                        APP.SaveWkData();
3874
+                    }
3875
+                    IsFirstR = true;
3876
+                    Dispatcher.Invoke(() =>
3877
+                    {
3878
+                        BtnRecord.IsEnabled = true;
3879
+                        BtnStop.IsEnabled = false;
3880
+                        BtnPrint.IsEnabled = false;
3881
+                        BtnScreenRecording.IsEnabled = true;
3882
+                        TxbType.Text = "准备就绪";
3883
+                        BtnRecord.Visibility = Visibility.Visible;
3884
+                        BtnRecordSuspend.Visibility = Visibility.Collapsed;
3885
+                    });
4255 3886
                 }
4256 3887
                 catch (Exception ex)
4257 3888
                 {

+ 26
- 53
XHWK.WKTool/XHWK.WKTool.csproj View File

@@ -30,6 +30,8 @@
30 30
     <UseApplicationTrust>false</UseApplicationTrust>
31 31
     <BootstrapperEnabled>true</BootstrapperEnabled>
32 32
     <TargetFrameworkProfile />
33
+    <NuGetPackageImportStamp>
34
+    </NuGetPackageImportStamp>
33 35
   </PropertyGroup>
34 36
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
35 37
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -84,6 +86,18 @@
84 86
     <ErrorReport>prompt</ErrorReport>
85 87
   </PropertyGroup>
86 88
   <ItemGroup>
89
+    <Reference Include="Accord, Version=3.8.0.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
90
+      <HintPath>..\packages\Accord.3.8.0\lib\net45\Accord.dll</HintPath>
91
+    </Reference>
92
+    <Reference Include="Accord.Video, Version=3.8.0.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
93
+      <HintPath>..\packages\Accord.Video.3.8.0\lib\net45\Accord.Video.dll</HintPath>
94
+    </Reference>
95
+    <Reference Include="Accord.Video.DirectShow, Version=3.8.0.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
96
+      <HintPath>..\packages\Accord.Video.DirectShow.3.8.0\lib\net45\Accord.Video.DirectShow.dll</HintPath>
97
+    </Reference>
98
+    <Reference Include="Accord.Video.FFMPEG, Version=3.8.0.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=x86">
99
+      <HintPath>..\packages\Accord.Video.FFMPEG.3.8.0\lib\net45\Accord.Video.FFMPEG.dll</HintPath>
100
+    </Reference>
87 101
     <Reference Include="AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb, processorArchitecture=MSIL">
88 102
       <HintPath>..\packages\AForge.2.2.5\lib\AForge.dll</HintPath>
89 103
     </Reference>
@@ -123,6 +137,9 @@
123 137
     <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
124 138
       <HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
125 139
     </Reference>
140
+    <Reference Include="NAudio, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
141
+      <HintPath>..\packages\NAudio.1.9.0\lib\net35\NAudio.dll</HintPath>
142
+    </Reference>
126 143
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
127 144
       <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
128 145
     </Reference>
@@ -439,18 +456,6 @@
439 456
     <EmbeddedResource Include="LatticeXML\S0_O000_B0000_P000-255.tmx">
440 457
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
441 458
     </EmbeddedResource>
442
-    <None Include="OIDPublishImageGenerator\AppVersionType.ini">
443
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
444
-    </None>
445
-    <None Include="OIDPublishImageGenerator\OID PG.ini">
446
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
447
-    </None>
448
-    <None Include="OIDPublishImageGenerator\oida.bin">
449
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
450
-    </None>
451
-    <None Include="OIDPublishImageGenerator\OIDPatternGenerator.bin">
452
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
453
-    </None>
454 459
     <None Include="packages.config" />
455 460
     <None Include="Properties\app.manifest" />
456 461
     <None Include="Properties\Settings.settings">
@@ -618,11 +623,6 @@
618 623
       <Install>false</Install>
619 624
     </BootstrapperPackage>
620 625
   </ItemGroup>
621
-  <ItemGroup>
622
-    <EmbeddedResource Include="SSCR\Setup Screen Capturer Recorder v0.12.10.exe">
623
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
624
-    </EmbeddedResource>
625
-  </ItemGroup>
626 626
   <ItemGroup>
627 627
     <Resource Include="Images\Clip_Clip.png" />
628 628
     <Resource Include="Images\Clip_Pause.png" />
@@ -714,42 +714,6 @@
714 714
     </EmbeddedResource>
715 715
   </ItemGroup>
716 716
   <ItemGroup>
717
-    <Content Include="OIDPublishImageGenerator\certifyforDll.dll">
718
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
719
-    </Content>
720
-    <Content Include="OIDPublishImageGenerator\libeay32.dll">
721
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
722
-    </Content>
723
-    <Content Include="OIDPublishImageGenerator\OIDPatternGenerator.dll">
724
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
725
-    </Content>
726
-    <Content Include="OIDPublishImageGenerator\OIDPDFFileGenerator.dll">
727
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
728
-    </Content>
729
-    <Content Include="OIDPublishImageGenerator\OIDPGHelper.dll">
730
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
731
-    </Content>
732
-    <Content Include="OIDPublishImageGenerator\OIDPublishImageGenerator.dll">
733
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
734
-    </Content>
735
-    <Content Include="OIDPublishImageGenerator\OIDScanConverter.dll">
736
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
737
-    </Content>
738
-    <Content Include="OIDPublishImageGenerator\OIDTiffConvertor.dll">
739
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
740
-    </Content>
741
-    <Content Include="OIDPublishImageGenerator\OIDVectorDiagramGenerator.dll">
742
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
743
-    </Content>
744
-    <Content Include="OIDPublishImageGenerator\PDFReader.dll">
745
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
746
-    </Content>
747
-    <Content Include="OIDPublishImageGenerator\PluginEntry.xml">
748
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
749
-    </Content>
750
-    <Content Include="OIDPublishImageGenerator\ssleay32.dll">
751
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
752
-    </Content>
753 717
     <Resource Include="SkinImages\Other\Dev_AcousticWave1.gif" />
754 718
     <Resource Include="SkinImages\Other\Dev_AcousticWave2.gif" />
755 719
     <Resource Include="SkinImages\SR\SR_Out.png" />
@@ -880,4 +844,13 @@
880 844
 xcopy /Y /i $(ProjectDir)\256.ico $(TargetDir)\
881 845
 </PreBuildEvent>
882 846
   </PropertyGroup>
847
+  <Import Project="..\packages\Accord.3.8.0\build\Accord.targets" Condition="Exists('..\packages\Accord.3.8.0\build\Accord.targets')" />
848
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
849
+    <PropertyGroup>
850
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
851
+    </PropertyGroup>
852
+    <Error Condition="!Exists('..\packages\Accord.3.8.0\build\Accord.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Accord.3.8.0\build\Accord.targets'))" />
853
+    <Error Condition="!Exists('..\packages\Accord.Video.FFMPEG.3.8.0\build\Accord.Video.FFMPEG.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Accord.Video.FFMPEG.3.8.0\build\Accord.Video.FFMPEG.targets'))" />
854
+  </Target>
855
+  <Import Project="..\packages\Accord.Video.FFMPEG.3.8.0\build\Accord.Video.FFMPEG.targets" Condition="Exists('..\packages\Accord.Video.FFMPEG.3.8.0\build\Accord.Video.FFMPEG.targets')" />
883 856
 </Project>

+ 5
- 0
XHWK.WKTool/packages.config View File

@@ -1,5 +1,9 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <packages>
3
+  <package id="Accord" version="3.8.0" targetFramework="net452" />
4
+  <package id="Accord.Video" version="3.8.0" targetFramework="net452" />
5
+  <package id="Accord.Video.DirectShow" version="3.8.0" targetFramework="net452" />
6
+  <package id="Accord.Video.FFMPEG" version="3.8.0" targetFramework="net452" />
3 7
   <package id="AForge" version="2.2.5" targetFramework="net452" />
4 8
   <package id="AForge.Controls" version="2.2.5" targetFramework="net452" />
5 9
   <package id="AForge.Imaging" version="2.2.5" targetFramework="net452" />
@@ -14,6 +18,7 @@
14 18
   <package id="ICSharpCode.SharpZipLib.dll" version="0.85.4.369" targetFramework="net452" />
15 19
   <package id="iTextSharp" version="5.5.13.2" targetFramework="net452" />
16 20
   <package id="log4net" version="2.0.12" targetFramework="net452" />
21
+  <package id="NAudio" version="1.9.0" targetFramework="net452" />
17 22
   <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
18 23
   <package id="System.Management" version="4.7.0" targetFramework="net452" />
19 24
   <package id="VisioForge.DotNet.Core.TRIAL" version="12.0.56" targetFramework="net452" />

+ 76
- 23
XHWK.WKTool/system/FFMpeg.cs View File

@@ -43,6 +43,8 @@ namespace Common.system
43 43
         /// </summary>
44 44
         private bool IsRecordMicrophone = true;
45 45
 
46
+        private string ffmpegPath = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg.exe");
47
+
46 48
         #endregion 变量
47 49
 
48 50
         /// <summary>
@@ -126,7 +128,7 @@ namespace Common.system
126 128
 
127 129
             #endregion 检测麦克风扬声器
128 130
 
129
-            myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
131
+            myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
130 132
             string SpeakerStr = "";
131 133
             string MicrophoneStr = "";
132 134
             if (IsRecordSpeaker && RecordingSound)
@@ -275,7 +277,7 @@ namespace Common.system
275 277
 
276 278
             myProcess = new Process();
277 279
             LogPath = CreateffmpegLog();
278
-            myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
280
+            myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
279 281
             if (IsRecordSpeaker && IsRecordMicrophone && RecordingSound && RecordingMicrophone)
280 282
             {
281 283
                 myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\" -f dshow -i audio=\"" +
@@ -455,7 +457,7 @@ namespace Common.system
455 457
 
456 458
                 #endregion 判断音频是否存在
457 459
 
458
-                myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
460
+                myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
459 461
                 switch (Extension.ToUpper())
460 462
                 {
461 463
                     case ".MP4":
@@ -566,13 +568,6 @@ namespace Common.system
566 568
         /// <param name="FilePath">存储路径</param>
567 569
         public void MergeVideoOrAudio(object FilePathobj)
568 570
         {
569
-            //new Thread(new ThreadStart(new Action(() =>
570
-            //{
571
-            //Dispatcher.Invoke(() =>
572
-            //{
573
-            //});
574
-            //}))).Start();
575
-
576 571
             while (myProcess != null)
577 572
             {
578 573
                 Thread.Sleep(100);
@@ -609,7 +604,7 @@ namespace Common.system
609 604
 
610 605
             myProcess = new Process();
611 606
             LogPath = CreateffmpegLog();
612
-            myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
607
+            myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
613 608
             if (Extension.ToUpper() == ".MP3")
614 609
             {
615 610
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temp/filelist.d -c copy " + FilePath;
@@ -672,18 +667,11 @@ namespace Common.system
672 667
         /// <param name="SaveFilePath">保存文件路径</param>
673 668
         public void ClipVideo(string VideoFilePath, string StartTime, string EndTime, string SaveFilePath)
674 669
         {
675
-            //new Thread(new ThreadStart(new Action(() =>
676
-            //{
677
-            //Dispatcher.Invoke(() =>
678
-            //{
679
-            //});
680
-            //}))).Start();
681
-
682 670
             while (myProcess != null)
683 671
             {
684 672
                 Thread.Sleep(100);
685 673
             }
686
-            //string Path = FileToolsCommon.GetDirectoryName(VideoFilePath);
674
+
687 675
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
688 676
             foreach (var KillProcess in KillProcessArray)
689 677
             {
@@ -691,7 +679,7 @@ namespace Common.system
691 679
             }
692 680
             myProcess = new Process();
693 681
             LogPath = CreateffmpegLog();
694
-            this.myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
682
+            this.myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
695 683
             //ffmpeg -ss 开始时间 -to 结束时间 -accurate_seek -i mp4输入路径 -c:v libx264 -c:a aac -strict experimental -vf scale = 宽:高 -b 500k 输出路径.mp4
696 684
             myProcess.StartInfo.Arguments = "-i " + VideoFilePath + " -vcodec copy -acodec copy -ss " + StartTime + " -to " + EndTime + " " + SaveFilePath; //-filter:a "volume=0.5"
697 685
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
@@ -812,7 +800,7 @@ namespace Common.system
812 800
             {
813 801
                 myProcess = new Process();
814 802
                 LogPath = CreateffmpegLog();
815
-                myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
803
+                myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
816 804
                                                                                                                  //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
817 805
                 myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2" + WHStr + " -f image2 \"" + ImagePath + "\"";
818 806
 
@@ -883,7 +871,7 @@ namespace Common.system
883 871
             {
884 872
                 myProcess = new Process();
885 873
                 LogPath = CreateffmpegLog();
886
-                myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
874
+                myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
887 875
                 myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
888 876
 
889 877
                 if (OutputVideoLog)
@@ -932,6 +920,71 @@ namespace Common.system
932 920
             }
933 921
         }
934 922
 
923
+
924
+        public bool VideoAudioMerge(string VideoPathName, string mp3path,string VideoSavePathName, int Width, int Height)
925
+        {
926
+            while (myProcess != null)
927
+            {
928
+                Thread.Sleep(100);
929
+            }
930
+            Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
931
+            foreach (Process KillProcess in KillProcessArray)
932
+            {
933
+                KillProcess.Kill();
934
+            }
935
+            try
936
+            {
937
+                myProcess = new Process();
938
+                LogPath = CreateffmpegLog();
939
+                myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
940
+                myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -i " + mp3path + " -acodec copy -vcodec libx264 " + "-s " + Width + "*" + Height + " " + VideoSavePathName;
941
+
942
+                if (OutputVideoLog)
943
+                {
944
+                    LogHelper.WriteInfoLog("【视频转码】:" + myProcess.StartInfo.Arguments);
945
+                }
946
+
947
+                FileToolsCommon.AppendText(LogPath, "【视频转码】:" + myProcess.StartInfo.Arguments + "\r\n");
948
+                myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
949
+                myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
950
+                myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
951
+                myProcess.StartInfo.RedirectStandardInput = true;      //用于模拟该进程控制台的输入
952
+                                                                       //外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
953
+                myProcess.ErrorDataReceived += new DataReceivedEventHandler(Output);
954
+                myProcess.Start();                 //启动线程
955
+                myProcess.BeginErrorReadLine();    //开始异步读取
956
+                myProcess.WaitForExit();           //阻塞等待进程结束
957
+                myProcess.Close();                 //关闭进程
958
+                myProcess.Dispose();               //释放资源
959
+
960
+                #region 进程是否已经释放
961
+
962
+                bool IsRunning = true;
963
+                while (IsRunning)
964
+                {
965
+                    IsRunning = false;
966
+                    Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
967
+                    foreach (Process KillProcess in ProcessArray)
968
+                    {
969
+                        IsRunning = true;
970
+                        Thread.Sleep(100);
971
+                    }
972
+                }
973
+
974
+                #endregion 进程是否已经释放
975
+
976
+                myProcess = null;
977
+                Thread.Sleep(200);
978
+                FileToolsCommon.DeleteFile(VideoPathName);
979
+                return true;
980
+            }
981
+            catch (Exception ex)
982
+            {
983
+                LogHelper.WriteErrLog("【视频转码】(VideoTranscode)视频转码失败," + ex.Message, ex);
984
+                return false;
985
+            }
986
+        }
987
+
935 988
         /// <summary>
936 989
         /// 创建日志文件
937 990
         /// </summary>
@@ -1065,7 +1118,7 @@ namespace Common.system
1065 1118
                     }
1066 1119
                     myProcess = new Process();
1067 1120
                     LogPath = CreateffmpegLog();
1068
-                    myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
1121
+                    myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
1069 1122
                     myProcess.StartInfo.Arguments = " -list_devices true -f dshow -i dummy";
1070 1123
                     if (OutputVideoLog)
1071 1124
                     {

+ 2
- 0
XHWK.WKTool/system/FileToolsCommon.cs View File

@@ -965,12 +965,14 @@ namespace Common.system
965 965
                 Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.ReadKey);
966 966
             foreach (string subKeyName in uninstallNode.GetSubKeyNames())
967 967
             {
968
+                Console.WriteLine(" subKeyName:" + subKeyName);
968 969
                 Microsoft.Win32.RegistryKey subKey = uninstallNode.OpenSubKey(subKeyName);
969 970
                 object displayName = subKey.GetValue("DisplayName");
970 971
                 if (displayName != null)
971 972
                 {
972 973
                     if (displayName.ToString().Contains(softWareName))
973 974
                     {
975
+                        Console.WriteLine(uninstallNode.Name+" subKeyName:" + subKeyName);
974 976
                         return true;
975 977
                         // MessageWindow.Show(displayName.ToString());  
976 978
                     }

+ 45
- 228
XHWK.WKTool/system/ImageHelper.cs View File

@@ -402,87 +402,49 @@ namespace Common.system
402 402
         /// </summary>
403 403
         /// <param name="ui">需要截图的UI控件</param>
404 404
         /// <param name="filePathName">图片保存地址 命名 1.png</param>
405
-        /// <param name="width">图片宽</param>
406
-        /// <param name="height">图片高</param>
407 405
         /// <param name="ImgWidth">转换后高</param>
408 406
         /// <param name="ImgHeight">转换后高</param>
409
-        public static void SaveUI(FrameworkElement ui, string filePathName, int width, int height, int ImgWidth, int ImgHeight)
407
+        public static void SaveUI(FrameworkElement ui, string filePathName, int ImgWidth, int ImgHeight)
410 408
         {
411 409
             Console.WriteLine("截图的路径为:" + filePathName);
412 410
             try
413 411
             {
414
-                //在位图中呈现UI元素
415
-                RenderTargetBitmap bmp = new RenderTargetBitmap(width, height, PrimaryScreen.DpiX, PrimaryScreen.DpiY, PixelFormats.Pbgra32);
412
+                RenderTargetBitmap bmp = new RenderTargetBitmap(
413
+                       (int)ui.ActualWidth,
414
+                       (int)ui.ActualHeight,
415
+                       1 / 96, 1 / 96,
416
+                       PixelFormats.Default
417
+                   );
416 418
                 bmp.Render(ui);
417
-
418
-                //定义切割矩形
419
-                var cut = new Int32Rect(0, 0, width, height);
420
-                //计算Stride
421
-                var stride = bmp.Format.BitsPerPixel * cut.Width / 8;
422
-                //声明字节数组
423
-                byte[] data = new byte[cut.Height * stride];
424
-
425
-                //调用CopyPixels
426
-                bmp.CopyPixels(cut, data, stride, 0);
427
-                new Thread(new ThreadStart(new Action(() =>
419
+                BitmapEncoder encoder = new PngBitmapEncoder();
420
+                encoder.Frames.Add(BitmapFrame.Create(bmp));
421
+                if (ImgWidth > 0)
428 422
                 {
429
-                    BitmapSource bitmapSource = BitmapSource.Create(width, height, PrimaryScreen.DpiX, PrimaryScreen.DpiY, PixelFormats.Bgr32, null, data, stride);
430
-
431
-                    BitmapEncoder encoder = new PngBitmapEncoder();
432
-                    encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
433
-                    if (ImgWidth > 0)
434
-                    {
435
-                        Bitmap Img = new Bitmap(ImgWidth, ImgHeight);
436
-                        try
437
-                        {
438
-                            MemoryStream memoryStream = new MemoryStream();
439
-                            encoder.Save(memoryStream);
440
-                            Bitmap bit = new Bitmap(memoryStream, true);
441
-                            if (ImgWidth - 2 < bit.Width)
442
-                            {
443
-                                try
444
-                                {
445
-                                    Graphics g = Graphics.FromImage(Img);
446
-                                    g.DrawImage(bit, new Rectangle(0, 0, ImgWidth, ImgHeight), new Rectangle(0, 0, bit.Width, bit.Height), GraphicsUnit.Pixel);
447
-                                    g.Dispose();
448
-                                }
449
-                                catch
450
-                                {
451
-                                    Img = bit;
452
-                                }
453
-                            }
454
-                            else
455
-                            {
456
-                                Img = bit;
457
-                            }
458
-                            Img.Save(filePathName);
459
-                            memoryStream.Dispose();
460
-                            Img.Dispose();
461
-                            bit.Dispose();
462
-                        }
463
-                        catch (Exception)
464
-                        {
465
-                            using (var stream = new FileStream(filePathName, FileMode.Create))
466
-                            {
467
-                                encoder.Save(stream);
468
-                            }
469
-                        }
470
-                    }
471
-                    else
423
+                    MemoryStream memoryStream = new MemoryStream();
424
+                    encoder.Save(memoryStream);
425
+                    Bitmap bit = new Bitmap(memoryStream, true);
426
+                    Bitmap Img = new Bitmap(bit, ImgWidth, ImgHeight);
427
+                    Img.Save(filePathName);
428
+                    Img.Dispose();
429
+                    bit.Dispose();
430
+                    memoryStream.Dispose();
431
+                }
432
+                else
433
+                {
434
+                    using (var stream = new FileStream(filePathName, FileMode.Create))
472 435
                     {
473
-                        using (var stream = new FileStream(filePathName, FileMode.Create))
474
-                        {
475
-                            encoder.Save(stream);
476
-                        }
436
+                        encoder.Save(stream);
477 437
                     }
478
-                }))).Start();
438
+                }
439
+                
479 440
             }
480
-            catch (Exception)
441
+            catch (Exception e)
481 442
             {
443
+                Console.WriteLine(e.Message);
482 444
             }
483 445
         }
484 446
 
485
-        public static void SaveUI2(FrameworkElement frameworkElement, string filePathName, int width, int height, int ImgWidth, int ImgHeight)
447
+        public static void SaveUI2(FrameworkElement frameworkElement, string filePathName)
486 448
         {
487 449
             System.IO.FileStream fs = new System.IO.FileStream(filePathName, System.IO.FileMode.Create);
488 450
             RenderTargetBitmap bmp = new RenderTargetBitmap((int)frameworkElement.ActualWidth, (int)frameworkElement.ActualHeight, 1 / 96, 1 / 96, PixelFormats.Default);
@@ -493,156 +455,24 @@ namespace Common.system
493 455
             fs.Close();
494 456
         }
495 457
 
496
-        /// <summary>
497
-        /// 保存图片
498
-        /// </summary>
499
-        /// <param name="ui">需要截图的UI控件</param>
500
-        /// <param name="filePathName">图片保存地址 命名 1.png</param>
501
-        /// <param name="width">窗口宽</param>
502
-        /// <param name="height">窗口高</param>
503
-        /// <param name="ImgWidth">图片高</param>
504
-        /// <param name="ImgHeight">图片高</param>
505
-        public static void SaveUIToImage(FrameworkElement ui, string filePathName, int width, int height, int ImgWidth, int ImgHeight)
458
+        public static Bitmap SaveUI2Bitmap(FrameworkElement frameworkElement, int width, int height)
506 459
         {
507
-            try
508
-            {
509
-                //在位图中呈现UI元素
510
-                RenderTargetBitmap bmp = new RenderTargetBitmap(width, height, PrimaryScreen.DpiX, PrimaryScreen.DpiY, PixelFormats.Pbgra32);
511
-                bmp.Render(ui);
512
-                BitmapEncoder encoder = new PngBitmapEncoder();
513
-                encoder.Frames.Add(BitmapFrame.Create(bmp));
514
-                if (ImgWidth > 0)
515
-                {
516
-                    Bitmap Img = new Bitmap(ImgWidth, ImgHeight);
517
-                    try
518
-                    {
519
-                        MemoryStream memoryStream = new MemoryStream();
520
-                        encoder.Save(memoryStream);
521
-                        new Thread(new ThreadStart(new Action(() =>
522
-                        {
523
-                            //System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);
524
-                            Bitmap bit = new Bitmap(memoryStream);
525
-                            if (ImgWidth - 2 < bit.Width)
526
-                            {
527
-                                try
528
-                                {
529
-                                    Graphics g = Graphics.FromImage(Img);
530
-                                    //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
531
-                                    g.DrawImage(bit, new Rectangle(0, 0, ImgWidth, ImgHeight), new Rectangle(0, 0, bit.Width, bit.Height), GraphicsUnit.Pixel);
532
-                                    g.Dispose();
533
-                                }
534
-                                catch
535
-                                {
536
-                                    Img = bit;
537
-                                }
538
-                            }
539
-                            else
540
-                            {
541
-                                Img = bit;
542
-                            }
543
-                            Img.Save(filePathName);
544
-
545
-                            memoryStream.Dispose();
546
-                            Img.Dispose();
547
-                            bit.Dispose();
548
-                        }))).Start();
549
-                    }
550
-                    catch (Exception)
551
-                    {
552
-                    }
553
-                }
554
-                else
555
-                {
556
-                    System.IO.FileStream fs = new System.IO.FileStream(filePathName, System.IO.FileMode.Create);
557
-                    encoder.Save(fs);
558
-                    fs.Close();
559
-                }
560
-            }
561
-            catch (Exception ex)
562
-            {
563
-                LogHelper.WriteErrLog("【UI生成图片】(SaveUIToImage)" + ex.Message, ex);
564
-                //Console.WriteLine(ex.Message);
565
-            }
566
-        }
567
-
568
-        public static void SaveImage(object model)
569
-        {
570
-            try
571
-            {
572
-                SaveModel saveModel = (SaveModel)model;
573
-                int ImgWidth = saveModel.ImgWidth;
574
-                int ImgHeight = saveModel.ImgHeight;
575
-                //BitmapEncoder encoder = saveModel.encoder;
576
-                RenderTargetBitmap bmp = saveModel.bmp;
577
-                BitmapEncoder encoder = new PngBitmapEncoder();
578
-                encoder.Frames.Add(BitmapFrame.Create(bmp));
579
-                string filePathName = saveModel.filePathName;
580
-                if (ImgWidth > 0)
581
-                {
582
-                    Bitmap Img = new Bitmap(ImgWidth, ImgHeight);
583
-                    try
584
-                    {
585
-                        MemoryStream memoryStream = new MemoryStream();
586
-                        encoder.Save(memoryStream);
587
-                        new Thread(new ThreadStart(new Action(() =>
588
-                        {
589
-                            //System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);
590
-                            Bitmap bit = new Bitmap(memoryStream);
591
-                            if (ImgWidth - 2 < bit.Width)
592
-                            {
593
-                                try
594
-                                {
595
-                                    Graphics g = Graphics.FromImage(Img);
596
-                                    //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
597
-                                    g.DrawImage(bit, new Rectangle(0, 0, ImgWidth, ImgHeight), new Rectangle(0, 0, bit.Width, bit.Height), GraphicsUnit.Pixel);
598
-                                    g.Dispose();
599
-                                }
600
-                                catch
601
-                                {
602
-                                    Img = bit;
603
-                                }
604
-                            }
605
-                            else
606
-                            {
607
-                                Img = bit;
608
-                            }
609
-                            Img.Save(filePathName);
610
-                            //Bitmap bitmap = CutImageWhitePart(Img);
611
-                            //FileToolsCommon.DeleteFile(filePathName);
612
-                            //bitmap.Save(filePathName);
613
-                            //bitmap.Dispose();
614
-                            memoryStream.Dispose();
615
-                            Img.Dispose();
616
-                            bit.Dispose();
617
-                        }))).Start();
618
-                    }
619
-                    catch (Exception)
620
-                    {
621
-                    }
622
-                }
623
-                else
624
-                {
625
-                    //SaveImageModel sim = new SaveImageModel();
626
-                    //sim.encoder = new PngBitmapEncoder();
627
-                    //sim.encoder = new PngBitmapEncoder();
628
-                    //BitmapFrame test= encoder.Frames[0];
629
-                    //sim.encoder.Frames.Add(BitmapFrame.Create(test));
630
-                    ////sim.encoder.Frames[0].CopyTo(encoder.Frames[0]);
631
-                    ////sim.encoder.CopyTo(encoder);
632
-                    ////encoder.CopyTo(sim.encoder);
633
-                    //sim.FilePath = filePathName;
634
-                    ////sim.bmp = new RenderTargetBitmap(width, height, PrimaryScreen.DpiX, PrimaryScreen.DpiY, PixelFormats.Pbgra32);
635
-                    ////bmp.CopyTo(sim.bmp);
636
-                    //Thread t1 = new Thread(SaveImage);
637
-                    //t1.Start(sim);
638
-
639
-                    System.IO.FileStream fs = new System.IO.FileStream(filePathName, System.IO.FileMode.Create);
640
-                    encoder.Save(fs);
641
-                    fs.Close();
642
-                }
643
-            }
644
-            catch (Exception)
645
-            {
460
+            using (MemoryStream outStream = new MemoryStream())
461
+            {
462
+                RenderTargetBitmap bmp = new RenderTargetBitmap(
463
+                        (int)frameworkElement.ActualWidth,
464
+                        (int)frameworkElement.ActualHeight,
465
+                        1 / 96, 
466
+                        1 / 96,
467
+                        PixelFormats.Default
468
+                    );
469
+                bmp.Render(frameworkElement);
470
+                BitmapEncoder enc = new PngBitmapEncoder();
471
+                enc.Frames.Add(BitmapFrame.Create(bmp));
472
+                enc.Save(outStream);
473
+              
474
+                System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);
475
+                return new Bitmap(bitmap, width, height);
646 476
             }
647 477
         }
648 478
 
@@ -721,19 +551,6 @@ namespace Common.system
721 551
             return bmp;
722 552
         }
723 553
 
724
-        private static void SaveImage1(object obj)
725
-        {
726
-            SaveImageModel sim = (SaveImageModel)obj;
727
-            //RenderTargetBitmap bmp = sim.bmp;
728
-            //BitmapEncoder encoder = new PngBitmapEncoder();
729
-            //encoder.Frames.Add(BitmapFrame.Create(bmp));
730
-            BitmapEncoder encoder = sim.encoder;
731
-            string filePathName = sim.FilePath;
732
-            System.IO.FileStream fs = new System.IO.FileStream(filePathName, System.IO.FileMode.Create);
733
-            encoder.Save(fs);
734
-            fs.Close();
735
-        }
736
-
737 554
         #endregion 截屏指定UI控件
738 555
 
739 556
         #region 去掉白边

+ 0
- 10
XHWK.sln View File

@@ -9,26 +9,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XHWK.WKTool", "XHWK.WKTool\
9 9
 EndProject
10 10
 Global
11 11
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
12
-		Debug|Any CPU = Debug|Any CPU
13 12
 		Debug|x86 = Debug|x86
14
-		Release|Any CPU = Release|Any CPU
15 13
 		Release|x86 = Release|x86
16 14
 	EndGlobalSection
17 15
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
18
-		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19
-		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 16
 		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Debug|x86.ActiveCfg = Debug|x86
21 17
 		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Debug|x86.Build.0 = Debug|x86
22
-		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Release|Any CPU.ActiveCfg = Release|Any CPU
23
-		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Release|Any CPU.Build.0 = Release|Any CPU
24 18
 		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Release|x86.ActiveCfg = Release|x86
25 19
 		{445A4527-849B-4FA9-AA97-8ED1098D211E}.Release|x86.Build.0 = Release|x86
26
-		{57591E23-644E-416D-B1CA-BB04C550130F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27
-		{57591E23-644E-416D-B1CA-BB04C550130F}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 20
 		{57591E23-644E-416D-B1CA-BB04C550130F}.Debug|x86.ActiveCfg = Debug|x86
29 21
 		{57591E23-644E-416D-B1CA-BB04C550130F}.Debug|x86.Build.0 = Debug|x86
30
-		{57591E23-644E-416D-B1CA-BB04C550130F}.Release|Any CPU.ActiveCfg = Release|Any CPU
31
-		{57591E23-644E-416D-B1CA-BB04C550130F}.Release|Any CPU.Build.0 = Release|Any CPU
32 22
 		{57591E23-644E-416D-B1CA-BB04C550130F}.Release|x86.ActiveCfg = Release|x86
33 23
 		{57591E23-644E-416D-B1CA-BB04C550130F}.Release|x86.Build.0 = Release|x86
34 24
 	EndGlobalSection

+ 29
- 3
打包脚本/Inno Setup星火微课.iss View File

@@ -3,10 +3,10 @@
3 3
 
4 4
 #define MyAppName "星火微课"  
5 5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "2.6.0"
6
+#define MyAppVersion "2.6.1"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9
-#define MySourcePath "D:\Project\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
9
+#define MySourcePath "D:\Project\C#\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
10 10
 #define MyAppExeName "星火微课.exe"
11 11
 #define MyIcoName "256.ico"
12 12
 #define MyTargetPath "D:\程序打包\星火微课\"
@@ -54,4 +54,30 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
54 54
 Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
55 55
 
56 56
 [Run]
57
-Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
57
+Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
58
+
59
+[Code]   
60
+function InitializeSetup: Boolean;   
61
+var Path:string;   
62
+    ResultCode: Integer;   
63
+begin  
64
+  if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Screen Capturer Recorder_is1', 'DisplayName') then  
65
+  begin  
66
+    Result := true;   
67
+  end  
68
+  else  
69
+  begin  
70
+    if MsgBox('系统检测到您没有安装录制环境,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
71
+    begin  
72
+      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);   
75
+      Result := false;   
76
+    end  
77
+    else  
78
+    begin  
79
+      MsgBox('取消后请手动安装录制环境!',mbInformation,MB_OK);   
80
+      Result := true;   
81
+    end;   
82
+  end;
83
+end;

Loading…
Cancel
Save