Explorar el Código

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

tags/录制修改前
耀 hace 4 años
padre
commit
17753f1703

+ 9
- 5
Common/system/FFMpeg.cs Ver fichero

@@ -67,8 +67,10 @@ namespace Common.system
67 67
             LogPath = CreateffmpegLog();
68 68
             string MicrophoneName = null;
69 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 74
             try
73 75
             {
74 76
                 FileToolsCommon.DeleteFile(audioSpeakerPath);
@@ -202,8 +204,10 @@ namespace Common.system
202 204
             }
203 205
             string MicrophoneName = null;
204 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 211
             try
208 212
             {
209 213
                 FileToolsCommon.DeleteFile(audioSpeakerPath);
@@ -1032,7 +1036,7 @@ namespace Common.system
1032 1036
             }
1033 1037
             catch (ApplicationException)
1034 1038
             {
1035
-                Console.WriteLine("No local capture devices");
1039
+                //Console.WriteLine("No local capture devices");
1036 1040
             }
1037 1041
             return devicesList;
1038 1042
         }

+ 2
- 2
XHWK.WKTool/AppUpdateWin.xaml.cs Ver fichero

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

+ 70
- 11
XHWK.WKTool/DAL/DAL_Upload.cs Ver fichero

@@ -104,6 +104,7 @@ namespace XHWK.WKTool.DAL
104 104
                     if (resultObj.code == 0 && resultObj.obj != null)
105 105
                     {
106 106
                         APP.ResourceAddTwo = resultObj.obj;
107
+                        //上报合并成功后 修改为已成功上传。
107 108
                         foreach (Model_WKData Vdata in APP.WKDataList)
108 109
                         {
109 110
                             if (Vdata.VideoList == null)
@@ -241,23 +242,77 @@ namespace XHWK.WKTool.DAL
241 242
                     {
242 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 313
                         long len = VideoInfo.Uploaded * VideoInfo.SliceLen;
259
-                        string fileName = FileToolsCommon.GetFileName(VideoInfo.VideoPath);
260 314
 
315
+                        #region 废弃
261 316
                         ////分块
262 317
                         //for (; len + VideoInfo.SliceLen < filelen; VideoInfo.Uploaded++)
263 318
                         //{
@@ -279,6 +334,7 @@ namespace XHWK.WKTool.DAL
279 334
                         //        return false;
280 335
                         //    }
281 336
                         //}
337
+                        #endregion
282 338
 
283 339
                         //分块
284 340
                         do
@@ -311,6 +367,8 @@ namespace XHWK.WKTool.DAL
311 367
                                 return false;
312 368
                             }
313 369
                         } while (len + VideoInfo.SliceLen < filelen);
370
+
371
+                        #region 合并文件
314 372
                         //合并文件
315 373
                         bool isres = ReportFileMerge(APP.UserInfo.Schoolid.ToString() + "/resource", VideoInfo.FileGuid, out ErrMessage);
316 374
                         if (isres)
@@ -322,6 +380,7 @@ namespace XHWK.WKTool.DAL
322 380
                         {
323 381
                             return false;
324 382
                         }
383
+                        #endregion
325 384
                     }
326 385
                     else
327 386
                     {

+ 4
- 1
XHWK.WKTool/DAL/Interface.cs Ver fichero

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

+ 3
- 3
XHWK.WKTool/ProductVerification.xaml.cs Ver fichero

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

+ 15
- 6
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Ver fichero

@@ -331,8 +331,10 @@ namespace XHWK.WKTool
331 331
                 if (IsFirstRS)
332 332
                 {
333 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 338
                     try
337 339
                     {
338 340
                         FileToolsCommon.DeleteFile(audioSpeakerPath);
@@ -626,7 +628,7 @@ namespace XHWK.WKTool
626 628
                             VideoInfo.FileGuid = Guid.NewGuid().ToString();
627 629
                             VideoInfo.IsUpload = false;
628 630
                             VideoInfo.Uploaded = 0;
629
-                            VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
631
+                            //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
630 632
                             APP.VideoList.Add(VideoInfo);
631 633
                             //保存数据
632 634
                             APP.SaveWkData();
@@ -1279,9 +1281,16 @@ namespace XHWK.WKTool
1279 1281
                 //{
1280 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 Ver fichero

@@ -3357,8 +3357,10 @@ namespace XHWK.WKTool
3357 3357
                 if (IsFirstR)//是否第一次录制  初始化录制
3358 3358
                 {
3359 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 3364
                     try
3363 3365
                     {
3364 3366
                         FileToolsCommon.DeleteFile(audioSpeakerPath);
@@ -3893,7 +3895,7 @@ namespace XHWK.WKTool
3893 3895
                             VideoInfo.FileGuid = Guid.NewGuid().ToString();
3894 3896
                             VideoInfo.IsUpload = false;
3895 3897
                             VideoInfo.Uploaded = 0;
3896
-                            VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
3898
+                            //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
3897 3899
                             APP.VideoList.Add(VideoInfo);
3898 3900
                             //保存数据
3899 3901
                             APP.SaveWkData();
@@ -4183,7 +4185,7 @@ namespace XHWK.WKTool
4183 4185
             img.CaptureMouse();
4184 4186
             mouseDown = true;
4185 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 4191
         private void IMG1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -4244,9 +4246,9 @@ namespace XHWK.WKTool
4244 4246
                 return;
4245 4247
             }
4246 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 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 4254
             TransformGroup group = IMG.FindResource("Imageview") as TransformGroup;

Loading…
Cancelar
Guardar