Browse Source

zhao:1,优化麦克风和音频检测。2优化上传3去除未登录清空用户信息。

tags/录制修改前
耀 4 years ago
parent
commit
17753f1703

+ 9
- 5
Common/system/FFMpeg.cs View File

67
             LogPath = CreateffmpegLog();
67
             LogPath = CreateffmpegLog();
68
             string MicrophoneName = null;
68
             string MicrophoneName = null;
69
             #region 检测麦克风扬声器
69
             #region 检测麦克风扬声器
70
-            string audioSpeakerPath = FileToolsCommon.GetFileAbsolutePath("adoS.m");
71
-            string audioMicrophonePath = FileToolsCommon.GetFileAbsolutePath("adoM.m");
70
+            string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
71
+            FileToolsCommon.CreateDirectory(AudioPath);
72
+            string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";//FileToolsCommon.GetFileAbsolutePath("adoS.m");
73
+            string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";//FileToolsCommon.GetFileAbsolutePath("adoM.m");
72
             try
74
             try
73
             {
75
             {
74
                 FileToolsCommon.DeleteFile(audioSpeakerPath);
76
                 FileToolsCommon.DeleteFile(audioSpeakerPath);
202
             }
204
             }
203
             string MicrophoneName = null;
205
             string MicrophoneName = null;
204
             #region 检测麦克风扬声器
206
             #region 检测麦克风扬声器
205
-            string audioSpeakerPath = FileToolsCommon.GetFileAbsolutePath("adoS.m");
206
-            string audioMicrophonePath = FileToolsCommon.GetFileAbsolutePath("adoM.m");
207
+            string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
208
+            FileToolsCommon.CreateDirectory(AudioPath);
209
+            string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
210
+            string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
207
             try
211
             try
208
             {
212
             {
209
                 FileToolsCommon.DeleteFile(audioSpeakerPath);
213
                 FileToolsCommon.DeleteFile(audioSpeakerPath);
1032
             }
1036
             }
1033
             catch (ApplicationException)
1037
             catch (ApplicationException)
1034
             {
1038
             {
1035
-                Console.WriteLine("No local capture devices");
1039
+                //Console.WriteLine("No local capture devices");
1036
             }
1040
             }
1037
             return devicesList;
1041
             return devicesList;
1038
         }
1042
         }

+ 2
- 2
XHWK.WKTool/AppUpdateWin.xaml.cs View File

57
                 info.Create();
57
                 info.Create();
58
             }
58
             }
59
 
59
 
60
-            System.Console.WriteLine("fileUrl:" + fileUrl);
60
+            //System.Console.WriteLine("fileUrl:" + fileUrl);
61
             string filename = fileUrl.Substring(fileUrl.LastIndexOf("/") + 1);
61
             string filename = fileUrl.Substring(fileUrl.LastIndexOf("/") + 1);
62
             if (filename != null)
62
             if (filename != null)
