Parcourir la source

冲突

tags/录制修改前
zhangxueyang il y a 4 ans
Parent
révision
7067cd02eb

+ 3
- 6
Common/Model/DownloadInfoModel.cs Voir le fichier

@@ -1,7 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
1
+using System.Collections.Generic;
5 2
 
6 3
 namespace Common.Model
7 4
 {
@@ -91,14 +88,14 @@ namespace Common.Model
91 88
         /// </summary>
92 89
         public List<string> downloadUrlList
93 90
         {
94
-            get {return _downloadUrlList;}
91
+            get { return _downloadUrlList; }
95 92
 
96 93
             set
97 94
             {
98 95
                 List<string> UTF8ValueList = new List<string>();
99 96
                 foreach (string val in value)
100 97
                 {
101
-                    string path = val.Substring(0, val.LastIndexOf("/")+1);
98
+                    string path = val.Substring(0, val.LastIndexOf("/") + 1);
102 99
                     string name = val.Substring(val.LastIndexOf("/") + 1);
103 100
                     string UTF8Name = System.Web.HttpUtility.UrlEncode(name);
104 101
                     string UTF8Url = path + UTF8Name;

+ 0
- 1
Common/Properties/AssemblyInfo.cs Voir le fichier

@@ -1,5 +1,4 @@
1 1
 using System.Reflection;
2
-using System.Runtime.CompilerServices;
3 2
 using System.Runtime.InteropServices;
4 3
 
5 4
 // 有关程序集的一般信息由以下

+ 4
- 6
Common/system/CLeopardZip.cs Voir le fichier

@@ -1,11 +1,9 @@
1
-using System;
1
+using ICSharpCode.SharpZipLib.Checksums;
2
+using ICSharpCode.SharpZipLib.Zip;
3
+
4
+using System;
2 5
 using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5 6
 using System.IO;
6
-using ICSharpCode.SharpZipLib;
7
-using ICSharpCode.SharpZipLib.Zip;
8
-using ICSharpCode.SharpZipLib.Checksums;
9 7
 
10 8
 namespace Common.system
11 9
 {

+ 5
- 5
Common/system/CameraHelper.cs Voir le fichier

@@ -1,10 +1,10 @@
1
-using System;
2
-using System.Windows;
3
-using System.IO;
1
+using AForge.Controls;
2
+using AForge.Video.DirectShow;
3
+
4
+using System;
4 5
 using System.Drawing;
5 6
 using System.Drawing.Imaging;
6
-using AForge.Video.DirectShow;
7
-using AForge.Controls;
7
+using System.IO;
8 8
 
9 9
 
10 10
 namespace Common.system

+ 1
- 6
Common/system/DataConvertCommon.cs Voir le fichier

@@ -1,9 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-
6
-namespace Common.system
1
+namespace Common.system
7 2
 {
8 3
     /// <summary>
9 4
     /// 数据转换帮助类

+ 2
- 2
Common/system/DownloadManager.cs Voir le fichier

@@ -1,9 +1,9 @@
1 1
 using Common.Model;
2
+
2 3
 using System;
3 4
 using System.Collections.Generic;
4 5
 using System.IO;
5 6
 using System.Linq;
6
-using System.Text;
7 7
 using System.Threading;
8 8
 
9 9
 namespace Common.system
@@ -110,7 +110,7 @@ namespace Common.system
110 110
                             }
111 111
                             catch (Exception)//无法获取文件名时  使用传入保存名称
112 112
                             {
113
-                                dlInfo.fileName = dlInfo.saveFileName; 
113
+                                dlInfo.fileName = dlInfo.saveFileName;
114 114
                             }
115 115
 
116 116
                             //默认给流总数

+ 1
- 3
Common/system/DownloadService.cs Voir le fichier

@@ -1,10 +1,8 @@
1 1
 using Common.Model;
2
+
2 3
 using System;
3
-using System.Collections.Generic;
4 4
 using System.IO;
5
-using System.Linq;
6 5
 using System.Net;
7
-using System.Text;
8 6
 
9 7
 namespace Common.system
10 8
 {

+ 3
- 6
Common/system/FFMpeg.cs Voir le fichier

@@ -1,9 +1,6 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using System.Diagnostics;
4
-using System.IO;
5
-using System.Linq;
6
-using System.Text;
7 4
 using System.Threading;
8 5
 
9 6
 using VisioForge.Shared.NAudio.CoreAudioApi;
@@ -96,7 +93,7 @@ namespace Common.system
96 93
         /// 录制音频
97 94
         /// </summary>
98 95
         /// <param name="Mp3Path">MP3音频位置</param>
99
-        private void StartRecordingAudio(string Mp3Path)
96
+        public void StartRecordingAudio(string Mp3Path)
100 97
         {
101 98
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
102 99
             Debug.WriteLine(KillProcessArray.Length.ToString());
@@ -168,7 +165,7 @@ namespace Common.system
168 165
         /// <param name="Frequency">每秒帧率</param>
169 166
         /// <param name="VideoWidth">视频宽度</param>
170 167
         /// <param name="VideoHeight">视频高度</param>
171
-        private void SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight)
168
+        public void SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight)
172 169
         {
173 170
             Thread thread = new Thread(delegate ()
174 171
             {
@@ -296,7 +293,7 @@ namespace Common.system
296 293
         /// </summary>
297 294
         /// <param name="VideoPath">视频地址</param>
298 295
         /// <param name="ImagePath">图片地址</param>
299
-        void GenerateThumbnails(string VideoPath, string ImagePath)
296
+        public void GenerateThumbnails(string VideoPath, string ImagePath)
300 297
         {
301 298
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
302 299
             Debug.WriteLine(KillProcessArray.Length.ToString());

+ 62
- 6
Common/system/FileToolsCommon.cs Voir le fichier

@@ -1,9 +1,8 @@
1 1
 using System;
2
-using System.Collections.Generic;
3 2
 using System.Configuration;
4 3
 using System.IO;
5
-using System.Linq;
6 4
 using System.Text;
5
+using System.Text.RegularExpressions;
7 6
 using System.Windows.Forms;
8 7
 
9 8
 namespace Common.system
@@ -15,6 +14,8 @@ namespace Common.system
15 14
     /// </summary>
16 15
     public static class FileToolsCommon
17 16
     {
17
+        #region 获取文件的绝对路径
18
+
18 19
         /// <summary>
19 20
         /// 获取文件的绝对路径
20 21
         /// </summary>
@@ -43,6 +44,61 @@ namespace Common.system
43 44
                 return Path;
44 45
             }
45 46
         }
47
+        /// <summary>
48
+        /// 获取合法路径 结尾带/
49
+        /// </summary>
50
+        /// <returns></returns>
51
+        public static string GetLegalPath(string FilePath)
52
+        {
53
+            FilePath = System.IO.Path.Combine(FilePath.Replace("\\", "/"));
54
+            FilePath += (FilePath.Substring(FilePath.Length - 1, 1) == "/" ? "" : "/");
55
+            return FilePath;
56
+        }
57
+        #endregion
58
+
59
+        #region 检测路径是否合法
60
+        /// <summary>
61
+        /// 检测路径是否合法
62
+        /// </summary>
63
+        /// <param name="FilePathName">绝对路径</param>
64
+        /// <param name="ErrMessage">返回错误</param>
65
+        /// <returns></returns>
66
+        public static bool IsLegalPath(string FilePathName, out string ErrMessage)
67
+        {
68
+            string FilePath;
69
+            string FileName;
70
+            ErrMessage = "";
71
+            try
72
+            {
73
+                FilePath = GetDirectoryName(FilePathName);
74
+                FileName = GetIOFileName(FilePathName);
75
+            }
76
+            catch (Exception)
77
+            {
78
+                ErrMessage = "路径或文件名不合法!";
79
+                return false;
80
+            }
81
+            Regex regex = new Regex(@"^([a-zA-Z]:\\)?[^\/\:\*\?\""\<\>\|\,]*$");
82
+            Match m = regex.Match(FilePath);
83
+            if (!m.Success)
84
+            {
85
+                ErrMessage = "非法的文件保存路径!";
86
+                return false;
87
+            }
88
+            if (!string.IsNullOrWhiteSpace(FileName))
89
+            {
90
+                regex = new Regex(@"^[^\/\:\*\?\""\<\>\|\,]+$");
91
+                m = regex.Match(FileName);
92
+                if (!m.Success)
93
+                {
94
+                    ErrMessage = "非法的文件名!文件名中包含\\ / : * ? \" < > |等字符!";
95
+                    return false;
96
+                }
97
+            }
98
+            return true;
99
+
100
+        }
101
+        #endregion
46 102
 
47 103
         #region 检测指定目录是否存在
48 104
         /// <summary>  
@@ -128,7 +184,7 @@ namespace Common.system
128 184
             try
129 185
             {
130 186
                 //获取指定的文件列表  
131
-                string[] fileNames = GetFileNames(directoryPath, searchPattern, true);
187
+                string[] fileNames = GetFileNames(directoryPath, searchPattern, isSearchChild);
132 188
 
133 189
                 //判断指定文件是否存在  
134 190
                 return fileNames.Length != 0;
@@ -292,7 +348,7 @@ namespace Common.system
292 348
                 return null;//throw new FileNotFoundException();
293 349
             }
294 350
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
295
-            FileInfo[] fileList = null;
351
+            FileInfo[] fileList;
296 352
             if (files == null)
297 353
                 fileList = folder.GetFiles();
298 354
             else
@@ -610,7 +666,7 @@ namespace Common.system
610 666
 
611 667
         #region 从文件的绝对路径中获取路径名
612 668
         /// <summary>  
613
-        /// 从文件的绝对路径中获取扩展
669
+        /// 使用IO从文件的绝对路径中获取路径
614 670
         /// </summary>  
615 671
         /// <param name="filePath">文件的绝对路径</param>          
616 672
         public static string GetDirectoryName(string filePath)
@@ -695,7 +751,7 @@ namespace Common.system
695 751
         /// </summary>
696 752
         /// <param name="directoryPath">目录地址</param>
697 753
         /// <returns> 单位:MB</returns>
698
-        public static double pathSize(string directoryPath)
754
+        public static double PathSize(string directoryPath)
699 755
         {
700 756
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
701 757
             double DirectorySize = DirSize(folder);

+ 1
- 4
Common/system/FreeMemoryHelper.cs Voir le fichier

@@ -1,10 +1,7 @@
1 1
 using Microsoft.Win32;
2
+
2 3
 using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5 4
 using System.Runtime.InteropServices;
6
-using System.Text;
7
-using System.Threading.Tasks;
8 5
 
9 6
 namespace Common.system
10 7
 {

+ 0
- 2
Common/system/HttpHelper.cs Voir le fichier

@@ -1,10 +1,8 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3
-using System.Linq;
4 3
 using System.Net;
5 4
 using System.Net.Security;
6 5
 using System.Security.Cryptography.X509Certificates;
7
-using System.Text;
8 6
 using System.Threading;
9 7
 
10 8
 namespace Common.system

+ 3
- 6
Common/system/ImageHelper.cs Voir le fichier

@@ -1,14 +1,11 @@
1 1
 using System;
2
-using System.Collections.Generic;
2
+using System.Configuration;
3 3
 using System.Drawing;
4
+using System.Drawing.Imaging;
4 5
 using System.IO;
5
-using System.Windows.Media.Imaging;
6 6
 using System.Windows;
7
-using System.Linq;
8
-using System.Text;
9
-using System.Drawing.Imaging;
10
-using System.Configuration;
11 7
 using System.Windows.Media;
8
+using System.Windows.Media.Imaging;
12 9
 
13 10
 namespace Common.system
14 11
 {

+ 1
- 5
Common/system/LogHelper.cs Voir le fichier

@@ -1,8 +1,4 @@
1 1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using log4net;
6 2
 
7 3
 namespace Common.system
8 4
 {
@@ -10,7 +6,7 @@ namespace Common.system
10 6
     {
11 7
         public static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
12 8
         public static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
13
-        public static void WriteInfoLog(string info) 
9
+        public static void WriteInfoLog(string info)
14 10
         {
15 11
             if (loginfo.IsInfoEnabled)
16 12
             {

+ 12
- 8
Common/system/PrimaryScreen.cs Voir le fichier

@@ -38,9 +38,11 @@ namespace Common.system
38 38
             get
39 39
             {
40 40
                 IntPtr hdc = GetDC(IntPtr.Zero);
41
-                Size size = new Size();
42
-                size.Width = GetDeviceCaps(hdc, HORZRES);
43
-                size.Height = GetDeviceCaps(hdc, VERTRES);
41
+                Size size = new Size
42
+                {
43
+                    Width = GetDeviceCaps(hdc, HORZRES),
44
+                    Height = GetDeviceCaps(hdc, VERTRES)
45
+                };
44 46
                 ReleaseDC(IntPtr.Zero, hdc);
45 47
                 return size;
46 48
             }
@@ -79,9 +81,11 @@ namespace Common.system
79 81
             get
80 82
             {
81 83
                 IntPtr hdc = GetDC(IntPtr.Zero);
82
-                Size size = new Size();
83
-                size.Width = GetDeviceCaps(hdc, DESKTOPHORZRES);
84
-                size.Height = GetDeviceCaps(hdc, DESKTOPVERTRES);
84
+                Size size = new Size
85
+                {
86
+                    Width = GetDeviceCaps(hdc, DESKTOPHORZRES),
87
+                    Height = GetDeviceCaps(hdc, DESKTOPVERTRES)
88
+                };
85 89
                 ReleaseDC(IntPtr.Zero, hdc);
86 90
                 return size;
87 91
             }
@@ -95,8 +99,8 @@ namespace Common.system
95 99
             get
96 100
             {
97 101
                 IntPtr hdc = GetDC(IntPtr.Zero);
98
-                int t = GetDeviceCaps(hdc, DESKTOPHORZRES);
99
-                int d = GetDeviceCaps(hdc, HORZRES);
102
+                /*int t = */GetDeviceCaps(hdc, DESKTOPHORZRES);
103
+               /* int d = */GetDeviceCaps(hdc, HORZRES);
100 104
                 float ScaleX = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
101 105
                 ReleaseDC(IntPtr.Zero, hdc);
102 106
                 return ScaleX;

+ 1
- 4
Common/system/SplashScreen.cs Voir le fichier

@@ -1,8 +1,5 @@
1 1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4 2
 using System.Reflection;
5
-using System.Text;
6 3
 using System.Threading;
7 4
 using System.Windows.Forms;
8 5
 
@@ -32,7 +29,7 @@ namespace Common.system
32 29
                 throw (new Exception());
33 30
             }
34 31
 
35
-            _SplashThread = new Thread(new ThreadStart(delegate()
32
+            _SplashThread = new Thread(new ThreadStart(delegate ()
36 33
             {
37 34
                 CreateInstance(splashFormType);
38 35
                 Application.Run(_SplashForm);

+ 0
- 3
Common/system/XmlUtilHelper.cs Voir le fichier

@@ -1,9 +1,6 @@
1 1
 using System;
2
-using System.Collections.Generic;
3 2
 using System.Data;
4 3
 using System.IO;
5
-using System.Linq;
6
-using System.Text;
7 4
 using System.Xml;
8 5
 using System.Xml.Serialization;
9 6
 

+ 0
- 12
XHWK.Model/Class1.cs Voir le fichier

@@ -1,12 +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.Model
8
-{
9
-    public class Class1
10
-    {
11
-    }
12
-}

+ 8
- 0
XHWK.Model/Model_UserInfo.cs Voir le fichier

@@ -0,0 +1,8 @@
1
+namespace XHWK.Model
2
+{
3
+    public class Model_UserInfo
4
+    {
5
+        string _wkName;
6
+        public string WkName { get => _wkName; set => _wkName = value; }
7
+    }
8
+}

+ 69
- 0
XHWK.Model/Model_Video.cs Voir le fichier

@@ -0,0 +1,69 @@
1
+namespace XHWK.Model
2
+{
3
+    /// <summary>
4
+    /// 视频模型
5
+    /// </summary>
6
+    public class Model_Video
7
+    {
8
+        private string _videPath;
9
+        private string _thumbnailPath;
10
+        private Emum_VideoType _videoType;
11
+        private Enum_WKVidetype _wkType;
12
+        private string _RSTime;
13
+        private string _videoSize;
14
+        private string _drawDataPath;
15
+        /// <summary>
16
+        /// 视频路径
17
+        /// </summary>
18
+        public string VidePath { get => _videPath; set => _videPath = value; }
19
+        /// <summary>
20
+        /// 缩略图路径
21
+        /// </summary>
22
+        public string ThumbnailPath { get => _thumbnailPath; set => _thumbnailPath = value; }
23
+        /// <summary>
24
+        /// 视频类型
25
+        /// </summary>
26
+        public Emum_VideoType VideoType { get => _videoType; set => _videoType = value; }
27
+        /// <summary>
28
+        /// 微课类型
29
+        /// </summary>
30
+        public Enum_WKVidetype WkType { get => _wkType; set => _wkType = value; }
31
+        /// <summary>
32
+        /// 录制时间
33
+        /// </summary>
34
+        public string RSTime { get => _RSTime; set => _RSTime = value; }
35
+        /// <summary>
36
+        /// 视频大小
37
+        /// </summary>
38
+        public string VideoSize { get => _videoSize; set => _videoSize = value; }
39
+        /// <summary>
40
+        /// 画板数据存储路径
41
+        /// </summary>
42
+        public string DrawDataPath { get => _drawDataPath; set => _drawDataPath = value; }
43
+    }
44
+    /// <summary>
45
+    /// 视频格式类型
46
+    /// </summary>
47
+    public enum Emum_VideoType
48
+    {
49
+        MP4 = 1,
50
+        FlV = 2,
51
+        AVI = 3
52
+    }
53
+
54
+    /// <summary>
55
+    /// 录制视频类型
56
+    /// </summary>
57
+    public enum Enum_WKVidetype
58
+    {
59
+        /// <summary>
60
+        /// 录屏
61
+        /// </summary>
62
+        RecordingScreen = 1,
63
+        /// <summary>
64
+        /// 录课
65
+        /// </summary>
66
+        RecordingLessons = 2
67
+    }
68
+
69
+}

+ 23
- 0
XHWK.Model/Model_WKData.cs Voir le fichier

@@ -0,0 +1,23 @@
1
+using System.Collections.Generic;
2
+
3
+namespace XHWK.Model
4
+{
5
+    public class Model_WKData
6
+    {
7
+        private string _wkName;
8
+        private List<Model_Video> _videoList;
9
+        private string _wkPath;
10
+        /// <summary>
11
+        /// 微课名
12
+        /// </summary>
13
+        public string WkName { get => _wkName; set => _wkName = value; }
14
+        /// <summary>
15
+        /// 视频列表
16
+        /// </summary>
17
+        public List<Model_Video> VideoList { get => _videoList; set => _videoList = value; }
18
+        /// <summary>
19
+        /// 微课路径
20
+        /// </summary>
21
+        public string WkPath { get => _wkPath; set => _wkPath = value; }
22
+    }
23
+}

+ 0
- 1
XHWK.Model/Properties/AssemblyInfo.cs Voir le fichier

@@ -1,5 +1,4 @@
1 1
 using System.Reflection;
2
-using System.Runtime.CompilerServices;
3 2
 using System.Runtime.InteropServices;
4 3
 
5 4
 // 有关程序集的一般信息由以下

+ 14
- 18
XHWK.Model/XHWK.Model.csproj Voir le fichier

@@ -1,10 +1,10 @@
1
-<?xml version="1.0" encoding="utf-8"?>
1
+<?xml version="1.0" encoding="utf-8"?>
2 2
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 3
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4 4
   <PropertyGroup>
5 5
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6 6
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
-    <ProjectGuid>445a4527-849b-4fa9-aa97-8ed1098d211e</ProjectGuid>
7
+    <ProjectGuid>{445A4527-849B-4FA9-AA97-8ED1098D211E}</ProjectGuid>
8 8
     <OutputType>Library</OutputType>
9 9
     <AppDesignerFolder>Properties</AppDesignerFolder>
10 10
     <RootNamespace>XHWK.Model</RootNamespace>
@@ -31,24 +31,20 @@
31 31
     <WarningLevel>4</WarningLevel>
32 32
   </PropertyGroup>
33 33
   <ItemGroup>
34
-    <Reference Include="System"/>
35
-    
36
-    <Reference Include="System.Core"/>
37
-    <Reference Include="System.Xml.Linq"/>
38
-    <Reference Include="System.Data.DataSetExtensions"/>
39
-    
40
-    
41
-    <Reference Include="Microsoft.CSharp"/>
42
-    
43
-    <Reference Include="System.Data"/>
44
-    
45
-    <Reference Include="System.Net.Http"/>
46
-    
47
-    <Reference Include="System.Xml"/>
34
+    <Reference Include="System" />
35
+    <Reference Include="System.Core" />
36
+    <Reference Include="System.Xml.Linq" />
37
+    <Reference Include="System.Data.DataSetExtensions" />
38
+    <Reference Include="Microsoft.CSharp" />
39
+    <Reference Include="System.Data" />
40
+    <Reference Include="System.Net.Http" />
41
+    <Reference Include="System.Xml" />
48 42
   </ItemGroup>
49 43
   <ItemGroup>
50
-    <Compile Include="Class1.cs" />
44
+    <Compile Include="Model_UserInfo.cs" />
45
+    <Compile Include="Model_Video.cs" />
46
+    <Compile Include="Model_WKData.cs" />
51 47
     <Compile Include="Properties\AssemblyInfo.cs" />
52 48
   </ItemGroup>
53 49
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
54
- </Project>
50
+</Project>

+ 1
- 1
XHWK.WKTool/App.config Voir le fichier

@@ -7,7 +7,7 @@
7 7
     <!--图片压缩等级-->
8 8
     <add key="ImageCompressionLevel" value="30" />
9 9
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
10
-    <add key="VideoSavePath" value="30" />
10
+    <add key="VideoSavePath" value="D:\星火微课" />
11 11
     <!--视频格式 1、MP4 2、FlV 3、AVI-->
12 12
     <add key="VideoType" value="1" />
13 13
   </appSettings>

+ 16
- 4
XHWK.WKTool/App.cs Voir le fichier

@@ -1,19 +1,30 @@
1 1
 using Common.system;
2 2
 
3 3
 using System;
4
-using System.Collections.Generic;
5 4
 using System.Diagnostics;
6
-using System.Linq;
7
-using System.Text;
8 5
 using System.Threading;
9
-using System.Threading.Tasks;
10 6
 using System.Windows;
11 7
 using System.Windows.Threading;
12 8
 
9
+using XHWK.Model;
10
+
13 11
 namespace XHWK.WKTool
14 12
 {
15 13
     public partial class APP : Application
16 14
     {
15
+        #region 全局变量
16
+        /// <summary>
17
+        /// 微课模型
18
+        /// </summary>
19
+        public static Model_WKData WKData = null;
20
+        /// <summary>
21
+        /// 讲解名称
22
+        /// </summary>
23
+        public static string WkName = null;
24
+        /// <summary>
25
+        /// 微课保存路径
26
+        /// </summary>
27
+        public static string WkSavePath = null;
17 28
         /// <summary>
18 29
         /// 主页面
19 30
         /// </summary>
@@ -26,6 +37,7 @@ namespace XHWK.WKTool
26 37
         /// 录像工具栏
27 38
         /// </summary>
28 39
         public static ScreenRecordingToolbarWindow W_ScreenRecordingToolbarWindow = null;
40
+        #endregion
29 41
 
30 42
         [STAThread]
31 43
         private static void Main()

+ 5
- 17
XHWK.WKTool/CountdownWindow.xaml.cs Voir le fichier

@@ -1,19 +1,6 @@
1
-using AForge.Imaging;
2
-using Common.system;
3
-using System;
4
-using System.Collections.Generic;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading;
8
-using System.Threading.Tasks;
1
+using System;
9 2
 using System.Windows;
10 3
 using System.Windows.Controls;
11
-using System.Windows.Data;
12
-using System.Windows.Documents;
13
-using System.Windows.Input;
14
-using System.Windows.Media;
15
-using System.Windows.Media.Imaging;
16
-using System.Windows.Shapes;
17 4
 using System.Windows.Threading;
18 5
 
19 6
 namespace XHWK.WKTool
@@ -35,8 +22,10 @@ namespace XHWK.WKTool
35 22
             //this.Hide();
36 23
             //MediaElement.Position
37 24
             //((MediaElement)((object)ImgGif)).Position= TimeSpan.Zero;
38
-            timer = new DispatcherTimer();
39
-            timer.Interval = TimeSpan.FromMilliseconds(2500);
25
+            timer = new DispatcherTimer
26
+            {
27
+                Interval = TimeSpan.FromMilliseconds(2500)
28
+            };
40 29
             timer.Tick += Timer_Tick;
41 30
             timer.Start();
42 31
         }
@@ -66,7 +55,6 @@ namespace XHWK.WKTool
66 55
 
67 56
         private void Image_MediaEnded(object sender, RoutedEventArgs e)
68 57
         {
69
-            System.Windows.Controls.Image img = (System.Windows.Controls.Image)sender;
70 58
             ((MediaElement)sender).Position = ((MediaElement)sender).Position.Add(TimeSpan.FromMilliseconds(10000));
71 59
         }
72 60
     }

+ 45
- 16
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs Voir le fichier

@@ -1,25 +1,16 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
1
+using Common.system;
2
+
3
+using System;
6 4
 using System.Windows;
7
-using System.Windows.Controls;
8
-using System.Windows.Data;
9
-using System.Windows.Documents;
10 5
 using System.Windows.Forms;
11 6
 using System.Windows.Input;
12
-using System.Windows.Media;
13
-using System.Windows.Media.Imaging;
14
-using System.Windows.Navigation;
15
-using System.Windows.Shapes;
16 7
 
17 8
 namespace XHWK.WKTool
18 9
 {
19 10
     /// <summary>
20 11
     /// 创建微课
21 12
     /// </summary>
22
-    public partial class CreateAMicroLessonWindow : Window 
13
+    public partial class CreateAMicroLessonWindow : Window
23 14
     {
24 15
         #region 字段
25 16
         private FolderBrowserDialog ofd;
@@ -32,6 +23,7 @@ namespace XHWK.WKTool
32 23
         public CreateAMicroLessonWindow()
33 24
         {
34 25
             InitializeComponent();
26
+            txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
35 27
         }
36 28
 
37 29
         #region 事件
@@ -40,7 +32,7 @@ namespace XHWK.WKTool
40 32
         /// </summary>
41 33
         /// <param name="sender"></param>
42 34
         /// <param name="e"></param>
43
-        private void btnDown_Click(object sender, RoutedEventArgs e)
35
+        private void BtnDown_Click(object sender, RoutedEventArgs e)
44 36
         {
45 37
 
46 38
         }
@@ -49,7 +41,7 @@ namespace XHWK.WKTool
49 41
         /// </summary>
50 42
         /// <param name="sender"></param>
51 43
         /// <param name="e"></param>
52
-        private void btnBrowse_Click(object sender, RoutedEventArgs e)
44
+        private void BtnBrowse_Click(object sender, RoutedEventArgs e)
53 45
         {
54 46
             string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
55 47
             ofd = new System.Windows.Forms.FolderBrowserDialog();
@@ -71,8 +63,45 @@ namespace XHWK.WKTool
71 63
         /// </summary>
72 64
         /// <param name="sender"></param>
73 65
         /// <param name="e"></param>
74
-        private void btnStart_Click(object sender, RoutedEventArgs e)
66
+        private void BtnStart_Click(object sender, RoutedEventArgs e)
75 67
         {
68
+            #region 合法性判断
69
+            if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
70
+            {
71
+                System.Windows.MessageBox.Show("讲解名称不可为空!");
72
+                return;
73
+            }
74
+            if (string.IsNullOrWhiteSpace(txbStoragePath.Text.Trim()))
75
+            {
76
+                System.Windows.MessageBox.Show("路径不可为空!");
77
+                return;
78
+            }
79
+            if (!FileToolsCommon.IsLegalPath(txbExplainName.Text.Trim(), out string ErrMessage))
80
+            {
81
+                System.Windows.MessageBox.Show(ErrMessage);
82
+            }
83
+            string PathName = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
84
+            if (FileToolsCommon.IsExistDirectory(PathName))
85
+            {
86
+                //微课已存在
87
+                MessageBoxResult dr = System.Windows.MessageBox.Show("讲解已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
88
+                if (dr == MessageBoxResult.OK)
89
+                {
90
+                    FileToolsCommon.DeleteDirectory(PathName);
91
+                }
92
+                else
93
+                {
94
+                    return;
95
+                }
96
+            }
97
+            #endregion
98
+            //创建文件夹
99
+            FileToolsCommon.CreateDirectory(PathName);
100
+            //存储文件
101
+            FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
102
+            APP.WkName = txbExplainName.Text;
103
+            APP.WkSavePath = PathName;
104
+            FileToolsCommon.CreateDirectory(APP.WkSavePath);
76 105
             if (APP.W_XHMicroLessonSystemWindow == null)
77 106
             {
78 107
                 APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();

+ 1
- 12
XHWK.WKTool/FileDirectoryWindow.xaml.cs Voir le fichier

@@ -1,16 +1,5 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-using System.Windows;
7
-using System.Windows.Controls;
8
-using System.Windows.Data;
9
-using System.Windows.Documents;
1
+using System.Windows;
10 2
 using System.Windows.Input;
11
-using System.Windows.Media;
12
-using System.Windows.Media.Imaging;
13
-using System.Windows.Shapes;
14 3
 
15 4
 namespace XHWK.WKTool
16 5
 {

+ 1
- 13
XHWK.WKTool/LoginWindow.xaml.cs Voir le fichier

@@ -1,16 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-using System.Windows;
7
-using System.Windows.Controls;
8
-using System.Windows.Data;
9
-using System.Windows.Documents;
10
-using System.Windows.Input;
11
-using System.Windows.Media;
12
-using System.Windows.Media.Imaging;
13
-using System.Windows.Shapes;
1
+using System.Windows;
14 2
 
15 3
 namespace XHWK.WKTool
16 4
 {

+ 0
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs Voir le fichier

@@ -1,6 +1,4 @@
1 1
 using System.Reflection;
2
-using System.Resources;
3
-using System.Runtime.CompilerServices;
4 2
 using System.Runtime.InteropServices;
5 3
 using System.Windows;
6 4
 

+ 1
- 1
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml Voir le fichier

@@ -73,7 +73,7 @@
73 73
                 <Image Grid.Row="1"  Source="./Images/Toobar0.png"/>
74 74
             <TextBlock Grid.Row="1" Text="01:35" FontSize="23" Foreground="#FFFFFF" Margin="30,50,0,0"/>
75 75
             <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,15,0">
76
-                <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0">
76
+                <Button x:Name="BtnRecordingScreen"  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0" Click="BtnRecordingScreen_Click">
77 77
                     <Image Source="./Images/Toobar25.png"/>
78 78
                 </Button>
79 79
                 <Button x:Name="BtnStopRecordingScreen" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0" Click="BtnStopRecordingScreen_Click">

+ 113
- 25
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Voir le fichier

@@ -1,17 +1,9 @@
1 1
 using Common.system;
2
+
2 3
 using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7 4
 using System.Windows;
8
-using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11
-using System.Windows.Input;
12
-using System.Windows.Media;
13
-using System.Windows.Media.Imaging;
14
-using System.Windows.Shapes;
5
+
6
+using XHWK.Model;
15 7
 
16 8
 namespace XHWK.WKTool
17 9
 {
@@ -20,14 +12,123 @@ namespace XHWK.WKTool
20 12
     /// </summary>
21 13
     public partial class ScreenRecordingToolbarWindow : Window
22 14
     {
15
+        #region 初始变量
16
+        /// <summary>
17
+        /// 视频存储路径
18
+        /// </summary>
19
+        string RSPath;
20
+        /// <summary>
21
+        /// 是否正在录制
22
+        /// </summary>
23
+        bool IsStartRS = false;
24
+        /// <summary>
25
+        /// 是否暂停
26
+        /// </summary>
27
+        bool IsSuspend = true;
28
+        /// <summary>
29
+        /// 录屏
30
+        /// </summary>
31
+        FFMpeg Ffmpeg = null;
32
+        #endregion
33
+
34
+        #region 初始化
35
+        /// <summary>
36
+        /// 录屏工具栏
37
+        /// </summary>
23 38
         public ScreenRecordingToolbarWindow()
24 39
         {
25 40
             InitializeComponent();
26 41
         }
42
+        /// <summary>
43
+        /// 初始化
44
+        /// </summary>
27 45
         public void Initialize()
28 46
         {
47
+            //隐藏画笔工具栏
29 48
             BtnToolbarDown_Click(null, null);
49
+            IsStartRS = false;
50
+            IsSuspend = true;
51
+            RSPath = null;
52
+            if (Ffmpeg == null)
53
+            {
54
+                Ffmpeg = new FFMpeg();
55
+            }
56
+        }
57
+        #endregion
58
+
59
+        #region 录制
60
+        /// <summary>
61
+        /// 停止录像
62
+        /// </summary>
63
+        /// <param name="sender"></param>
64
+        /// <param name="e"></param>
65
+        private void BtnStopRecordingScreen_Click(object sender, RoutedEventArgs e)
66
+        {
67
+            if (APP.W_XHMicroLessonSystemWindow == null)
68
+            {
69
+                APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
70
+            }
71
+            APP.W_XHMicroLessonSystemWindow.Show();
72
+            try
73
+            {
74
+                Ffmpeg.StopFFmpeg(RSPath);
75
+            }
76
+            catch (Exception ex)
77
+            {
78
+                MessageBox.Show(ex.Message);
79
+            }
80
+            IsStartRS = false;
81
+            Hide();
82
+        }
83
+        /// <summary>
84
+        /// 开始或暂停录制
85
+        /// </summary>
86
+        /// <param name="sender"></param>
87
+        /// <param name="e"></param>
88
+        private void BtnRecordingScreen_Click(object sender, RoutedEventArgs e)
89
+        {
90
+            if (IsSuspend)
91
+            {
92
+                if(IsStartRS)
93
+                {
94
+                }
95
+                //timer = new DispatcherTimer();
96
+                //timer.Interval = TimeSpan.FromMilliseconds(1000);
97
+                //timer.Tick += Timer_Tick;//你的事件
98
+                //dt = Convert.ToDateTime("2020-01-01 00:00:00");
99
+                //FileToolsCommon.DeleteDirectory(RSPath);
100
+                IsSuspend = false;
101
+                IsStartRS = true;
102
+                BtnRecordingScreen.Content = "暂停录制";
103
+                try
104
+                {
105
+                    RSPath = APP.WkSavePath;
106
+                    FileToolsCommon.CreateDirectory(RSPath);
107
+                    RSPath += "." + ((Emum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
108
+                    Ffmpeg.StartRecordingVideo(RSPath);
109
+                }
110
+                catch (Exception ex)
111
+                {
112
+                    MessageBox.Show(ex.Message);
113
+                }
114
+            }
115
+            else
116
+            {
117
+                IsSuspend = true;
118
+                try
119
+                {
120
+                    Ffmpeg.SuspendFFmpeg();
121
+                    Ffmpeg.StopFFmpeg(RSPath);
122
+                }
123
+                catch (Exception ex)
124
+                {
125
+                    MessageBox.Show(ex.Message);
126
+                }
127
+            }
30 128
         }
129
+        #endregion
130
+
131
+        #region 画笔相关
31 132
         /// <summary>
32 133
         /// 画笔工具栏关闭事件
33 134
         /// </summary>
@@ -75,19 +176,6 @@ namespace XHWK.WKTool
75 176
             gridColour.Visibility = Visibility.Visible;
76 177
             gridThickness.Visibility = Visibility.Collapsed;
77 178
         }
78
-        /// <summary>
79
-        /// 停止录像
80
-        /// </summary>
81
-        /// <param name="sender"></param>
82
-        /// <param name="e"></param>
83
-        private void BtnStopRecordingScreen_Click(object sender, RoutedEventArgs e)
84
-        {
85
-            if(APP.W_XHMicroLessonSystemWindow==null)
86
-            {
87
-                APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
88
-            }
89
-            APP.W_XHMicroLessonSystemWindow.Show();
90
-            Hide();
91
-        }
179
+        #endregion
92 180
     }
93 181
 }

+ 1
- 13
XHWK.WKTool/UCCamera.xaml.cs Voir le fichier

@@ -1,18 +1,6 @@
1 1
 using Common.system;
2
-using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
2
+
7 3
 using System.Windows;
8
-using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11
-using System.Windows.Input;
12
-using System.Windows.Media;
13
-using System.Windows.Media.Imaging;
14
-using System.Windows.Navigation;
15
-using System.Windows.Shapes;
16 4
 
17 5
 namespace XHWK.WKTool
18 6
 {

+ 1
- 1
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Voir le fichier

@@ -170,7 +170,7 @@
170 170
                         <TextBox x:Name="txbStoragePath" Text="D:\" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="523" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
171 171
                     </Border>
172 172
                     <!--浏览按钮-->
173
-                    <Button Cursor="Hand" x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="btnBrowse_Click">
173
+                    <Button Cursor="Hand" x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="BtnBrowse_Click">
174 174
                         <Button.Template>
175 175
                             <ControlTemplate TargetType="{x:Type Button}">
176 176
                                 <Border

+ 8
- 14
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Voir le fichier

@@ -1,19 +1,11 @@
1 1
 using Common.system;
2
+
2 3
 using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7 4
 using System.Windows;
8
-using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11 5
 using System.Windows.Forms;
12 6
 using System.Windows.Ink;
13 7
 using System.Windows.Input;
14 8
 using System.Windows.Media;
15
-using System.Windows.Media.Imaging;
16
-using System.Windows.Shapes;
17 9
 
18 10
 namespace XHWK.WKTool
19 11
 {
@@ -51,7 +43,7 @@ namespace XHWK.WKTool
51 43
             //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
52 44
             blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
53 45
             drawingAttributes.FitToCurve = true;
54
-        } 
46
+        }
55 47
         #endregion
56 48
 
57 49
         #region 事件
@@ -118,8 +110,10 @@ namespace XHWK.WKTool
118 110
 
119 111
             if (APP.W_ScreenRecordingToolbarWindow == null)
120 112
             {
121
-                APP.W_ScreenRecordingToolbarWindow = new ScreenRecordingToolbarWindow();
122
-                APP.W_ScreenRecordingToolbarWindow.Topmost = true;
113
+                APP.W_ScreenRecordingToolbarWindow = new ScreenRecordingToolbarWindow
114
+                {
115
+                    Topmost = true
116
+                };
123 117
                 APP.W_ScreenRecordingToolbarWindow.Initialize();
124 118
 
125 119
             }
@@ -177,7 +171,7 @@ namespace XHWK.WKTool
177 171
         /// </summary>
178 172
         /// <param name="sender"></param>
179 173
         /// <param name="e"></param>
180
-        private void btnBrowse_Click(object sender, RoutedEventArgs e)
174
+        private void BtnBrowse_Click(object sender, RoutedEventArgs e)
181 175
         {
182 176
             string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
183 177
             Ofd = new System.Windows.Forms.FolderBrowserDialog();
@@ -218,7 +212,7 @@ namespace XHWK.WKTool
218 212
         /// <param name="e"></param>
219 213
         private void BtnRed_Click(object sender, RoutedEventArgs e)
220 214
         {
221
-        
215
+
222 216
             //设置 DrawingAttributes 的 Color 属性设置颜色  
223 217
             drawingAttributes.Color = Colors.Red;
224 218
         }

Chargement…
Annuler
Enregistrer