63
             {
63
             {
80
 
80
 
81
         public void downloadEnd(int position, string filepath)
81
         public void downloadEnd(int position, string filepath)
82
         {
82
         {
83
-            System.Console.WriteLine("filepath:" + filepath);
83
+            //System.Console.WriteLine("filepath:" + filepath);
84
             progress_sp.Visibility = Visibility.Collapsed;
84
             progress_sp.Visibility = Visibility.Collapsed;
85
             content_sv.Visibility = Visibility.Visible;
85
             content_sv.Visibility = Visibility.Visible;
86
             button_bottom.Visibility = Visibility.Visible;
86
             button_bottom.Visibility = Visibility.Visible;

+ 70
- 11
XHWK.WKTool/DAL/DAL_Upload.cs View File

104
                     if (resultObj.code == 0 && resultObj.obj != null)
104
                     if (resultObj.code == 0 && resultObj.obj != null)
105
                     {
105
                     {
106
                         APP.ResourceAddTwo = resultObj.obj;
106
                         APP.ResourceAddTwo = resultObj.obj;
107
+                        //上报合并成功后 修改为已成功上传。
107
                         foreach (Model_WKData Vdata in APP.WKDataList)
108
                         foreach (Model_WKData Vdata in APP.WKDataList)
108
                         {
109
                         {
109
                             if (Vdata.VideoList == null)
110
                             if (Vdata.VideoList == null)
241
                     {
242
                     {
242
                         VideoInfo.FileMD5 = AESHelper.AESEncrypt(FileToolsCommon.ReadBigFileStr(VideoInfo.VideoPath, 1024));
243
                         VideoInfo.FileMD5 = AESHelper.AESEncrypt(FileToolsCommon.ReadBigFileStr(VideoInfo.VideoPath, 1024));
243
                     }
244
                     }
244
-                    if (IsAllowUploaded(VideoInfo.FileMD5, out ErrMessage))
245
+
246
+                    //视频长度
247
+                    long filelen = FileToolsCommon.GetFileSize(VideoInfo.VideoPath);
248
+                    //每片的长度
249
+                    double UploadSliceLenMB = double.Parse(FileToolsCommon.GetConfigValue("UploadSliceLen"));
250
+                    string fileName = FileToolsCommon.GetFileName(VideoInfo.VideoPath);
251
+                    //是否续传
252
+                    bool IsSequel = true;
253
+                    //分块数为0时 从未上传过 
254
+                    if(VideoInfo.Block>0)
245
                     {
255
                     {
246
-                        //视频长度
247
-                        long filelen = FileToolsCommon.GetFileSize(VideoInfo.VideoPath);
248
-                        //每片的长度
249
-                        double UploadSliceLenMB = double.Parse(FileToolsCommon.GetConfigValue("UploadSliceLen"));
250
-                        if (VideoInfo.SliceLen == 0)
256
+                        //是否已上传所有分块
257
+                        if(VideoInfo.Block> VideoInfo.Uploaded)
251
                         {
258
                         {
252
-                            VideoInfo.SliceLen = (long)(UploadSliceLenMB * 1024 * 1024);
253
-                            VideoInfo.Block = (int)(filelen / VideoInfo.SliceLen + (filelen % VideoInfo.SliceLen > 0 ? 1 : 0));
259
+                            //已上传,未上传完
260
+                            IsSequel = true;
254
                         }
261
                         }
255
-                        //临时修改 没有断点续传,每次上传都重新上传。
256
-                        VideoInfo.Uploaded = 0;
262
+                        else
263
+                        {
264
+                            //上传完,未合并
265
+                            IsSequel = false;
266
+
267
+                            #region 合并文件
268
+                            //合并文件
269
+                            bool isres = ReportFileMerge(APP.UserInfo.Schoolid.ToString() + "/resource", VideoInfo.FileGuid, out ErrMessage);
270
+                            if (isres)
271
+                            {
272
+                                VideoInfo.IsUpload = true;
273
+                                return true;
274
+                            }
275
+                            else
276
+                            {
277
+                                return false;
278
+                            }
279
+                            #endregion
280
+
281
+                        }
282
+                    }
283
+                    else
284
+                    {
285
+                        //是否允许上传
286
+                        if (IsAllowUploaded(VideoInfo.FileMD5, out ErrMessage))
287
+                        {
288
+                            IsSequel = true;
289
+                            if (VideoInfo.SliceLen == 0)
290
+                            {
291
+                                VideoInfo.SliceLen = (long)(UploadSliceLenMB * 1024 * 1024);
292
+                                VideoInfo.Block = (int)(filelen / VideoInfo.SliceLen + (filelen % VideoInfo.SliceLen > 0 ? 1 : 0));
293
+                            }
294
+                        }
295
+                        else
296
+                        {
297
+                            //文件在服务器上已存在  空间是否存在未知 若增加空间是否存在判断在此处添加
298
+                            IsSequel = false;
299
+                            VideoInfo.Block = 1;
300
+                            VideoInfo.Uploaded = 1;
301
+
302
+                            VideoInfo.IsUpload = true;
303
+                            return true;
304
+                        }
305
+
306
+                    }
307
+
308
+                    ////临时修改 没有断点续传,每次上传都重新上传。
309
+                    //VideoInfo.Uploaded = 0;
310
+                    if (IsSequel)
311
+                    {
257
                         //已上传长度
312
                         //已上传长度
258
                         long len = VideoInfo.Uploaded * VideoInfo.SliceLen;
313
                         long len = VideoInfo.Uploaded * VideoInfo.SliceLen;
259
-                        string fileName = FileToolsCommon.GetFileName(VideoInfo.VideoPath);
260
 
314
 
315
+                        #region 废弃
261
                         ////分块
316
                         ////分块
262
                         //for (; len + VideoInfo.SliceLen < filelen; VideoInfo.Uploaded++)
317
                         //for (; len + VideoInfo.SliceLen < filelen; VideoInfo.Uploaded++)
263
                         //{
318
                         //{
279
                         //        return false;
334
                         //        return false;
280
                         //    }
335
                         //    }
281
                         //}
336
                         //}
337
+                        #endregion
282
 
338
 
283
                         //分块
339
                         //分块
284
                         do
340
                         do
311
                                 return false;
367
                                 return false;
312
                             }
368
                             }
313
                         } while (len + VideoInfo.SliceLen < filelen);
369
                         } while (len + VideoInfo.SliceLen < filelen);
370
+
371
+                        #region 合并文件
314
                         //合并文件
372
                         //合并文件
315
                         bool isres = ReportFileMerge(APP.UserInfo.Schoolid.ToString() + "/resource", VideoInfo.FileGuid, out ErrMessage);
373
                         bool isres = ReportFileMerge(APP.UserInfo.Schoolid.ToString() + "/resource", VideoInfo.FileGuid, out ErrMessage);
316
                         if (isres)
374
                         if (isres)
322
                         {
380
                         {
323
                             return false;
381
                             return false;
324
                         }
382
                         }
383
+                        #endregion
325
                     }
384
                     }
326
                     else
385
                     else
327
                     {
386
                     {

+ 4
- 1
XHWK.WKTool/DAL/Interface.cs View File

138
             {
138
             {
139
                 APP.UserInfo = new Model_UserInfo();
139
                 APP.UserInfo = new Model_UserInfo();
140
                 APP.ServerMsg = result.msg;
140
                 APP.ServerMsg = result.msg;
141
-                APP.UserInfo = result.obj;
141
+                if (result.obj != null)
142
+                {
143
+                    APP.UserInfo = result.obj;
144
+                }
142
                 return result.code;
145
                 return result.code;
143
             }
146
             }
144
             else
147
             else

+ 3
- 3
XHWK.WKTool/ProductVerification.xaml.cs View File

148
 
148
 
149
         ~ProductVerification()
149
         ~ProductVerification()
150
         {
150
         {
151
-            Console.WriteLine("{0}被销毁", this);
151
+            //Console.WriteLine("{0}被销毁", this);
152
             Dispose(false);
152
             Dispose(false);
153
         }
153
         }
154
         public void Dispose()
154
         public void Dispose()
155
         {
155
         {
156
-            Console.WriteLine("{0}被手动销毁", this);
156
+            //Console.WriteLine("{0}被手动销毁", this);
157
             Dispose(true);
157
             Dispose(true);
158
             GC.SuppressFinalize(this);
158
             GC.SuppressFinalize(this);
159
         }
159
         }
161
         private bool disposed;
161
         private bool disposed;
162
         protected void Dispose(bool disposing)
162
         protected void Dispose(bool disposing)
163
         {
163
         {
164
-            Console.WriteLine("{0}被自动销毁", this);
164
+            //Console.WriteLine("{0}被自动销毁", this);
165
             if (!disposed)
165
             if (!disposed)
166
             {
166
             {
167
                 if (disposing)
167
                 if (disposing)

+ 15
- 6
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

331
                 if (IsFirstRS)
331
                 if (IsFirstRS)
332
                 {
332
                 {
333
                     #region 检测麦克风扬声器是否可用
333
                     #region 检测麦克风扬声器是否可用
334
-                    string audioSpeakerPath = FileToolsCommon.GetFileAbsolutePath("adoS.m");
335
-                    string audioMicrophonePath = FileToolsCommon.GetFileAbsolutePath("adoM.m");
334
+                    string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
335
+                    FileToolsCommon.CreateDirectory(AudioPath);
336
+                    string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
337
+                    string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
336
                     try
338
                     try
337
                     {
339
                     {
338
                         FileToolsCommon.DeleteFile(audioSpeakerPath);
340
                         FileToolsCommon.DeleteFile(audioSpeakerPath);
626
                             VideoInfo.FileGuid = Guid.NewGuid().ToString();
628
                             VideoInfo.FileGuid = Guid.NewGuid().ToString();
627
                             VideoInfo.IsUpload = false;
629
                             VideoInfo.IsUpload = false;
628
                             VideoInfo.Uploaded = 0;
630
                             VideoInfo.Uploaded = 0;
629
-                            VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
631
+                            //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
630
                             APP.VideoList.Add(VideoInfo);
632
                             APP.VideoList.Add(VideoInfo);
631
                             //保存数据
633
                             //保存数据
632
                             APP.SaveWkData();
634
                             APP.SaveWkData();
1279
                 //{
1281
                 //{
1280
                 //    APP.W_CountdownWindow.Initialize(true, 1800);
1282
                 //    APP.W_CountdownWindow.Initialize(true, 1800);
1281
                 //}
1283
                 //}
1282
-                gridToobar.Visibility = Visibility.Hidden;
1283
-                APP.W_MinToolbar.Show();
1284
-                Console.WriteLine(this.Top+"max");
1284
+                new Thread(new ThreadStart(new Action(() =>
1285
+                {
1286
+                    Thread.Sleep(500);
1287
+                    Dispatcher.Invoke(() =>
1288
+                    {
1289
+                        gridToobar.Visibility = Visibility.Hidden;
1290
+                        APP.W_MinToolbar.Show();
1291
+                    });
1292
+                }))).Start();
1293
+                //Console.WriteLine(this.Top+"max");
1285
             }
1294
             }
1286
         }
1295
         }
1287
     }
1296
     }

+ 8
- 6
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

3357
                 if (IsFirstR)//是否第一次录制  初始化录制
3357
                 if (IsFirstR)//是否第一次录制  初始化录制
3358
                 {
3358
                 {
3359
                     #region 检测麦克风扬声器是否可用
3359
                     #region 检测麦克风扬声器是否可用
3360
-                    string audioSpeakerPath = FileToolsCommon.GetFileAbsolutePath("adoS.m");
3361
-                    string audioMicrophonePath = FileToolsCommon.GetFileAbsolutePath("adoM.m");
3360
+                    string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
3361
+                    FileToolsCommon.CreateDirectory(AudioPath);
3362
+                    string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
3363
+                    string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
3362
                     try
3364
                     try
3363
                     {
3365
                     {
3364
                         FileToolsCommon.DeleteFile(audioSpeakerPath);
3366
                         FileToolsCommon.DeleteFile(audioSpeakerPath);
3893
                             VideoInfo.FileGuid = Guid.NewGuid().ToString();
3895
                             VideoInfo.FileGuid = Guid.NewGuid().ToString();
3894
                             VideoInfo.IsUpload = false;
3896
                             VideoInfo.IsUpload = false;
3895
                             VideoInfo.Uploaded = 0;
3897
                             VideoInfo.Uploaded = 0;
3896
-                            VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
3898
+                            //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
3897
                             APP.VideoList.Add(VideoInfo);
3899
                             APP.VideoList.Add(VideoInfo);
3898
                             //保存数据
3900
                             //保存数据
3899
                             APP.SaveWkData();
3901
                             APP.SaveWkData();
4183
             img.CaptureMouse();
4185
             img.CaptureMouse();
4184
             mouseDown = true;
4186
             mouseDown = true;
4185
             mouseXY = e.GetPosition(img);
4187
             mouseXY = e.GetPosition(img);
4186
-            Console.WriteLine("mouseXY.X = " + mouseXY.X + "; mouseXY.Y = " + mouseXY.Y);
4188
+            //Console.WriteLine("mouseXY.X = " + mouseXY.X + "; mouseXY.Y = " + mouseXY.Y);
4187
 
4189
 
4188
         }
4190
         }
4189
         private void IMG1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
4191
         private void IMG1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
4244
                 return;
4246
                 return;
4245
             }
4247
             }
4246
             System.Windows.Point point = e.GetPosition(img);
4248
             System.Windows.Point point = e.GetPosition(img);
4247
-            Console.WriteLine("point.X = " + point.X + "; point.Y=" + point.Y);
4249
+            //Console.WriteLine("point.X = " + point.X + "; point.Y=" + point.Y);
4248
             System.Windows.Point PicLocate = e.GetPosition(imgCanvas);
4250
             System.Windows.Point PicLocate = e.GetPosition(imgCanvas);
4249
-            Console.WriteLine("PicEmap.X = " + PicLocate.X + "; PicEmap.Y=" + PicLocate.Y);
4251
+            //Console.WriteLine("PicEmap.X = " + PicLocate.X + "; PicEmap.Y=" + PicLocate.Y);
4250
 
4252
 
4251
 
4253
 
4252
             TransformGroup group = IMG.FindResource("Imageview") as TransformGroup;
4254
             TransformGroup group = IMG.FindResource("Imageview") as TransformGroup;

Loading…
Cancel
Save