Преглед на файлове

zhao:1修改请求,2去除ZConfig,3整理优化代码

tags/录制修改前
耀 преди 4 години
родител
ревизия
68b6b6b98a
променени са 57 файла, в които са добавени 1294 реда и са изтрити 1154 реда
  1. 15
    14
      Common/AESHelper.cs
  2. 12
    12
      Common/Model/DownloadInfoModel.cs
  3. 35
    26
      Common/system/BlackboardNew.cs
  4. 83
    19
      Common/system/CLeopardZip.cs
  5. 31
    19
      Common/system/CameraHelper.cs
  6. 3
    3
      Common/system/DataConvertCommon.cs
  7. 69
    46
      Common/system/DownloadManager.cs
  8. 64
    44
      Common/system/DownloadService.cs
  9. 34
    29
      Common/system/FFMpeg.cs
  10. 14
    5
      Common/system/FileToolsCommon.cs
  11. 21
    21
      Common/system/HttpHelper.cs
  12. 16
    4
      Common/system/ImageHelper.cs
  13. 1
    4
      Common/system/JsonHelper.cs
  14. 13
    12
      Common/system/KeyboardHookCommon.cs
  15. 8
    10
      Common/system/LatticeFileHelper.cs
  16. 5
    4
      Common/system/PdfTrunImage.cs
  17. 21
    20
      Common/system/PrimaryScreen.cs
  18. 11
    4
      Common/system/SplashScreen.cs
  19. 2
    0
      Common/system/XmlUtilHelper.cs
  20. 0
    4
      Common/system/ZJClippingBorder.cs
  21. 1
    7
      XHWK.Model/ComboBoxBean.cs
  22. 1
    7
      XHWK.Model/Model_App.cs
  23. 2
    8
      XHWK.Model/Model_Canvas.cs
  24. 1
    5
      XHWK.Model/Model_DirectorList.cs
  25. 2
    8
      XHWK.Model/Model_DrawData.cs
  26. 2
    7
      XHWK.Model/Model_Page.cs
  27. 1
    7
      XHWK.Model/Model_ResourceAdd.cs
  28. 4
    10
      XHWK.Model/Model_ResourceAddTwo.cs
  29. 2
    8
      XHWK.Model/Model_Screenshot.cs
  30. 1
    7
      XHWK.Model/Model_TsubjectbookList.cs
  31. 2
    5
      XHWK.Model/Model_Video.cs
  32. 1
    7
      XHWK.Model/ResultVo.cs
  33. 4
    7
      XHWK.Model/ViewModel.cs
  34. 9
    7
      XHWK.WKTool/App.config
  35. 31
    10
      XHWK.WKTool/App.cs
  36. 3
    12
      XHWK.WKTool/AppUpdateWin.xaml.cs
  37. 3
    2
      XHWK.WKTool/Controls/MainImage.cs
  38. 52
    30
      XHWK.WKTool/CountdownWindow.xaml.cs
  39. 31
    21
      XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs
  40. 28
    21
      XHWK.WKTool/DAL/DAL_Upload.cs
  41. 36
    35
      XHWK.WKTool/DAL/Interface.cs
  42. 1
    7
      XHWK.WKTool/DAL/ResultVo.cs
  43. 12
    8
      XHWK.WKTool/FileDirectoryWindow.xaml.cs
  44. 7
    2
      XHWK.WKTool/JieTuWindow.xaml.cs
  45. 1
    13
      XHWK.WKTool/LoadDialog.xaml.cs
  46. 9
    8
      XHWK.WKTool/LoginWindow.xaml.cs
  47. 8
    19
      XHWK.WKTool/MessageWindow.xaml.cs
  48. 6
    12
      XHWK.WKTool/MyLicense.cs
  49. 18
    21
      XHWK.WKTool/PracticeWindow.xaml.cs
  50. 10
    21
      XHWK.WKTool/PrintWindow.xaml.cs
  51. 1
    12
      XHWK.WKTool/PromptWindow.xaml.cs
  52. 2
    2
      XHWK.WKTool/Properties/AssemblyInfo.cs
  53. 58
    48
      XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs
  54. 25
    30
      XHWK.WKTool/UploadWindow.xaml.cs
  55. 461
    368
      XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs
  56. 0
    1
      XHWK.WKTool/XHWK.WKTool.csproj
  57. 0
    51
      XHWK.WKTool/ZConfig.cs

+ 15
- 14
Common/AESHelper.cs Целия файл

@@ -1,9 +1,6 @@
1 1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4 2
 using System.Security.Cryptography;
5 3
 using System.Text;
6
-using System.Threading.Tasks;
7 4
 
8 5
 namespace Common
9 6
 {
@@ -21,17 +18,19 @@ namespace Common
21 18
         /// </summary>
22 19
         /// <param name="content">Need encrypted string</param>
23 20
         /// <returns>Encrypted 16 hex string</returns>
24
-        public static string AESEncrypt(String Data)
21
+        public static string AESEncrypt(string Data)
25 22
         {
26 23
             string key = QrcodeLoginKey.PadRight(16, '0');
27 24
             // 256-AES key      
28 25
             byte[] keyArray = UTF8Encoding.ASCII.GetBytes(key);
29 26
             byte[] toEncryptArray = UTF8Encoding.ASCII.GetBytes(Data);
30 27
 
31
-            RijndaelManaged rDel = new RijndaelManaged();
32
-            rDel.Key = keyArray;
33
-            rDel.Mode = CipherMode.ECB;
34
-            rDel.Padding = PaddingMode.PKCS7;
28
+            RijndaelManaged rDel = new RijndaelManaged
29
+            {
30
+                Key = keyArray,
31
+                Mode = CipherMode.ECB,
32
+                Padding = PaddingMode.PKCS7
33
+            };
35 34
 
36 35
             ICryptoTransform cTransform = rDel.CreateEncryptor();
37 36
             byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0,
@@ -45,17 +44,19 @@ namespace Common
45 44
         /// </summary>
46 45
         /// <param name="hexString">Encrypted 16 hex string</param>
47 46
         /// <returns>Decrypted string</returns>
48
-        public static string AESDecrypt(String hexString)
47
+        public static string AESDecrypt(string hexString)
49 48
         {
50 49
             string key = QrcodeLoginKey.PadRight(16, '0');
51 50
             // 256-AES key      
52 51
             byte[] keyArray = UTF8Encoding.ASCII.GetBytes(key);
53 52
             byte[] toEncryptArray = HexStringToBytes(hexString);
54 53
 
55
-            RijndaelManaged rDel = new RijndaelManaged();
56
-            rDel.Key = keyArray;
57
-            rDel.Mode = CipherMode.ECB;
58
-            rDel.Padding = PaddingMode.PKCS7;
54
+            RijndaelManaged rDel = new RijndaelManaged
55
+            {
56
+                Key = keyArray,
57
+                Mode = CipherMode.ECB,
58
+                Padding = PaddingMode.PKCS7
59
+            };
59 60
 
60 61
             ICryptoTransform cTransform = rDel.CreateDecryptor();
61 62
             byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0,
@@ -87,7 +88,7 @@ namespace Common
87 88
         /// </summary>
88 89
         /// <param name="hexString">16 hex string</param>
89 90
         /// <returns>byte array</returns>
90
-        public static byte[] HexStringToBytes(String hexString)
91
+        public static byte[] HexStringToBytes(string hexString)
91 92
         {
92 93
             if (hexString == null || hexString.Equals(""))
93 94
             {

+ 12
- 12
Common/Model/DownloadInfoModel.cs Целия файл

@@ -19,8 +19,8 @@ namespace Common.Model
19 19
         /// </summary>
20 20
         public int taskCount
21 21
         {
22
-            get { return _taskCount; }
23
-            set { _taskCount = value; }
22
+            get => _taskCount;
23
+            set => _taskCount = value;
24 24
         }
25 25
         /// <summary>
26 26
         /// 保存的临时文件名
@@ -38,8 +38,8 @@ namespace Common.Model
38 38
         /// </summary>
39 39
         public bool isNewTask
40 40
         {
41
-            get { return _isNewTask; }
42
-            set { _isNewTask = value; }
41
+            get => _isNewTask;
42
+            set => _isNewTask = value;
43 43
         }
44 44
         /// <summary>
45 45
         /// 是否重新下载
@@ -51,8 +51,8 @@ namespace Common.Model
51 51
         /// </summary>
52 52
         public bool isReStart
53 53
         {
54
-            get { return _isReStart; }
55
-            set { _isReStart = value; }
54
+            get => _isReStart;
55
+            set => _isReStart = value;
56 56
         }
57 57
         /// <summary>
58 58
         /// 任务总大小
@@ -72,8 +72,8 @@ namespace Common.Model
72 72
         /// </summary>
73 73
         public string method
74 74
         {
75
-            get { return _method; }
76
-            set { _method = value; }
75
+            get => _method;
76
+            set => _method = value;
77 77
         }
78 78
         /// <summary>
79 79
         /// 文件名
@@ -88,7 +88,7 @@ namespace Common.Model
88 88
         /// </summary>
89 89
         public List<string> downloadUrlList
90 90
         {
91
-            get { return _downloadUrlList; }
91
+            get => _downloadUrlList;
92 92
 
93 93
             set
94 94
             {
@@ -118,8 +118,8 @@ namespace Common.Model
118 118
         /// </summary>
119 119
         public bool IsSupportMultiThreading
120 120
         {
121
-            get { return _IsSupportMultiThreading; }
122
-            set { _IsSupportMultiThreading = value; }
121
+            get => _IsSupportMultiThreading;
122
+            set => _IsSupportMultiThreading = value;
123 123
         }
124 124
         /// <summary>
125 125
         /// 线程任务列表
@@ -153,7 +153,7 @@ namespace Common.Model
153 153
         /// <summary>
154 154
         /// 分片的总大小
155 155
         /// </summary>
156
-        public long count { get { return this.toIndex - this.fromIndex + 1; } }
156
+        public long count => toIndex - fromIndex + 1;
157 157
     }
158 158
 
159 159
     /// <summary>

+ 35
- 26
Common/system/BlackboardNew.cs Целия файл

@@ -1,8 +1,6 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6 4
 using System.Windows;
7 5
 using System.Windows.Controls;
8 6
 using System.Windows.Ink;
@@ -69,7 +67,10 @@ namespace Common.system
69 67
         /// 笔粗细
70 68
         /// </summary>
71 69
         private readonly int pensize = 3;
72
-        private int undoOrRedo = 0; //是否在进行撤销恢复操作
70
+        /// <summary>
71
+        /// 是否在进行撤销恢复操作
72
+        /// </summary>
73
+        private int undoOrRedo = 0;
73 74
         /// <summary>
74 75
         /// 笔颜色
75 76
         /// </summary>
@@ -91,7 +92,8 @@ namespace Common.system
91 92
         {
92 93
             init(canvas, _pencolor);
93 94
         }
94
-        DrawingAttributes drawingAttributes;
95
+
96
+        private DrawingAttributes drawingAttributes;
95 97
         private void init(InkCanvas canvas, Color _pencolor)
96 98
         {
97 99
             m_canvas = canvas;
@@ -102,7 +104,7 @@ namespace Common.system
102 104
             if (canvas != null)
103 105
             {
104 106
                 canvas.EditingMode = InkCanvasEditingMode.Ink;
105
-                 drawingAttributes = new DrawingAttributes();
107
+                drawingAttributes = new DrawingAttributes();
106 108
                 canvas.DefaultDrawingAttributes = drawingAttributes;
107 109
                 drawingAttributes.Width = pensize;
108 110
                 drawingAttributes.Height = pensize;
@@ -205,7 +207,7 @@ namespace Common.system
205 207
         }
206 208
 
207 209
         // public方法 笔
208
-        public void change_pen(Color _color) 
210
+        public void change_pen(Color _color)
209 211
         {
210 212
             //this.type = ZPenType.Pen;
211 213
             DrawingAttributes drawingAttributes = new DrawingAttributes();
@@ -321,7 +323,7 @@ namespace Common.system
321 323
                 }
322 324
 
323 325
                 ZBBPage page = strokes_page_all[pagenum];
324
-                if (page != null&& page.lines.Count>0)
326
+                if (page != null && page.lines.Count > 0)
325 327
                 {
326 328
                     if (page.lines.Last().lines_curr.Count > 0)
327 329
                     {
@@ -335,9 +337,11 @@ namespace Common.system
335 337
                     StrokeCollection strokes = new StrokeCollection();
336 338
                     StylusPointCollection stylusPoints = new StylusPointCollection();
337 339
                     System.Windows.Input.StylusPointDescription stylusPointDescription = new StylusPointDescription();
338
-                    StylusPoint stylusPoint = new StylusPoint();
339
-                    stylusPoint.X = 580;
340
-                    stylusPoint.Y = 212;
340
+                    StylusPoint stylusPoint = new StylusPoint
341
+                    {
342
+                        X = 580,
343
+                        Y = 212
344
+                    };
341 345
                     stylusPoints.Add(stylusPoint);
342 346
                     Stroke stroke = new Stroke(stylusPoints);
343 347
 
@@ -350,10 +354,11 @@ namespace Common.system
350 354
                 }
351 355
             }
352 356
         }
353
-        StylusPointCollection stylusPoints = new StylusPointCollection();
354
-        StylusPoint stylusPoint = new StylusPoint();
355
-        Stroke stroke;
356
-        bool isFirst = true;
357
+
358
+        private StylusPointCollection stylusPoints = new StylusPointCollection();
359
+        private StylusPoint stylusPoint = new StylusPoint();
360
+        private Stroke stroke;
361
+        private bool isFirst = true;
357 362
         public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
358 363
         {
359 364
             if (_new)
@@ -393,12 +398,14 @@ namespace Common.system
393 398
                     if (stylusPoints.Count > 1)
394 399
                     {
395 400
                         stroke = new Stroke(stylusPoints);
396
-                        drawingAttributes = new DrawingAttributes();
397
-                        drawingAttributes.Color = _color;
398
-                        drawingAttributes.Width = _size*4.5;
399
-                        drawingAttributes.Height = _size * 4.5;
400
-                        drawingAttributes.FitToCurve = true;
401
-                        drawingAttributes.IgnorePressure = false;
401
+                        drawingAttributes = new DrawingAttributes
402
+                        {
403
+                            Color = _color,
404
+                            Width = _size * 4.5,
405
+                            Height = _size * 4.5,
406
+                            FitToCurve = true,
407
+                            IgnorePressure = false
408
+                        };
402 409
                         stroke.DrawingAttributes = drawingAttributes;
403 410
                         m_canvas.Strokes.Add(stroke);
404 411
                         isFirst = false;
@@ -412,12 +419,14 @@ namespace Common.system
412 419
                         stylusPoint.Y = _y;
413 420
                         stylusPoints.Add(stylusPoint);
414 421
                         stroke = new Stroke(stylusPoints);
415
-                        drawingAttributes = new DrawingAttributes();
416
-                        drawingAttributes.Color = _color;
417
-                        drawingAttributes.Width = _size * 4.5;
418
-                        drawingAttributes.Height = _size * 4.5;
419
-                        drawingAttributes.FitToCurve = true;
420
-                        drawingAttributes.IgnorePressure = false;
422
+                        drawingAttributes = new DrawingAttributes
423
+                        {
424
+                            Color = _color,
425
+                            Width = _size * 4.5,
426
+                            Height = _size * 4.5,
427
+                            FitToCurve = true,
428
+                            IgnorePressure = false
429
+                        };
421 430
                         stroke.DrawingAttributes = drawingAttributes;
422 431
                         m_canvas.Strokes[m_canvas.Strokes.Count - 1] = stroke;
423 432
                     }

+ 83
- 19
Common/system/CLeopardZip.cs Целия файл

@@ -42,9 +42,11 @@ namespace Common.system
42 42
 
43 43
                     byte[] buffer = new byte[fs.Length];
44 44
                     fs.Read(buffer, 0, buffer.Length);
45
-                    ent = new ZipEntry(Path.Combine(parentFolderName, Path.GetFileName(folderToZip) + "/" + Path.GetFileName(file)));
46
-                    ent.DateTime = DateTime.Now;
47
-                    ent.Size = fs.Length;
45
+                    ent = new ZipEntry(Path.Combine(parentFolderName, Path.GetFileName(folderToZip) + "/" + Path.GetFileName(file)))
46
+                    {
47
+                        DateTime = DateTime.Now,
48
+                        Size = fs.Length
49
+                    };
48 50
 
49 51
                     fs.Close();
50 52
 
@@ -78,8 +80,12 @@ namespace Common.system
78 80
 
79 81
             folders = Directory.GetDirectories(folderToZip);
80 82
             foreach (string folder in folders)
83
+            {
81 84
                 if (!ZipDirectory(folder, zipStream, folderToZip))
85
+                {
82 86
                     return false;
87
+                }
88
+            }
83 89
 
84 90
             return result;
85 91
         }
@@ -95,11 +101,16 @@ namespace Common.system
95 101
         {
96 102
             bool result = false;
97 103
             if (!Directory.Exists(folderToZip))
104
+            {
98 105
                 return result;
106
+            }
99 107
 
100 108
             ZipOutputStream zipStream = new ZipOutputStream(File.Create(zipedFile));
101 109
             zipStream.SetLevel(6);
102
-            if (!string.IsNullOrEmpty(password)) zipStream.Password = password;
110
+            if (!string.IsNullOrEmpty(password))
111
+            {
112
+                zipStream.Password = password;
113
+            }
103 114
 
104 115
             result = ZipDirectory(folderToZip, zipStream, "");
105 116
 
@@ -136,7 +147,9 @@ namespace Common.system
136 147
             ZipEntry ent = null;
137 148
 
138 149
             if (!File.Exists(fileToZip))
150
+            {
139 151
                 return false;
152
+            }
140 153
 
141 154
             try
142 155
             {
@@ -147,7 +160,11 @@ namespace Common.system
147 160
 
148 161
                 fs = File.Create(zipedFile);
149 162
                 zipStream = new ZipOutputStream(fs);
150
-                if (!string.IsNullOrEmpty(password)) zipStream.Password = password;
163
+                if (!string.IsNullOrEmpty(password))
164
+                {
165
+                    zipStream.Password = password;
166
+                }
167
+
151 168
                 ent = new ZipEntry(Path.GetFileName(fileToZip));
152 169
                 zipStream.PutNextEntry(ent);
153 170
                 zipStream.SetLevel(6);
@@ -205,9 +222,13 @@ namespace Common.system
205 222
         {
206 223
             bool result = false;
207 224
             if (Directory.Exists(fileToZip))
225
+            {
208 226
                 result = ZipDirectory(fileToZip, zipedFile, password);
227
+            }
209 228
             else if (File.Exists(fileToZip))
229
+            {
210 230
                 result = ZipFile(fileToZip, zipedFile, password);
231
+            }
211 232
 
212 233
             return result;
213 234
         }
@@ -245,15 +266,23 @@ namespace Common.system
245 266
             string fileName;
246 267
 
247 268
             if (!File.Exists(fileToUnZip))
269
+            {
248 270
                 return false;
271
+            }
249 272
 
250 273
             if (!Directory.Exists(zipedFolder))
274
+            {
251 275
                 Directory.CreateDirectory(zipedFolder);
276
+            }
252 277
 
253 278
             try
254 279
             {
255 280
                 zipStream = new ZipInputStream(File.OpenRead(fileToUnZip));
256
-                if (!string.IsNullOrEmpty(password)) zipStream.Password = password;
281
+                if (!string.IsNullOrEmpty(password))
282
+                {
283
+                    zipStream.Password = password;
284
+                }
285
+
257 286
                 while ((ent = zipStream.GetNextEntry()) != null)
258 287
                 {
259 288
                     if (!string.IsNullOrEmpty(ent.Name))
@@ -274,9 +303,13 @@ namespace Common.system
274 303
                         {
275 304
                             size = zipStream.Read(data, 0, data.Length);
276 305
                             if (size > 0)
306
+                            {
277 307
                                 fs.Write(data, 0, data.Length);
308
+                            }
278 309
                             else
310
+                            {
279 311
                                 break;
312
+                            }
280 313
                         }
281 314
                     }
282 315
                 }
@@ -351,7 +384,9 @@ namespace Common.system
351 384
                         pathToZip = theEntry.Name;
352 385
 
353 386
                         if (pathToZip != "")
387
+                        {
354 388
                             directoryName = Path.GetDirectoryName(pathToZip) + "\\";
389
+                        }
355 390
 
356 391
                         string fileName = Path.GetFileName(pathToZip);
357 392
 
@@ -372,9 +407,13 @@ namespace Common.system
372 407
                                             size = zipfiles.Read(data, 0, data.Length);
373 408
 
374 409
                                             if (size > 0)
410
+                                            {
375 411
                                                 streamWriter.Write(data, 0, size);
412
+                                            }
376 413
                                             else
414
+                                            {
377 415
                                                 break;
416
+                                            }
378 417
                                         }
379 418
                                         streamWriter.Close();
380 419
                                     }
@@ -426,13 +465,19 @@ namespace Common.system
426 465
                     //  方法二,将文件分批读入缓冲区    
427 466
                     byte[] data = new byte[2048];
428 467
                     int size = 2048;
429
-                    ZipEntry entry = new ZipEntry(Path.GetFileName(file.Name));
430
-                    entry.DateTime = (file.CreationTime > file.LastWriteTime ? file.LastWriteTime : file.CreationTime);
468
+                    ZipEntry entry = new ZipEntry(Path.GetFileName(file.Name))
469
+                    {
470
+                        DateTime = (file.CreationTime > file.LastWriteTime ? file.LastWriteTime : file.CreationTime)
471
+                    };
431 472
                     s.PutNextEntry(entry);
432 473
                     while (true)
433 474
                     {
434 475
                         size = fs.Read(data, 0, size);
435
-                        if (size <= 0) break;
476
+                        if (size <= 0)
477
+                        {
478
+                            break;
479
+                        }
480
+
436 481
                         s.Write(data, 0, size);
437 482
                     }
438 483
                     fs.Close();
@@ -465,13 +510,19 @@ namespace Common.system
465 510
                 //  方法二,将文件分批读入缓冲区    
466 511
                 byte[] data = new byte[2048];
467 512
                 int size = 2048;
468
-                ZipEntry entry = new ZipEntry(Path.GetFileName(file.Name));
469
-                entry.DateTime = (file.CreationTime > file.LastWriteTime ? file.LastWriteTime : file.CreationTime);
513
+                ZipEntry entry = new ZipEntry(Path.GetFileName(file.Name))
514
+                {
515
+                    DateTime = (file.CreationTime > file.LastWriteTime ? file.LastWriteTime : file.CreationTime)
516
+                };
470 517
                 s.PutNextEntry(entry);
471 518
                 while (true)
472 519
                 {
473 520
                     size = fs.Read(data, 0, size);
474
-                    if (size <= 0) break;
521
+                    if (size <= 0)
522
+                    {
523
+                        break;
524
+                    }
525
+
475 526
                     s.Write(data, 0, size);
476 527
                 }
477 528
                 fs.Close();
@@ -515,9 +566,11 @@ namespace Common.system
515 566
                     FileStream fs = File.OpenRead(item.Key.ToString());
516 567
                     byte[] buffer = new byte[fs.Length];
517 568
                     fs.Read(buffer, 0, buffer.Length);
518
-                    ZipEntry entry = new ZipEntry(item.Key.Substring(dirPath.Length));
519
-                    entry.DateTime = item.Value;
520
-                    entry.Size = fs.Length;
569
+                    ZipEntry entry = new ZipEntry(item.Key.Substring(dirPath.Length))
570
+                    {
571
+                        DateTime = item.Value,
572
+                        Size = fs.Length
573
+                    };
521 574
                     fs.Close();
522 575
                     crc.Reset();
523 576
                     crc.Update(buffer);
@@ -587,7 +640,11 @@ namespace Common.system
587 640
         {
588 641
             //string directoryName = Path.GetDirectoryName(targetPath + "//") + "//";    
589 642
             string directoryName = targetPath;
590
-            if (!Directory.Exists(directoryName)) Directory.CreateDirectory(directoryName);//生成解压目录    
643
+            if (!Directory.Exists(directoryName))
644
+            {
645
+                Directory.CreateDirectory(directoryName);//生成解压目录    
646
+            }
647
+
591 648
             string CurrentDirectory = directoryName;
592 649
             byte[] data = new byte[2048];
593 650
             int size = 2048;
@@ -598,11 +655,14 @@ namespace Common.system
598 655
                 {
599 656
                     if (theEntry.IsDirectory)
600 657
                     {// 该结点是目录    
601
-                        if (!Directory.Exists(CurrentDirectory + theEntry.Name)) Directory.CreateDirectory(CurrentDirectory + theEntry.Name);
658
+                        if (!Directory.Exists(CurrentDirectory + theEntry.Name))
659
+                        {
660
+                            Directory.CreateDirectory(CurrentDirectory + theEntry.Name);
661
+                        }
602 662
                     }
603 663
                     else
604 664
                     {
605
-                        if (theEntry.Name != String.Empty)
665
+                        if (theEntry.Name != string.Empty)
606 666
                         {
607 667
                             //  检查多级目录是否存在  
608 668
                             if (theEntry.Name.Contains("\\"))
@@ -620,7 +680,11 @@ namespace Common.system
620 680
                                 while (true)
621 681
                                 {
622 682
                                     size = s.Read(data, 0, data.Length);
623
-                                    if (size <= 0) break;
683
+                                    if (size <= 0)
684
+                                    {
685
+                                        break;
686
+                                    }
687
+
624 688
                                     streamWriter.Write(data, 0, size);
625 689
                                 }
626 690
                                 streamWriter.Close();

+ 31
- 19
Common/system/CameraHelper.cs Целия файл

@@ -23,14 +23,8 @@ namespace Common.system
23 23
         /// </summary>
24 24
         public static FilterInfoCollection CameraDevices
25 25
         {
26
-            get
27
-            {
28
-                return _cameraDevices;
29
-            }
30
-            set
31
-            {
32
-                _cameraDevices = value;
33
-            }
26
+            get => _cameraDevices;
27
+            set => _cameraDevices = value;
34 28
         }
35 29
         /// <summary>
36 30
         /// 指示是否显示摄像头视频画面
@@ -38,8 +32,8 @@ namespace Common.system
38 32
         /// </summary>
39 33
         public static bool IsDisplay
40 34
         {
41
-            get { return _isDisplay; }
42
-            set { _isDisplay = value; }
35
+            get => _isDisplay;
36
+            set => _isDisplay = value;
43 37
         }
44 38
         /// <summary>
45 39
         /// 获取或设置VideoSourcePlayer控件,
@@ -47,7 +41,7 @@ namespace Common.system
47 41
         /// </summary>
48 42
         public static VideoSourcePlayer SourcePlayer
49 43
         {
50
-            get { return sourcePlayer; }
44
+            get => sourcePlayer;
51 45
             set
52 46
             {
53 47
                 if (_isDisplay)
@@ -72,10 +66,20 @@ namespace Common.system
72 66
         /// <returns><see cref="bool"/></returns>
73 67
         public static bool SetCameraDevice(int index)
74 68
         {
75
-            if (!isSet) _isDisplay = false;
69
+            if (!isSet)
70
+            {
71
+                _isDisplay = false;
72
+            }
76 73
             //无设备,返回false
77
-            if (_cameraDevices.Count <= 0 || index < 0) return false;
78
-            if (index > _cameraDevices.Count - 1) return false;
74
+            if (_cameraDevices.Count <= 0 || index < 0)
75
+            {
76
+                return false;
77
+            }
78
+
79
+            if (index > _cameraDevices.Count - 1)
80
+            {
81
+                return false;
82
+            }
79 83
             // 设定初始视频设备
80 84
             div = new VideoCaptureDevice(_cameraDevices[index].MonikerString);
81 85
             sourcePlayer.VideoSource = div;
@@ -91,7 +95,11 @@ namespace Common.system
91 95
         /// <returns>如果保存成功,则返回完整路径,否则为 null</returns>
92 96
         public static string CaptureImage(string filePath, string fileName = null)
93 97
         {
94
-            if (sourcePlayer.VideoSource == null) return null;
98
+            if (sourcePlayer.VideoSource == null)
99
+            {
100
+                return null;
101
+            }
102
+
95 103
             if (!Directory.Exists(filePath))
96 104
             {
97 105
                 Directory.CreateDirectory(filePath);
@@ -99,9 +107,13 @@ namespace Common.system
99 107
             try
100 108
             {
101 109
                 Image bitmap = sourcePlayer.GetCurrentVideoFrame();
102
-                if(bitmap!=null)
110
+                if (bitmap != null)
103 111
                 {
104
-                    if (fileName == null) fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
112
+                    if (fileName == null)
113
+                    {
114
+                        fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
115
+                    }
116
+
105 117
                     string fullPath = Path.Combine(filePath, fileName + "-cap.jpg");
106 118
                     bitmap.Save(fullPath, ImageFormat.Jpeg);
107 119
                     bitmap.Dispose();
@@ -109,9 +121,9 @@ namespace Common.system
109 121
                 }
110 122
                 return null;
111 123
             }
112
-            catch (Exception e)
124
+            catch (Exception)
113 125
             {
114
-          
126
+
115 127
                 return null;
116 128
             }
117 129
         }

+ 3
- 3
Common/system/DataConvertCommon.cs Целия файл

@@ -19,9 +19,9 @@
19 19
         public static TChild ParentClassCopy<TParent, TChild>(TParent parent) where TChild : TParent, new()
20 20
         {
21 21
             TChild child = new TChild();
22
-            var ParentType = typeof(TParent);
23
-            var Properties = ParentType.GetProperties();
24
-            foreach (var Propertie in Properties)
22
+            System.Type ParentType = typeof(TParent);
23
+            System.Reflection.PropertyInfo[] Properties = ParentType.GetProperties();
24
+            foreach (System.Reflection.PropertyInfo Propertie in Properties)
25 25
             {
26 26
                 //循环遍历属性
27 27
                 if (Propertie.CanRead && Propertie.CanWrite)

+ 69
- 46
Common/system/DownloadManager.cs Целия файл

@@ -50,7 +50,7 @@ namespace Common.system
50 50
         /// </summary>
51 51
         public void Stop()
52 52
         {
53
-            this.isRun = false;
53
+            isRun = false;
54 54
             dls.ForEach(dl => dl.Stop());
55 55
             OnStopHandler();
56 56
         }
@@ -59,7 +59,7 @@ namespace Common.system
59 59
         /// </summary>
60 60
         public void Start()
61 61
         {
62
-            this.dlInfo.isReStart = false;
62
+            dlInfo.isReStart = false;
63 63
             WorkStart();
64 64
         }
65 65
         /// <summary>
@@ -67,7 +67,7 @@ namespace Common.system
67 67
         /// </summary>
68 68
         public void ReStart()
69 69
         {
70
-            this.dlInfo.isReStart = true;
70
+            dlInfo.isReStart = true;
71 71
             WorkStart();
72 72
         }
73 73
         /// <summary>
@@ -79,16 +79,22 @@ namespace Common.system
79 79
             {
80 80
                 if (dlInfo.isReStart)
81 81
                 {
82
-                    this.Stop();
82
+                    Stop();
83 83
                 }
84 84
 
85 85
                 while (dls.Where(dl => !dl.isStopped).Count() > 0)
86 86
                 {
87
-                    if (dlInfo.isReStart) Thread.Sleep(100);
88
-                    else return;
87
+                    if (dlInfo.isReStart)
88
+                    {
89
+                        Thread.Sleep(100);
90
+                    }
91
+                    else
92
+                    {
93
+                        return;
94
+                    }
89 95
                 }
90 96
 
91
-                this.isRun = true;
97
+                isRun = true;
92 98
                 OnStartHandler();
93 99
                 //首次任务或者不支持断点续传的进入
94 100
                 if (dlInfo.isNewTask || (!dlInfo.isNewTask && !dlInfo.IsSupportMultiThreading))
@@ -96,17 +102,21 @@ namespace Common.system
96 102
                     try
97 103
                     {
98 104
                         //第一次请求获取一小块数据,根据返回的情况判断是否支持断点续传
99
-                        using (var rsp = HttpHelper.Download(dlInfo.downloadUrlList[0], 0, 0, dlInfo.method))
105
+                        using (System.Net.WebResponse rsp = HttpHelper.Download(dlInfo.downloadUrlList[0], 0, 0, dlInfo.method))
100 106
                         {
101 107
 
102 108
                             //获取文件名,如果包含附件名称则取下附件,否则从url获取名称
103
-                            var Disposition = rsp.Headers["Content-Disposition"];
109
+                            string Disposition = rsp.Headers["Content-Disposition"];
104 110
                             try
105 111
                             {
106 112
                                 if (Disposition != null)
113
+                                {
107 114
                                     dlInfo.fileName = Disposition.Split('=')[1];
115
+                                }
108 116
                                 else
117
+                                {
109 118
                                     dlInfo.fileName = Path.GetFileName(rsp.ResponseUri.AbsolutePath);
119
+                                }
110 120
                             }
111 121
                             catch (Exception)//无法获取文件名时  使用传入保存名称
112 122
                             {
@@ -116,7 +126,7 @@ namespace Common.system
116 126
                             //默认给流总数
117 127
                             dlInfo.count = rsp.ContentLength;
118 128
                             //尝试获取 Content-Range 头部,不为空说明支持断点续传
119
-                            var contentRange = rsp.Headers["Content-Range"];
129
+                            string contentRange = rsp.Headers["Content-Range"];
120 130
                             if (contentRange != null)
121 131
                             {
122 132
                                 //支持断点续传的话,就取range 这里的总数
@@ -155,11 +165,11 @@ namespace Common.system
155 165
                     StartTask(dlInfo);
156 166
 
157 167
                     //等待合并
158
-                    while (this.dls.Where(td => !td.isFinish).Count() > 0 && this.isRun)
168
+                    while (dls.Where(td => !td.isFinish).Count() > 0 && isRun)
159 169
                     {
160 170
                         Thread.Sleep(100);
161 171
                     }
162
-                    if ((this.dls.Where(td => !td.isFinish).Count() == 0))
172
+                    if ((dls.Where(td => !td.isFinish).Count() == 0))
163 173
                     {
164 174
 
165 175
                         CombineFiles(dlInfo);
@@ -178,14 +188,14 @@ namespace Common.system
178 188
             string realFilePath = GetRealFileName(dlInfo);
179 189
 
180 190
             //合并数据
181
-            byte[] buffer = new Byte[2048];
191
+            byte[] buffer = new byte[2048];
182 192
             int length = 0;
183
-            using (var fileStream = File.Open(realFilePath, FileMode.CreateNew))
193
+            using (FileStream fileStream = File.Open(realFilePath, FileMode.CreateNew))
184 194
             {
185 195
                 for (int i = 0; i < dlInfo.TaskInfoList.Count; i++)
186 196
                 {
187
-                    var tempFile = dlInfo.TaskInfoList[i].filePath;
188
-                    using (var tempStream = File.Open(tempFile, FileMode.Open))
197
+                    string tempFile = dlInfo.TaskInfoList[i].filePath;
198
+                    using (FileStream tempStream = File.Open(tempFile, FileMode.Open))
189 199
                     {
190 200
                         while ((length = tempStream.Read(buffer, 0, buffer.Length)) > 0)
191 201
                         {
@@ -205,8 +215,8 @@ namespace Common.system
205 215
         private static string GetRealFileName(DownloadInfoModel dlInfo)
206 216
         {
207 217
             //创建正式文件名,如果已存在则加数字序号创建,避免覆盖
208
-            var fileIndex = 0;
209
-            var realFilePath = Path.Combine(dlInfo.saveDir, dlInfo.saveFileName);
218
+            int fileIndex = 0;
219
+            string realFilePath = Path.Combine(dlInfo.saveDir, dlInfo.saveFileName);
210 220
             while (File.Exists(realFilePath))
211 221
             {
212 222
                 realFilePath = Path.Combine(dlInfo.saveDir, string.Format("{0}_{1}", fileIndex++, dlInfo.fileName));
@@ -217,12 +227,12 @@ namespace Common.system
217 227
 
218 228
         private void StartTask(DownloadInfoModel dlInfo)
219 229
         {
220
-            this.dls = new List<DownloadService>();
230
+            dls = new List<DownloadService>();
221 231
             if (dlInfo.TaskInfoList != null)
222 232
             {
223
-                foreach (var item in dlInfo.TaskInfoList)
233
+                foreach (TaskInfoModel item in dlInfo.TaskInfoList)
224 234
                 {
225
-                    var dl = new DownloadService();
235
+                    DownloadService dl = new DownloadService();
226 236
                     dl.OnDownload += OnDownloadHandler;
227 237
                     dl.OnDisconnect += OnDisconnectHandler;
228 238
                     dls.Add(dl);
@@ -245,17 +255,24 @@ namespace Common.system
245 255
         /// <param name="dlInfo"></param>
246 256
         private void GetTaskInfo(DownloadInfoModel dlInfo)
247 257
         {
248
-            var pieceSize = (dlInfo.count) / dlInfo.taskCount;
258
+            long pieceSize = (dlInfo.count) / dlInfo.taskCount;
249 259
             dlInfo.TaskInfoList = new List<TaskInfoModel>();
250
-            var rand = new Random();
251
-            var urlIndex = 0;
260
+            Random rand = new Random();
261
+            int urlIndex = 0;
252 262
             for (int i = 0; i <= dlInfo.taskCount + 1; i++)
253 263
             {
254
-                var from = (i * pieceSize);
264
+                long from = (i * pieceSize);
255 265
 
256
-                if (from >= dlInfo.count) break;
257
-                var to = from + pieceSize;
258
-                if (to >= dlInfo.count) to = dlInfo.count;
266
+                if (from >= dlInfo.count)
267
+                {
268
+                    break;
269
+                }
270
+
271
+                long to = from + pieceSize;
272
+                if (to >= dlInfo.count)
273
+                {
274
+                    to = dlInfo.count;
275
+                }
259 276
 
260 277
                 dlInfo.TaskInfoList.Add(
261 278
                     new TaskInfoModel
@@ -267,7 +284,10 @@ namespace Common.system
267 284
                         fromIndex = from,
268 285
                         toIndex = to
269 286
                     });
270
-                if (urlIndex >= dlInfo.downloadUrlList.Count) urlIndex = 0;
287
+                if (urlIndex >= dlInfo.downloadUrlList.Count)
288
+                {
289
+                    urlIndex = 0;
290
+                }
271 291
             }
272 292
         }
273 293
 
@@ -280,17 +300,17 @@ namespace Common.system
280 300
         {
281 301
             try
282 302
             {
283
-                using (var writer = File.Open(filePath, FileMode.Append))
303
+                using (FileStream writer = File.Open(filePath, FileMode.Append))
284 304
                 {
285 305
                     using (stream)
286 306
                     {
287
-                        var repeatTimes = 0;
307
+                        int repeatTimes = 0;
288 308
                         byte[] buffer = new byte[1024];
289
-                        var length = 0;
290
-                        while ((length = stream.Read(buffer, 0, buffer.Length)) > 0 && this.isRun)
309
+                        int length = 0;
310
+                        while ((length = stream.Read(buffer, 0, buffer.Length)) > 0 && isRun)
291 311
                         {
292 312
                             writer.Write(buffer, 0, length);
293
-                            this.fromIndex += length;
313
+                            fromIndex += length;
294 314
                             if (repeatTimes % 5 == 0)
295 315
                             {
296 316
                                 writer.Flush();//一定大小就刷一次缓冲区
@@ -316,7 +336,7 @@ namespace Common.system
316 336
         {
317 337
             new Action(() =>
318 338
             {
319
-                this.OnStart.Invoke();
339
+                OnStart.Invoke();
320 340
             }).BeginInvoke(null, null);
321 341
         }
322 342
         /// <summary>
@@ -326,7 +346,7 @@ namespace Common.system
326 346
         {
327 347
             new Action(() =>
328 348
             {
329
-                this.OnStop.Invoke();
349
+                OnStop.Invoke();
330 350
             }).BeginInvoke(null, null);
331 351
         }
332 352
         /// <summary>
@@ -338,10 +358,10 @@ namespace Common.system
338 358
             {
339 359
                 for (int i = 0; i < dlInfo.TaskInfoList.Count; i++)
340 360
                 {
341
-                    var tempFile = dlInfo.TaskInfoList[i].filePath;
361
+                    string tempFile = dlInfo.TaskInfoList[i].filePath;
342 362
                     File.Delete(tempFile);
343 363
                 }
344
-                this.OnFinsh.Invoke(dlInfo.saveFileName);
364
+                OnFinsh.Invoke(dlInfo.saveFileName);
345 365
             }).BeginInvoke(null, null);
346 366
         }
347 367
         /// <summary>
@@ -352,7 +372,7 @@ namespace Common.system
352 372
             new Action(() =>
353 373
             {
354 374
                 long current = GetDownloadLength();
355
-                this.OnDownload.Invoke(current, dlInfo.count, dlInfo.saveFileName);
375
+                OnDownload.Invoke(current, dlInfo.count, dlInfo.saveFileName);
356 376
             }).BeginInvoke(null, null);
357 377
         }
358 378
         /// <summary>
@@ -362,7 +382,7 @@ namespace Common.system
362 382
         {
363 383
             new Action(() =>
364 384
             {
365
-                this.OnDisconnect.Invoke(dlInfo.saveFileName);
385
+                OnDisconnect.Invoke(dlInfo.saveFileName);
366 386
             }).BeginInvoke(null, null);
367 387
         }
368 388
         /// <summary>
@@ -371,18 +391,21 @@ namespace Common.system
371 391
         /// <returns></returns>
372 392
         public long GetDownloadLength()
373 393
         {
374
-            if (dlInfo.IsSupportMultiThreading) return dls.Sum(dl => dl.GetDownloadedCount());
375
-            else return this.fromIndex;
394
+            if (dlInfo.IsSupportMultiThreading)
395
+            {
396
+                return dls.Sum(dl => dl.GetDownloadedCount());
397
+            }
398
+            else
399
+            {
400
+                return fromIndex;
401
+            }
376 402
         }
377 403
 
378 404
         /// <summary>
379 405
         /// 获取保存文件名
380 406
         /// </summary>
381 407
         /// <returns></returns>
382
-        public DownloadInfoModel GetFileInfo
383
-        {
384
-            get { return dlInfo; }
385
-        }
408
+        public DownloadInfoModel GetFileInfo => dlInfo;
386 409
 
387 410
     }
388 411
 }

+ 64
- 44
Common/system/DownloadService.cs Целия файл

@@ -47,12 +47,12 @@ namespace Common.system
47 47
 
48 48
         public long GetDownloadedCount()
49 49
         {
50
-            return this.count - this.toIndex + this.fromIndex - 1;
50
+            return count - toIndex + fromIndex - 1;
51 51
         }
52 52
 
53 53
         public void Stop()
54 54
         {
55
-            this.isRun = false;
55
+            isRun = false;
56 56
         }
57 57
 
58 58
         /// <summary>
@@ -63,53 +63,58 @@ namespace Common.system
63 63
         /// <returns></returns>
64 64
         public bool Start(TaskInfoModel info, bool isReStart)
65 65
         {
66
-            this.downloadUrl = info.downloadUrl;
67
-            this.fromIndex = info.fromIndex;
68
-            this.toIndex = info.toIndex;
69
-            this.method = info.method;
70
-            this.filePath = info.filePath;
71
-            this.count = info.count;
72
-            this.isStopped = false;
73
-            if (File.Exists(this.filePath))
66
+            downloadUrl = info.downloadUrl;
67
+            fromIndex = info.fromIndex;
68
+            toIndex = info.toIndex;
69
+            method = info.method;
70
+            filePath = info.filePath;
71
+            count = info.count;
72
+            isStopped = false;
73
+            if (File.Exists(filePath))
74 74
             {
75 75
                 if (isReStart)
76 76
                 {
77
-                    File.Delete(this.filePath);
78
-                    File.Create(this.filePath).Close();
77
+                    File.Delete(filePath);
78
+                    File.Create(filePath).Close();
79 79
                 }
80 80
             }
81 81
             else
82 82
             {
83
-                File.Create(this.filePath).Close();
83
+                File.Create(filePath).Close();
84 84
             }
85
-            using (var file = File.Open(this.filePath, FileMode.Open))
85
+            using (FileStream file = File.Open(filePath, FileMode.Open))
86 86
             {
87
-                this.fromIndex = info.fromIndex + file.Length;
87
+                fromIndex = info.fromIndex + file.Length;
88 88
             }
89
-            if (this.fromIndex >= this.toIndex)
89
+            if (fromIndex >= toIndex)
90 90
             {
91 91
                 OnFineshHandler();
92
-                this.isFinish = true;
93
-                this.isStopped = true;
92
+                isFinish = true;
93
+                isStopped = true;
94 94
                 return false;
95 95
             }
96 96
             OnStartHandler();
97
-            this.isRun = true;
97
+            isRun = true;
98 98
             new Action(() =>
99 99
             {
100 100
                 WebResponse rsp;
101
-                while (this.fromIndex < this.toIndex && isRun)
101
+                while (fromIndex < toIndex && isRun)
102 102
                 {
103 103
                     long to;
104
-                    if (this.fromIndex + this.size >= this.toIndex - 1)
105
-                        to = this.toIndex - 1;
104
+                    if (fromIndex + size >= toIndex - 1)
105
+                    {
106
+                        to = toIndex - 1;
107
+                    }
106 108
                     else
107
-                        to = this.fromIndex + size;
109
+                    {
110
+                        to = fromIndex + size;
111
+                    }
112
+
108 113
                     try
109 114
                     {
110
-                        using (rsp = HttpHelper.Download(this.downloadUrl, this.fromIndex, to, this.method))
115
+                        using (rsp = HttpHelper.Download(downloadUrl, fromIndex, to, method))
111 116
                         {
112
-                            Save(this.filePath, rsp.GetResponseStream());
117
+                            Save(filePath, rsp.GetResponseStream());
113 118
                         }
114 119
                     }
115 120
                     catch (Exception ex)
@@ -120,11 +125,15 @@ namespace Common.system
120 125
                         return;
121 126
                     }
122 127
                 }
123
-                if (!this.isRun) this.isStopped = true;
124
-                if (this.fromIndex >= this.toIndex)
128
+                if (!isRun)
125 129
                 {
126
-                    this.isFinish = true;
127
-                    this.isStopped = true;
130
+                    isStopped = true;
131
+                }
132
+
133
+                if (fromIndex >= toIndex)
134
+                {
135
+                    isFinish = true;
136
+                    isStopped = true;
128 137
                     OnFineshHandler();
129 138
                 }
130 139
 
@@ -140,17 +149,17 @@ namespace Common.system
140 149
         {
141 150
             try
142 151
             {
143
-                using (var writer = File.Open(filePath, FileMode.Append))
152
+                using (FileStream writer = File.Open(filePath, FileMode.Append))
144 153
                 {
145 154
                     using (stream)
146 155
                     {
147
-                        var repeatTimes = 0;
156
+                        int repeatTimes = 0;
148 157
                         byte[] buffer = new byte[1024];
149
-                        var length = 0;
150
-                        while ((length = stream.Read(buffer, 0, buffer.Length)) > 0 && this.isRun)
158
+                        int length = 0;
159
+                        while ((length = stream.Read(buffer, 0, buffer.Length)) > 0 && isRun)
151 160
                         {
152 161
                             writer.Write(buffer, 0, length);
153
-                            this.fromIndex += length;
162
+                            fromIndex += length;
154 163
                             if (repeatTimes % 5 == 0)
155 164
                             {
156 165
                                 OnDownloadHandler();
@@ -173,8 +182,10 @@ namespace Common.system
173 182
         {
174 183
             new Action(() =>
175 184
             {
176
-                if (this.OnStart != null)
177
-                    this.OnStart.Invoke();
185
+                if (OnStart != null)
186
+                {
187
+                    OnStart.Invoke();
188
+                }
178 189
             }).BeginInvoke(null, null);
179 190
         }
180 191
         /// <summary>
@@ -184,10 +195,15 @@ namespace Common.system
184 195
         {
185 196
             new Action(() =>
186 197
             {
187
-                if (this.OnFinsh != null)
188
-                    this.OnFinsh.Invoke();
189
-                if (this.OnDownload != null)
190
-                    this.OnDownload.Invoke();
198
+                if (OnFinsh != null)
199
+                {
200
+                    OnFinsh.Invoke();
201
+                }
202
+
203
+                if (OnDownload != null)
204
+                {
205
+                    OnDownload.Invoke();
206
+                }
191 207
             }).BeginInvoke(null, null);
192 208
         }
193 209
         /// <summary>
@@ -197,8 +213,10 @@ namespace Common.system
197 213
         {
198 214
             new Action(() =>
199 215
             {
200
-                if (this.OnDownload != null)
201
-                    this.OnDownload.Invoke();
216
+                if (OnDownload != null)
217
+                {
218
+                    OnDownload.Invoke();
219
+                }
202 220
             }).BeginInvoke(null, null);
203 221
         }
204 222
         /// <summary>
@@ -208,8 +226,10 @@ namespace Common.system
208 226
         {
209 227
             new Action(() =>
210 228
             {
211
-                if (this.OnDisconnect != null)
212
-                    this.OnDisconnect.Invoke();
229
+                if (OnDisconnect != null)
230
+                {
231
+                    OnDisconnect.Invoke();
232
+                }
213 233
             }).BeginInvoke(null, null);
214 234
 
215 235
         }

+ 34
- 29
Common/system/FFMpeg.cs Целия файл

@@ -18,18 +18,21 @@ namespace Common.system
18 18
     public class FFMpeg
19 19
     {
20 20
         public Process myProcess = null;
21
+
21 22
         /// <summary>
22 23
         /// ffmpeg输出日志文件地址  每个文件2MB左右
23 24
         /// </summary>
24
-        string LogPath = "";
25
+        private string LogPath = "";
26
+
25 27
         /// <summary>
26 28
         /// 是否可以录制扬声器
27 29
         /// </summary>
28
-        bool IsRecordSpeaker = true;
30
+        private bool IsRecordSpeaker = true;
31
+
29 32
         /// <summary>
30 33
         /// 是否可以录制麦克风
31 34
         /// </summary>
32
-        bool IsRecordMicrophone = true;
35
+        private bool IsRecordMicrophone = true;
33 36
         /// <summary>
34 37
         /// 录制屏幕
35 38
         /// </summary>
@@ -46,7 +49,7 @@ namespace Common.system
46 49
             //文件保存路径
47 50
             string PathName = GetRSFilePathName(FilePath);
48 51
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
49
-            foreach (var KillProcess in KillProcessArray)
52
+            foreach (Process KillProcess in KillProcessArray)
50 53
             {
51 54
                 KillProcess.Kill();
52 55
             }
@@ -157,7 +160,7 @@ namespace Common.system
157 160
             //文件保存路径
158 161
             string PathName = GetFilePathName(Mp3Path);
159 162
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
160
-            foreach (var KillProcess in KillProcessArray)
163
+            foreach (Process KillProcess in KillProcessArray)
161 164
             {
162 165
                 KillProcess.Kill();
163 166
             }
@@ -203,7 +206,7 @@ namespace Common.system
203 206
             #endregion
204 207
             myProcess = new Process();
205 208
             LogPath = CreateffmpegLog();
206
-            this.myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
209
+            myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
207 210
             if (IsRecordSpeaker && IsRecordMicrophone)
208 211
             {
209 212
                 myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\"  -f dshow -i audio=\"" +
@@ -250,7 +253,7 @@ namespace Common.system
250 253
             {
251 254
                 IsRunning = false;
252 255
                 Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
253
-                foreach (var KillProcess in ProcessArray)
256
+                foreach (Process KillProcess in ProcessArray)
254 257
                 {
255 258
                     IsRunning = true;
256 259
                     Thread.Sleep(100);
@@ -281,7 +284,7 @@ namespace Common.system
281 284
             {
282 285
                 IsRunning = false;
283 286
                 Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
284
-                foreach (var KillProcess in ProcessArray)
287
+                foreach (Process KillProcess in ProcessArray)
285 288
                 {
286 289
                     IsRunning = true;
287 290
                     Thread.Sleep(100);
@@ -317,7 +320,7 @@ namespace Common.system
317 320
             string Extension = FileToolsCommon.GetIOExtension(VideoSavePath);//扩展名
318 321
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
319 322
             //Debug.WriteLine(KillProcessArray.Length.ToString());
320
-            foreach (var KillProcess in KillProcessArray)
323
+            foreach (Process KillProcess in KillProcessArray)
321 324
             {
322 325
                 KillProcess.Kill();
323 326
             }
@@ -336,7 +339,7 @@ namespace Common.system
336 339
                     }
337 340
                 }
338 341
                 #endregion
339
-                this.myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
342
+                myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
340 343
                 switch (Extension.ToUpper())
341 344
                 {
342 345
                     case ".MP4":
@@ -381,7 +384,7 @@ namespace Common.system
381 384
                 {
382 385
                     IsRunning = false;
383 386
                     Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
384
-                    foreach (var KillProcess in ProcessArray)
387
+                    foreach (Process KillProcess in ProcessArray)
385 388
                     {
386 389
                         IsRunning = true;
387 390
                         Thread.Sleep(100);
@@ -454,7 +457,7 @@ namespace Common.system
454 457
             #endregion
455 458
             myProcess = new Process();
456 459
             LogPath = CreateffmpegLog();
457
-            this.myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
460
+            myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
458 461
             if (Extension.ToUpper() == ".MP3")
459 462
             {
460 463
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temp/filelist.d -c copy " + FilePath;
@@ -481,7 +484,7 @@ namespace Common.system
481 484
             {
482 485
                 IsRunning = false;
483 486
                 Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
484
-                foreach (var KillProcess in ProcessArray)
487
+                foreach (Process KillProcess in ProcessArray)
485 488
                 {
486 489
                     IsRunning = true;
487 490
                     Thread.Sleep(100);
@@ -494,7 +497,9 @@ namespace Common.system
494 497
                 FileToolsCommon.DeleteDirectory(Path + "temp/");
495 498
             }
496 499
             else
500
+            {
497 501
                 FileToolsCommon.DeleteDirectory(Path + "temprs/");
502
+            }
498 503
         }
499 504
 
500 505
         /// <summary>
@@ -502,7 +507,7 @@ namespace Common.system
502 507
         /// </summary>
503 508
         /// <param name="FilePath">文件路径</param>
504 509
         /// <returns></returns>
505
-        string GetFilePathName(string FilePath)
510
+        private string GetFilePathName(string FilePath)
506 511
         {
507 512
             //路径
508 513
             string Path = FileToolsCommon.GetDirectoryName(FilePath);
@@ -532,7 +537,7 @@ namespace Common.system
532 537
         /// </summary>
533 538
         /// <param name="FilePath">文件路径</param>
534 539
         /// <returns></returns>
535
-        string GetRSFilePathName(string FilePath)
540
+        private string GetRSFilePathName(string FilePath)
536 541
         {
537 542
             //路径
538 543
             string Path = FileToolsCommon.GetDirectoryName(FilePath);
@@ -568,7 +573,7 @@ namespace Common.system
568 573
                 Thread.Sleep(100);
569 574
             }
570 575
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
571
-            foreach (var KillProcess in KillProcessArray)
576
+            foreach (Process KillProcess in KillProcessArray)
572 577
             {
573 578
                 KillProcess.Kill();
574 579
             }
@@ -576,8 +581,8 @@ namespace Common.system
576 581
             {
577 582
                 myProcess = new Process();
578 583
                 LogPath = CreateffmpegLog();
579
-                this.myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
580
-                                                                                                                      //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
584
+                myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
585
+                                                                                                                 //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
581 586
                 myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -f image2 \"" + ImagePath + "\"";
582 587
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
583 588
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
@@ -596,7 +601,7 @@ namespace Common.system
596 601
                 {
597 602
                     IsRunning = false;
598 603
                     Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
599
-                    foreach (var KillProcess in ProcessArray)
604
+                    foreach (Process KillProcess in ProcessArray)
600 605
                     {
601 606
                         IsRunning = true;
602 607
                         Thread.Sleep(100);
@@ -620,14 +625,14 @@ namespace Common.system
620 625
         /// <param name="Width">宽</param>
621 626
         /// <param name="Height">高</param>
622 627
         /// <returns></returns>
623
-        public bool VideoTranscode(string VideoPathName,string VideoSavePathName,int Width,int Height)
628
+        public bool VideoTranscode(string VideoPathName, string VideoSavePathName, int Width, int Height)
624 629
         {
625 630
             while (myProcess != null)
626 631
             {
627 632
                 Thread.Sleep(100);
628 633
             }
629 634
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
630
-            foreach (var KillProcess in KillProcessArray)
635
+            foreach (Process KillProcess in KillProcessArray)
631 636
             {
632 637
                 KillProcess.Kill();
633 638
             }
@@ -635,8 +640,8 @@ namespace Common.system
635 640
             {
636 641
                 myProcess = new Process();
637 642
                 LogPath = CreateffmpegLog();
638
-                this.myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
639
-                myProcess.StartInfo.Arguments = "-i "+ VideoPathName + " -acodec copy -vcodec libx264 -s "+ Width + "*"+ Height + " "+ VideoSavePathName;
643
+                myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
644
+                myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
640 645
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
641 646
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
642 647
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -654,7 +659,7 @@ namespace Common.system
654 659
                 {
655 660
                     IsRunning = false;
656 661
                     Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
657
-                    foreach (var KillProcess in ProcessArray)
662
+                    foreach (Process KillProcess in ProcessArray)
658 663
                     {
659 664
                         IsRunning = true;
660 665
                         Thread.Sleep(100);
@@ -677,7 +682,7 @@ namespace Common.system
677 682
         /// 创建日志文件
678 683
         /// </summary>
679 684
         /// <returns></returns>
680
-        string CreateffmpegLog()
685
+        private string CreateffmpegLog()
681 686
         {
682 687
             string LogFileName = DateTime.Now.ToString("yyyyMMdd");
683 688
             string LogFilePath = FileToolsCommon.GetFileAbsolutePath("/Log/FFMpegLog/");
@@ -719,7 +724,7 @@ namespace Common.system
719 724
         /// <param name="output"></param>
720 725
         private void Output(object sendProcess, DataReceivedEventArgs output)
721 726
         {
722
-            if (!String.IsNullOrEmpty(output.Data))
727
+            if (!string.IsNullOrEmpty(output.Data))
723 728
             {
724 729
                 FileToolsCommon.AppendText(LogPath, output.Data);
725 730
             }
@@ -738,7 +743,7 @@ namespace Common.system
738 743
         /// <summary>
739 744
         /// 获取麦克风
740 745
         /// </summary>
741
-        string GetMicrophone()
746
+        private string GetMicrophone()
742 747
         {
743 748
             List<string> devs = new List<string>();
744 749
 
@@ -807,7 +812,7 @@ namespace Common.system
807 812
         }
808 813
 
809 814
         //录制麦克风的声音
810
-        WaveInEvent waveIn = null; //new WaveInEvent();
815
+        private WaveInEvent waveIn = null; //new WaveInEvent();
811 816
         /// <summary>
812 817
         /// 开始录制麦克风
813 818
         /// </summary>
@@ -874,7 +879,7 @@ namespace Common.system
874 879
 
875 880
 
876 881
         //录制扬声器的声音
877
-        WasapiLoopbackCapture capture = null; //new WasapiLoopbackCapture();
882
+        private WasapiLoopbackCapture capture = null; //new WasapiLoopbackCapture();
878 883
 
879 884
         /// <summary>
880 885
         /// 开始录制扬声器

+ 14
- 5
Common/system/FileToolsCommon.cs Целия файл

@@ -31,9 +31,14 @@ namespace Common.system
31 31
                     if (Path != "/")
32 32
                     {
33 33
                         if (Path.Substring(1, 1) == ":")
34
+                        {
34 35
                             return Path;
36
+                        }
37
+
35 38
                         if (Path.Substring(0, 1) != "/")
39
+                        {
36 40
                             Path = "/" + Path;
41
+                        }
37 42
                     }
38 43
                 }
39 44
                 string AbsolutePath = Application.StartupPath.ToString().Replace("\\", "/") + Path;
@@ -318,7 +323,7 @@ namespace Common.system
318 323
             //创建一个文件对象  
319 324
             FileInfo fi = new FileInfo(filePath);
320 325
             //double size = fi.Length / 1024;
321
-            double size = Math.Round(((double)fi.Length / 1024.0), 2, MidpointRounding.AwayFromZero);
326
+            double size = Math.Round((fi.Length / 1024.0), 2, MidpointRounding.AwayFromZero);
322 327
             //获取文件的大小  
323 328
             return size;
324 329
         }
@@ -332,7 +337,7 @@ namespace Common.system
332 337
             //创建一个文件对象  
333 338
             FileInfo fi = new FileInfo(filePath);
334 339
             //double size = fi.Length / 1024 / 1024;
335
-            double size = Math.Round(((double)fi.Length / 1024.0 / 1024.0), 2, MidpointRounding.AwayFromZero);
340
+            double size = Math.Round((fi.Length / 1024.0 / 1024.0), 2, MidpointRounding.AwayFromZero);
336 341
             //获取文件的大小  
337 342
             return size;
338 343
         }
@@ -353,9 +358,13 @@ namespace Common.system
353 358
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
354 359
             FileInfo[] fileList;
355 360
             if (files == null)
361
+            {
356 362
                 fileList = folder.GetFiles();
363
+            }
357 364
             else
365
+            {
358 366
                 fileList = folder.GetFiles(files);
367
+            }
359 368
             //获取文件列表  
360 369
             return fileList;
361 370
         }
@@ -645,10 +654,10 @@ namespace Common.system
645 654
         /// <returns></returns>
646 655
         public static string ReadBigFileStr(string filePath, int Length)
647 656
         {
648
-            byte[] buffer =ReadBigFile(filePath, Length);
657
+            byte[] buffer = ReadBigFile(filePath, Length);
649 658
             return Encoding.Default.GetString(buffer);
650 659
         }
651
-       
660
+
652 661
         #endregion
653 662
 
654 663
         #region 从文件的绝对路径中获取文件名( 包含扩展名 )
@@ -818,7 +827,7 @@ namespace Common.system
818 827
             double DirectorySize = DirSize(folder);
819 828
             for (int i = 0; i < 2; i++)
820 829
             {
821
-                DirectorySize /= (double)1024;
830
+                DirectorySize /= 1024;
822 831
             }
823 832
             return DirectorySize;
824 833
         }

+ 21
- 21
Common/system/HttpHelper.cs Целия файл

@@ -53,7 +53,7 @@ namespace Common.system
53 53
             {
54 54
                 try
55 55
                 {
56
-                    var request = HttpHelper.GetHttpWebRequest(downloadUrl);
56
+                    HttpWebRequest request = HttpHelper.GetHttpWebRequest(downloadUrl);
57 57
                     HttpHelper.init_Request(ref request);
58 58
                     request.Accept = "text/json,*/*;q=0.5";
59 59
                     request.AddRange(from, to);
@@ -75,8 +75,8 @@ namespace Common.system
75 75
         }
76 76
         public static string Get(string url, IDictionary<string, string> param)
77 77
         {
78
-            var paramBuilder = new List<string>();
79
-            foreach (var item in param)
78
+            List<string> paramBuilder = new List<string>();
79
+            foreach (KeyValuePair<string, string> item in param)
80 80
             {
81 81
                 paramBuilder.Add(string.Format("{0}={1}", item.Key, item.Value));
82 82
             }
@@ -87,14 +87,14 @@ namespace Common.system
87 87
         {
88 88
             try
89 89
             {
90
-                var request = GetHttpWebRequest(url);
90
+                HttpWebRequest request = GetHttpWebRequest(url);
91 91
                 if (request != null)
92 92
                 {
93 93
                     string retval = null;
94 94
                     init_Request(ref request);
95
-                    using (var Response = request.GetResponse())
95
+                    using (WebResponse Response = request.GetResponse())
96 96
                     {
97
-                        using (var reader = new System.IO.StreamReader(Response.GetResponseStream(), System.Text.Encoding.UTF8))
97
+                        using (StreamReader reader = new System.IO.StreamReader(Response.GetResponseStream(), System.Text.Encoding.UTF8))
98 98
                         {
99 99
                             retval = reader.ReadToEnd();
100 100
                         }
@@ -121,15 +121,15 @@ namespace Common.system
121 121
                     request.ServicePoint.Expect100Continue = false;
122 122
                     request.ContentType = "application/json; charset=utf-8";
123 123
                     request.Timeout = 5000;
124
-                    var bytes = System.Text.UTF8Encoding.UTF8.GetBytes(data);
124
+                    byte[] bytes = System.Text.UTF8Encoding.UTF8.GetBytes(data);
125 125
                     request.ContentLength = bytes.Length;
126
-                    using (var stream = request.GetRequestStream())
126
+                    using (Stream stream = request.GetRequestStream())
127 127
                     {
128 128
                         stream.Write(bytes, 0, bytes.Length);
129 129
                     }
130
-                    using (var response = request.GetResponse())
130
+                    using (WebResponse response = request.GetResponse())
131 131
                     {
132
-                        using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
132
+                        using (StreamReader reader = new System.IO.StreamReader(response.GetResponseStream()))
133 133
                         {
134 134
                             retval = reader.ReadToEnd();
135 135
                         }
@@ -199,7 +199,7 @@ namespace Common.system
199 199
                     string respstr = GetStreamReader(url, responseStream, requestStream, streamReader, webResponse, timeout, encode, postData, contentType);
200 200
                     return JsonHelper.JsonToObj<T>(respstr);
201 201
                 }
202
-                catch (Exception ex)
202
+                catch (Exception)
203 203
                 {
204 204
                 }
205 205
                 finally
@@ -245,7 +245,7 @@ namespace Common.system
245 245
                 streamReader = new StreamReader(responseStream, Encoding.GetEncoding(encode));
246 246
                 return streamReader.ReadToEnd();
247 247
             }
248
-            catch (Exception ex)
248
+            catch (Exception)
249 249
             {
250 250
                 return null;
251 251
             }
@@ -370,9 +370,9 @@ namespace Common.system
370 370
 
371 371
             Stream memStream = new System.IO.MemoryStream();
372 372
 
373
-            var boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" +
373
+            byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" +
374 374
                                                                     boundary + "\r\n");
375
-            var endBoundaryBytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" +
375
+            byte[] endBoundaryBytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" +
376 376
                                                                         boundary + "--");
377 377
             WebHeaderCollection myWebHeaderCollection = request.Headers;
378 378
             request.CookieContainer = cc;
@@ -400,15 +400,15 @@ namespace Common.system
400 400
             for (int i = 0; i < files.Length; i++)
401 401
             {
402 402
                 memStream.Write(boundarybytes, 0, boundarybytes.Length);
403
-                var header = string.Format(headerTemplate, "file", files[i]);
404
-                var headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
403
+                string header = string.Format(headerTemplate, "file", files[i]);
404
+                byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
405 405
 
406 406
                 memStream.Write(headerbytes, 0, headerbytes.Length);
407 407
 
408
-                using (var fileStream = new FileStream(files[i], FileMode.Open, FileAccess.Read))
408
+                using (FileStream fileStream = new FileStream(files[i], FileMode.Open, FileAccess.Read))
409 409
                 {
410
-                    var buffer = new byte[1024];
411
-                    var bytesRead = 0;
410
+                    byte[] buffer = new byte[1024];
411
+                    int bytesRead = 0;
412 412
                     while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
413 413
                     {
414 414
                         memStream.Write(buffer, 0, bytesRead);
@@ -428,7 +428,7 @@ namespace Common.system
428 428
                 requestStream.Write(tempBuffer, 0, tempBuffer.Length);
429 429
             }
430 430
 
431
-            using (var response = request.GetResponse())
431
+            using (WebResponse response = request.GetResponse())
432 432
             {
433 433
                 Stream stream2 = response.GetResponseStream();
434 434
                 StreamReader reader2 = new StreamReader(stream2);
@@ -490,7 +490,7 @@ namespace Common.system
490 490
                 webStream.Close();
491 491
                 return true;
492 492
             }
493
-            catch (Exception ex)
493
+            catch (Exception)
494 494
             {
495 495
                 //LogHelper.WriteErrLog("请求失败:" + ex.Message, ex);
496 496
                 return false;

+ 16
- 4
Common/system/ImageHelper.cs Целия файл

@@ -1,9 +1,7 @@
1 1
 using System;
2
-using System.Configuration;
3 2
 using System.Drawing;
4 3
 using System.Drawing.Imaging;
5 4
 using System.IO;
6
-using System.Security.Policy;
7 5
 using System.Text;
8 6
 using System.Threading;
9 7
 using System.Windows;
@@ -33,7 +31,7 @@ namespace Common.system
33 31
                     FileStream fs = File.OpenRead(path); //OpenRead
34 32
                     int filelength = 0;
35 33
                     filelength = (int)fs.Length; //获得文件长度 
36
-                    Byte[] image = new Byte[filelength]; //建立一个字节数组 
34
+                    byte[] image = new byte[filelength]; //建立一个字节数组 
37 35
                     fs.Read(image, 0, filelength); //按字节流读取 
38 36
                     System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
39 37
                     fs.Close();
@@ -41,7 +39,9 @@ namespace Common.system
41 39
                     return bit;
42 40
                 }
43 41
                 else
42
+                {
44 43
                     return null;
44
+                }
45 45
             }
46 46
             catch (Exception)
47 47
             {
@@ -62,14 +62,16 @@ namespace Common.system
62 62
                     FileStream fs = File.OpenRead(path); //OpenRead
63 63
                     int filelength = 0;
64 64
                     filelength = (int)fs.Length; //获得文件长度 
65
-                    Byte[] image = new Byte[filelength]; //建立一个字节数组 
65
+                    byte[] image = new byte[filelength]; //建立一个字节数组 
66 66
                     fs.Read(image, 0, filelength); //按字节流读取 
67 67
                     System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
68 68
                     fs.Close();
69 69
                     return result;
70 70
                 }
71 71
                 else
72
+                {
72 73
                     return null;
74
+                }
73 75
             }
74 76
             catch (Exception)
75 77
             {
@@ -422,7 +424,9 @@ namespace Common.system
422 424
                     }
423 425
                 }
424 426
                 if (find)
427
+                {
425 428
                     break;
429
+                }
426 430
             }
427 431
             //寻找最左边的标线,从上(top位)到下,从左到右
428 432
             for (int i = 0; i < bmp.Width; i++)//列
@@ -439,7 +443,9 @@ namespace Common.system
439 443
                     }
440 444
                 }
441 445
                 if (find)
446
+                {
442 447
                     break;
448
+                }
443 449
             }
444 450
             //寻找最下边标线,从下到上,从左到右
445 451
             for (int i = bmp.Height - 1; i >= 0; i--)//行
@@ -456,7 +462,9 @@ namespace Common.system
456 462
                     }
457 463
                 }
458 464
                 if (find)
465
+                {
459 466
                     break;
467
+                }
460 468
             }
461 469
             //寻找最右边的标线,从上到下,从右往左
462 470
             for (int i = bmp.Width - 1; i >= 0; i--)//列
@@ -473,7 +481,9 @@ namespace Common.system
473 481
                     }
474 482
                 }
475 483
                 if (find)
484
+                {
476 485
                     break;
486
+                }
477 487
             }
478 488
 
479 489
             if (right - left <= 0)//zxyceshi
@@ -504,7 +514,9 @@ namespace Common.system
504 514
         {
505 515
             //纯透明也是白色,RGB都为255为纯白
506 516
             if (c.A < 10 || (c.R > 245 && c.G > 245 && c.B > 245))
517
+            {
507 518
                 return true;
519
+            }
508 520
 
509 521
             return false;
510 522
         }

+ 1
- 4
Common/system/JsonHelper.cs Целия файл

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

+ 13
- 12
Common/system/KeyboardHookCommon.cs Целия файл

@@ -1,9 +1,5 @@
1 1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4 2
 using System.Runtime.InteropServices;
5
-using System.Text;
6
-using System.Threading.Tasks;
7 3
 using System.Windows.Forms;
8 4
 
9 5
 namespace Common.system
@@ -28,17 +24,19 @@ namespace Common.system
28 24
         /// </summary>
29 25
         public event KeyEventHandler KeyUpEvent;
30 26
 
31
-        public delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam);
32
-        static int hKeyboardHook = 0; //声明键盘钩子处理的初始值
33
-                                      //值在Microsoft SDK的Winuser.h里查询
27
+        public delegate int HookProc(int nCode, int wParam, IntPtr lParam);
28
+
29
+        private static int hKeyboardHook = 0; //声明键盘钩子处理的初始值
30
+                                              //值在Microsoft SDK的Winuser.h里查询
34 31
         /// <summary>
35 32
         /// 线程键盘钩子监听鼠标消息设为2,全局键盘监听鼠标消息设为13
36 33
         /// </summary>
37 34
         public const int WH_KEYBOARD_LL = 13;
35
+
38 36
         /// <summary>
39 37
         /// 声明KeyboardHookProcedure作为HookProc类型
40 38
         /// </summary>
41
-        HookProc KeyboardHookProcedure;
39
+        private HookProc KeyboardHookProcedure;
42 40
 
43 41
         /// <summary>
44 42
         /// 自己创建窗口按键 
@@ -79,11 +77,11 @@ namespace Common.system
79 77
 
80 78
         //使用此功能,通过信息钩子继续下一个钩子
81 79
         [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
82
-        public static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr lParam);
80
+        public static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam);
83 81
 
84 82
         // 取得当前线程编号(线程钩子需要用到)
85 83
         [DllImport("kernel32.dll")]
86
-        static extern int GetCurrentThreadId();
84
+        private static extern int GetCurrentThreadId();
87 85
 
88 86
         //使用WINDOWS API函数代替获取当前实例的函数,防止钩子失效
89 87
         [DllImport("kernel32.dll")]
@@ -148,7 +146,10 @@ namespace Common.system
148 146
             try
149 147
             {
150 148
 
151
-                if (!(retKeyboard)) throw new Exception("卸载钩子失败!");
149
+                if (!(retKeyboard))
150
+                {
151
+                    throw new Exception("卸载钩子失败!");
152
+                }
152 153
             }
153 154
             catch (Exception)
154 155
             {
@@ -157,7 +158,7 @@ namespace Common.system
157 158
         }
158 159
         //接收SetWindowsHookEx返回值  
159 160
         private static int _hHookValue = 0;
160
-        private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
161
+        private int KeyboardHookProc(int nCode, int wParam, IntPtr lParam)
161 162
         {
162 163
             // 侦听键盘事件
163 164
             if ((nCode >= 0) && (KeyDownEvent != null || KeyUpEvent != null || KeyPressEvent != null))

+ 8
- 10
Common/system/LatticeFileHelper.cs Целия файл

@@ -2,10 +2,7 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Diagnostics;
4 4
 using System.Drawing.Printing;
5
-using System.Linq;
6
-using System.Text;
7 5
 using System.Threading;
8
-using System.Threading.Tasks;
9 6
 
10 7
 namespace Common.system
11 8
 {
@@ -19,10 +16,11 @@ namespace Common.system
19 16
         /// 打印进程
20 17
         /// </summary>
21 18
         public static Process PrintProcess = null;
19
+
22 20
         /// <summary>
23 21
         /// 输出日志文件地址  每个文件2MB左右
24 22
         /// </summary>
25
-        static string LogPath = "";
23
+        private static string LogPath = "";
26 24
         /// <summary>
27 25
         /// 运行配置 首次打开必须运行
28 26
         /// </summary>
@@ -78,7 +76,7 @@ namespace Common.system
78 76
                 Thread.Sleep(100);
79 77
             }
80 78
             Process[] KillProcessArray = Process.GetProcessesByName("PrintTool");
81
-            foreach (var KillProcess in KillProcessArray)
79
+            foreach (Process KillProcess in KillProcessArray)
82 80
             {
83 81
                 KillProcess.Kill();
84 82
             }
@@ -110,7 +108,7 @@ namespace Common.system
110 108
             {
111 109
                 IsRunning = false;
112 110
                 Process[] ProcessArray = Process.GetProcessesByName("PrintTool");
113
-                foreach (var KillProcess in ProcessArray)
111
+                foreach (Process KillProcess in ProcessArray)
114 112
                 {
115 113
                     IsRunning = true;
116 114
                     Thread.Sleep(100);
@@ -138,7 +136,7 @@ namespace Common.system
138 136
                     PrintersList.Add(sPrint);
139 137
                 }
140 138
             }
141
-            catch (Exception ex)
139
+            catch (Exception)
142 140
             {
143 141
 
144 142
             }
@@ -177,7 +175,7 @@ namespace Common.system
177 175
                 Thread.Sleep(100);
178 176
             }
179 177
             Process[] KillProcessArray = Process.GetProcessesByName("PrintTool");
180
-            foreach (var KillProcess in KillProcessArray)
178
+            foreach (Process KillProcess in KillProcessArray)
181 179
             {
182 180
                 KillProcess.Kill();
183 181
             }
@@ -209,7 +207,7 @@ namespace Common.system
209 207
             {
210 208
                 IsRunning = false;
211 209
                 Process[] ProcessArray = Process.GetProcessesByName("PrintTool");
212
-                foreach (var KillProcess in ProcessArray)
210
+                foreach (Process KillProcess in ProcessArray)
213 211
                 {
214 212
                     IsRunning = true;
215 213
                     Thread.Sleep(100);
@@ -264,7 +262,7 @@ namespace Common.system
264 262
         /// <param name="Message"></param>
265 263
         private static void Output(string Message)
266 264
         {
267
-            if (!String.IsNullOrEmpty(Message))
265
+            if (!string.IsNullOrEmpty(Message))
268 266
             {
269 267
                 FileToolsCommon.AppendText(LogPath, Message + "\r\n");
270 268
             }

+ 5
- 4
Common/system/PdfTrunImage.cs Целия файл

@@ -1,8 +1,9 @@
1
-using System.Collections.Generic;
1
+using O2S.Components.PDFRender4NET;
2
+
3
+using System.Collections.Generic;
2 4
 using System.Drawing;
3 5
 using System.Drawing.Imaging;
4 6
 using System.IO;
5
-using O2S.Components.PDFRender4NET;
6 7
 
7 8
 namespace Common.system
8 9
 {
@@ -14,7 +15,7 @@ namespace Common.system
14 15
     /// http://www.hrangel.com.br/index.php/2006/12/04/converter-pdf-para-imagem-jpeg-em-c/
15 16
     /// </summary>
16 17
     /// <seealso cref="http://www.hrangel.com.br/index.php/2006/12/04/converter-pdf-para-imagem-jpeg-em-c/"/>
17
-   public class PdfTrunImage
18
+    public class PdfTrunImage
18 19
     {
19 20
         public enum Definition
20 21
         {
@@ -50,7 +51,7 @@ namespace Common.system
50 51
                     startPageNum = 1;
51 52
                 }
52 53
 
53
-                if (endPageNum==0||endPageNum > pdfFile.PageCount)
54
+                if (endPageNum == 0 || endPageNum > pdfFile.PageCount)
54 55
                 {
55 56
                     endPageNum = pdfFile.PageCount;
56 57
                 }

+ 21
- 20
Common/system/PrimaryScreen.cs Целия файл

@@ -11,40 +11,45 @@ namespace Common.system
11 11
     {
12 12
         #region Win32 API
13 13
         [DllImport("user32.dll")]
14
-        static extern IntPtr GetDC(IntPtr ptr);
14
+        private static extern IntPtr GetDC(IntPtr ptr);
15 15
         [DllImport("gdi32.dll")]
16
-        static extern int GetDeviceCaps(
16
+        private static extern int GetDeviceCaps(
17 17
        IntPtr hdc, // handle to DC
18 18
        int nIndex // index of capability
19 19
        );
20 20
         [DllImport("user32.dll", EntryPoint = "ReleaseDC")]
21
-        static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);
21
+        private static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);
22 22
         #endregion
23 23
         #region DeviceCaps常量
24 24
         /// <summary>
25 25
         /// 屏幕的宽度(像素);
26 26
         /// </summary>
27
-        const int HORZRES = 8;
27
+        private const int HORZRES = 8;
28
+
28 29
         /// <summary>
29 30
         /// 屏幕的高度
30 31
         /// </summary>
31
-        const int VERTRES = 10;
32
+        private const int VERTRES = 10;
33
+
32 34
         /// <summary>
33 35
         /// 沿屏幕宽度每逻辑英寸的像素数,在多显示器系统中,该值对所显示器相同
34 36
         /// </summary>
35
-        const int LOGPIXELSX = 88;
37
+        private const int LOGPIXELSX = 88;
38
+
36 39
         /// <summary>
37 40
         /// 沿屏幕高度每逻辑英寸的像素数,在多显示器系统中,该值对所显示器相同;
38 41
         /// </summary>
39
-        const int LOGPIXELSY = 90;
42
+        private const int LOGPIXELSY = 90;
43
+
40 44
         /// <summary>
41 45
         /// Windows NT:可视桌面的以像素为单位的高度。
42 46
         /// </summary>
43
-        const int DESKTOPVERTRES = 117;
47
+        private const int DESKTOPVERTRES = 117;
48
+
44 49
         /// <summary>
45 50
         /// DESKTOPHORZRES:Windows NT:可视桌面的以像素为单位的宽度。如果设备支持一个可视桌面或双重显示则此值可能大于VERTRES;
46 51
         /// </summary>
47
-        const int DESKTOPHORZRES = 118;
52
+        private const int DESKTOPHORZRES = 118;
48 53
         #endregion
49 54
 
50 55
         #region 属性
@@ -117,9 +122,11 @@ namespace Common.system
117 122
             get
118 123
             {
119 124
                 IntPtr hdc = GetDC(IntPtr.Zero);
120
-                /*int t = */GetDeviceCaps(hdc, DESKTOPHORZRES);
121
-               /* int d = */GetDeviceCaps(hdc, HORZRES);
122
-                float ScaleX = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
125
+                /*int t = */
126
+                GetDeviceCaps(hdc, DESKTOPHORZRES);
127
+                /* int d = */
128
+                GetDeviceCaps(hdc, HORZRES);
129
+                float ScaleX = GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
123 130
                 ReleaseDC(IntPtr.Zero, hdc);
124 131
                 return ScaleX;
125 132
             }
@@ -132,7 +139,7 @@ namespace Common.system
132 139
             get
133 140
             {
134 141
                 IntPtr hdc = GetDC(IntPtr.Zero);
135
-                float ScaleY = (float)(float)GetDeviceCaps(hdc, DESKTOPVERTRES) / (float)GetDeviceCaps(hdc, VERTRES);
142
+                float ScaleY = (float)GetDeviceCaps(hdc, DESKTOPVERTRES) / GetDeviceCaps(hdc, VERTRES);
136 143
                 ReleaseDC(IntPtr.Zero, hdc);
137 144
                 return ScaleY;
138 145
             }
@@ -142,13 +149,7 @@ namespace Common.system
142 149
         /// 缩放后的大小
143 150
         /// </summary>
144 151
         /// <returns></returns>
145
-        public static SizeF ScaleScreenSize
146
-        {
147
-            get
148
-            {
149
-               return new SizeF(((float)DESKTOP.Width) / (DpiX / 96f), ((float)DESKTOP.Height) / (DpiY / 96f));
150
-            }
151
-        }
152
+        public static SizeF ScaleScreenSize => new SizeF(DESKTOP.Width / (DpiX / 96f), DESKTOP.Height / (DpiY / 96f));
152 153
         /// <summary>
153 154
         /// 获取缩放后的工作区域大小
154 155
         /// </summary>

+ 11
- 4
Common/system/SplashScreen.cs Целия файл

@@ -23,7 +23,10 @@ namespace Common.system
23 23
         public static void Show(Type splashFormType)
24 24
         {
25 25
             if (_SplashThread != null)
26
+            {
26 27
                 return;
28
+            }
29
+
27 30
             if (splashFormType == null)
28 31
             {
29 32
                 throw (new Exception());
@@ -33,9 +36,10 @@ namespace Common.system
33 36
             {
34 37
                 CreateInstance(splashFormType);
35 38
                 Application.Run(_SplashForm);
36
-            }));
37
-
38
-            _SplashThread.IsBackground = true;
39
+            }))
40
+            {
41
+                IsBackground = true
42
+            };
39 43
             _SplashThread.SetApartmentState(ApartmentState.STA);
40 44
             _SplashThread.Start();
41 45
         }
@@ -50,7 +54,10 @@ namespace Common.system
50 54
 
51 55
         public static void Close()
52 56
         {
53
-            if (_SplashThread == null || _SplashForm == null) return;
57
+            if (_SplashThread == null || _SplashForm == null)
58
+            {
59
+                return;
60
+            }
54 61
 
55 62
             try
56 63
             {

+ 2
- 0
Common/system/XmlUtilHelper.cs Целия файл

@@ -81,7 +81,9 @@ namespace Common.system
81 81
             {
82 82
                 object obj;
83 83
                 if (!System.IO.File.Exists(filename))
84
+                {
84 85
                     throw new Exception("指定文件不存在");
86
+                }
85 87
                 //Xml格式反序列化  
86 88
                 using (Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
87 89
                 {

+ 0
- 4
Common/system/ZJClippingBorder.cs Целия файл

@@ -1,8 +1,4 @@
1 1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6 2
 using System.Windows;
7 3
 using System.Windows.Controls;
8 4
 using System.Windows.Media;

+ 1
- 7
XHWK.Model/ComboBoxBean.cs Целия файл

@@ -1,10 +1,4 @@
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
1
+namespace XHWK.Model
8 2
 {
9 3
     public class ComboBoxBean
10 4
     {

+ 1
- 7
XHWK.Model/Model_App.cs Целия файл

@@ -1,10 +1,4 @@
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
1
+namespace XHWK.Model
8 2
 {
9 3
     public class Model_App
10 4
     {

+ 2
- 8
XHWK.Model/Model_Canvas.cs Целия файл

@@ -1,12 +1,6 @@
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
1
+namespace XHWK.Model
8 2
 {
9
-    public class Model_Canvas:NotifyModel
3
+    public class Model_Canvas : NotifyModel
10 4
     {
11 5
         private string _name;
12 6
 

+ 1
- 5
XHWK.Model/Model_DirectorList.cs Целия файл

@@ -1,8 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
1
+using System.Collections.Generic;
6 2
 
7 3
 namespace XHWK.Model
8 4
 {

+ 2
- 8
XHWK.Model/Model_DrawData.cs Целия файл

@@ -1,10 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Drawing;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7
-using System.Windows.Media;
1
+using System.Windows.Media;
8 2
 
9 3
 namespace XHWK.Model
10 4
 {
@@ -16,7 +10,7 @@ namespace XHWK.Model
16 10
         private int _PageNum;
17 11
         private string _pageCode;
18 12
         private string _pageImagePath;
19
-        private TranslateTransform _ImageLocation=new TranslateTransform(0,0);
13
+        private TranslateTransform _ImageLocation = new TranslateTransform(0, 0);
20 14
         //private ScaleTransform _ImageSize = new ScaleTransform(0, 0);
21 15
         private ScaleTransform _ImageSizes = new ScaleTransform(0, 0);
22 16
         private bool _IsImageLocation;

+ 2
- 7
XHWK.Model/Model_Page.cs Целия файл

@@ -1,9 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Collections.ObjectModel;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
1
+using System.Collections.ObjectModel;
7 2
 
8 3
 namespace XHWK.Model
9 4
 {
@@ -39,7 +34,7 @@ namespace XHWK.Model
39 34
             set { _currpage = value; OnPropertyChanged("currpage"); }
40 35
         }
41 36
 
42
-        public Model_Page() 
37
+        public Model_Page()
43 38
         {
44 39
             menuList = new ObservableCollection<Model_Canvas>();
45 40
         }

+ 1
- 7
XHWK.Model/Model_ResourceAdd.cs Целия файл

@@ -1,10 +1,4 @@
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
1
+namespace XHWK.Model
8 2
 {
9 3
     public class Model_ResourceAdd
10 4
     {

+ 4
- 10
XHWK.Model/Model_ResourceAddTwo.cs Целия файл

@@ -1,16 +1,10 @@
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
1
+namespace XHWK.Model
8 2
 {
9
-    public class Model_ResourceAddTwo 
3
+    public class Model_ResourceAddTwo
10 4
     {
11
-  public string videopath { get; set; }
5
+        public string videopath { get; set; }
12 6
         public string coverpath { get; set; }
13 7
         public int duration { get; set; }
14
-        public string mp4code { get; set; } 
8
+        public string mp4code { get; set; }
15 9
     }
16 10
 }

+ 2
- 8
XHWK.Model/Model_Screenshot.cs Целия файл

@@ -1,10 +1,4 @@
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
1
+namespace XHWK.Model
8 2
 {
9 3
     public class Model_Screenshot
10 4
     {
@@ -18,6 +12,6 @@ namespace XHWK.Model
18 12
         /// 图片下标
19 13
         /// </summary>
20 14
         public int Subscript { get => _subscript; set => _subscript = value; }
21
-      
15
+
22 16
     }
23 17
 }

+ 1
- 7
XHWK.Model/Model_TsubjectbookList.cs Целия файл

@@ -1,10 +1,4 @@
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
1
+namespace XHWK.Model
8 2
 {
9 3
     public class Model_TsubjectbookList
10 4
     {

+ 2
- 5
XHWK.Model/Model_Video.cs Целия файл

@@ -1,7 +1,4 @@
1
-using System.Collections.Generic;
2
-using System.Runtime.Remoting.Messaging;
3
-
4
-namespace XHWK.Model
1
+namespace XHWK.Model
5 2
 {
6 3
     /// <summary>
7 4
     /// 视频模型
@@ -15,7 +12,7 @@ namespace XHWK.Model
15 12
         private string _RSTime;
16 13
         private string _videoSize;
17 14
         private long _videoSizebyte;
18
-        private bool _IsUpload=false;
15
+        private bool _IsUpload = false;
19 16
         private string _FileGuid;//= System.Guid.NewGuid().ToString()
20 17
         private string _FileMD5;
21 18
         private string _Savefolder;

+ 1
- 7
XHWK.Model/ResultVo.cs Целия файл

@@ -1,10 +1,4 @@
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
1
+namespace XHWK.Model
8 2
 {
9 3
     public class ResultVo<T>
10 4
     {

+ 4
- 7
XHWK.Model/ViewModel.cs Целия файл

@@ -1,9 +1,4 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.ComponentModel;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
1
+using System.ComponentModel;
7 2
 using System.Windows.Ink;
8 3
 
9 4
 namespace XHWK.Model
@@ -15,7 +10,9 @@ namespace XHWK.Model
15 10
         protected virtual void OnPropertyChanged(string propertyName = null)
16 11
         {
17 12
             if (PropertyChanged != null)
13
+            {
18 14
                 PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
15
+            }
19 16
         }
20 17
 
21 18
         private string meaInfo;
@@ -32,7 +29,7 @@ namespace XHWK.Model
32 29
         private StrokeCollection inkStrokes;
33 30
         public StrokeCollection InkStrokes
34 31
         {
35
-            get { return inkStrokes; }
32
+            get => inkStrokes;
36 33
             set
37 34
             {
38 35
                 inkStrokes = value;

+ 9
- 7
XHWK.WKTool/App.config Целия файл

@@ -19,18 +19,20 @@
19 19
     <!--记住密码-->
20 20
     <add key="isRemind" value="" />
21 21
     <!--API请求地址-->
22
-    <add key="APIRequestAddress" value="https://schoolapitest.xhkjedu.com"/>
22
+    <add key="APIRequestAddress" value="https://schoolapi.xhkjedu.com"/>
23 23
     <!--文件平台请求地址-->
24
-    <add key="FileRequestAddress" value="https://schoolfiletest.xhkjedu.com"/>
25
-    <!--<add key="FileRequestAddress" value="http://192.168.2.18:8908"/>-->
24
+    <add key="FileRequestAddress" value="https://schoolfile.xhkjedu.com"/>
26 25
     <!--展示文件服务器请求地址-->
27
-    <add key="schoolfileRequestAddress" value="https://schoolfiletest.xhkjedu.com"/>
28
-    <!--接口地址: https://schoolapitest.xhkjedu.com/
29
-    文件上传: https://schoolfiletest.xhkjedu.com/
30
-    展示文件:   https://schoolfiletest.xhkjedu.com/-->
26
+    <add key="SchoolfileRequestAddress" value="https://schoolfile.xhkjedu.com"/>
27
+    <!--认证请求地址-->
28
+    <add key="CertapiRequestAddress" value="http://certapi.xhkjedu.com"/>
31 29
     <!--摄像头位置 1.右上 2.左上 3.右下 4.左下-->
32 30
     <add key="CameraPosition" value="1"/>
33 31
     <!--上传每片大小 Mb-->
34 32
     <add key="UploadSliceLen" value="1"/>
33
+    <!--版本号-->
34
+    <add key="VersionCode" value="8"/>
35
+    <add key="VersionName" value="1.0.7"/>
36
+    
35 37
   </appSettings>
36 38
 </configuration>

+ 31
- 10
XHWK.WKTool/App.cs Целия файл

@@ -7,10 +7,8 @@ using System.Collections.Generic;
7 7
 using System.Diagnostics;
8 8
 using System.Reflection;
9 9
 using System.Security.Principal;
10
-using System.Security.RightsManagement;
11 10
 using System.Threading;
12 11
 using System.Windows;
13
-using System.Windows.Documents;
14 12
 using System.Windows.Threading;
15 13
 
16 14
 using TStudyDigitalPen.HID;
@@ -22,6 +20,27 @@ namespace XHWK.WKTool
22 20
     public partial class APP : Application
23 21
     {
24 22
         #region 全局变量
23
+        /// <summary>
24
+        /// 是否为测试版
25
+        /// </summary>
26
+        public static bool isDebug = true;
27
+        /// <summary>
28
+        /// 接口地址
29
+        /// </summary>
30
+        public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
31
+        /// <summary>
32
+        /// 图片地址
33
+        /// </summary>
34
+        public static string uploadUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/" : FileToolsCommon.GetConfigValue("FileRequestAddress");
35
+        /// <summary>
36
+        /// 展示文件
37
+        /// </summary>
38
+        public static string showImageUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/static/" : FileToolsCommon.GetConfigValue("SchoolfileRequestAddress") + "/static/";
39
+        /// <summary>
40
+        /// 认证接口地址
41
+        /// </summary>
42
+        public static string certapiUrl = isDebug ? "http://certapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("CertapiRequestAddress");
43
+
25 44
         /// <summary>
26 45
         /// 用户信息
27 46
         /// </summary>
@@ -80,7 +99,7 @@ namespace XHWK.WKTool
80 99
         /// <summary>
81 100
         /// 教材列表
82 101
         /// </summary>
83
-        public static List<Model_TsubjectbookList> TsubjectbookList=null;
102
+        public static List<Model_TsubjectbookList> TsubjectbookList = null;
84 103
         /// <summary>
85 104
         /// 章节列表
86 105
         /// </summary>
@@ -183,12 +202,14 @@ namespace XHWK.WKTool
183 202
                 else
184 203
                 {
185 204
                     //创建启动对象
186
-                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
187
-                    startInfo.UseShellExecute = true;
188
-                    startInfo.WorkingDirectory = Environment.CurrentDirectory;
189
-                    startInfo.FileName = Assembly.GetExecutingAssembly().Location;
190
-                    //设置启动动作,确保以管理员身份运行
191
-                    startInfo.Verb = "runas";
205
+                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
206
+                    {
207
+                        UseShellExecute = true,
208
+                        WorkingDirectory = Environment.CurrentDirectory,
209
+                        FileName = Assembly.GetExecutingAssembly().Location,
210
+                        //设置启动动作,确保以管理员身份运行
211
+                        Verb = "runas"
212
+                    };
192 213
                     try
193 214
                     {
194 215
                         System.Diagnostics.Process.Start(startInfo);
@@ -243,7 +264,7 @@ namespace XHWK.WKTool
243 264
         public static void Killffmpeg()
244 265
         {
245 266
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
246
-            foreach (var KillProcess in KillProcessArray)
267
+            foreach (Process KillProcess in KillProcessArray)
247 268
             {
248 269
                 KillProcess.Kill();
249 270
             }

+ 3
- 12
XHWK.WKTool/AppUpdateWin.xaml.cs Целия файл

@@ -1,21 +1,12 @@
1 1
 using System;
2
-using System.Collections.Generic;
3 2
 using System.Diagnostics;
4 3
 using System.IO;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading.Tasks;
8 4
 using System.Windows;
9
-using System.Windows.Controls;
10
-using System.Windows.Data;
11
-using System.Windows.Documents;
12 5
 using System.Windows.Input;
13
-using System.Windows.Media;
14
-using System.Windows.Media.Imaging;
15
-using System.Windows.Shapes;
6
+
16 7
 using XHWK.Model;
17
-using XHWK.WKTool.Config;
18 8
 using XHWK.WKTool.Helpers;
9
+
19 10
 using static XHWK.WKTool.Helpers.ZJDownloadUtil;
20 11
 
21 12
 namespace XHWK.WKTool
@@ -57,7 +48,7 @@ namespace XHWK.WKTool
57 48
 
58 49
         private void gengxinClick(object sender, RoutedEventArgs e)
59 50
         {
60
-            string fileUrl = ZConfig.showImageUrl + pageData.appModel.versionpath;
51
+            string fileUrl = APP.showImageUrl + pageData.appModel.versionpath;
61 52
 
62 53
             string temp = System.Environment.GetEnvironmentVariable("TEMP");
63 54
             DirectoryInfo info = new DirectoryInfo(temp);

+ 3
- 2
XHWK.WKTool/Controls/MainImage.cs Целия файл

@@ -1,6 +1,7 @@
1
-using ComeCapture.Helpers;
2
-using ComeCapture.Models;
1
+using ComeCapture.Models;
2
+
3 3
 using Common.system;
4
+
4 5
 using System.Collections.Generic;
5 6
 using System.Linq;
6 7
 using System.Windows;

+ 52
- 30
XHWK.WKTool/CountdownWindow.xaml.cs Целия файл

@@ -3,7 +3,6 @@
3 3
 using System;
4 4
 using System.Threading;
5 5
 using System.Windows;
6
-using System.Windows.Controls;
7 6
 using System.Windows.Media.Imaging;
8 7
 using System.Windows.Threading;
9 8
 
@@ -18,12 +17,13 @@ namespace XHWK.WKTool
18 17
         {
19 18
             InitializeComponent();
20 19
         }
20
+
21 21
         /// <summary>
22 22
         /// 计时器
23 23
         /// </summary>
24
-        System.Timers.Timer timer;
25
-        int ImgNum = 21;
26
-        public void Initialize(bool ShowlblShortcut=false, int changeTime=2100)
24
+        private System.Timers.Timer timer;
25
+        private int ImgNum = 21;
26
+        public void Initialize(bool ShowlblShortcut = false, int changeTime = 2100)
27 27
         {
28 28
             if (ShowlblShortcut)
29 29
             {
@@ -55,9 +55,9 @@ namespace XHWK.WKTool
55 55
                                       DispatcherPriority.Send,
56 56
                                       new Action(() =>
57 57
                                       {
58
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
59
-                          Hide();
60
-                      }));
58
+                                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
59
+                                          Hide();
60
+                                      }));
61 61
                         }
62 62
                     }
63 63
                     catch (Exception ex)
@@ -80,7 +80,7 @@ namespace XHWK.WKTool
80 80
             {
81 81
                 loadingImg(ImgNum);
82 82
                 ImgNum--;
83
-                LogHelper.WriteInfoLog("【"+ImgNum+"】");
83
+                LogHelper.WriteInfoLog("【" + ImgNum + "】");
84 84
             }
85 85
             else
86 86
             {
@@ -94,158 +94,180 @@ namespace XHWK.WKTool
94 94
                   }));
95 95
             }
96 96
         }
97
+
97 98
         /// <summary>
98 99
         /// 加载图片
99 100
         /// </summary>
100 101
         /// <param name="num"></param>
101
-        void loadingImg(int num)
102
+        private void loadingImg(int num)
102 103
         {
103 104
             switch (num)
104 105
             {
105 106
                 case 1:
106 107
                     Dispatcher.Invoke(
107 108
                       DispatcherPriority.Send,
108
-                      new Action(() => { 
109
+                      new Action(() =>
110
+                      {
109 111
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_5.png"));
110 112
                       }));
111 113
                     break;
112 114
                 case 2:
113 115
                     Dispatcher.Invoke(
114 116
                       DispatcherPriority.Send,
115
-                      new Action(() => {
117
+                      new Action(() =>
118
+                      {
116 119
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_4.png"));
117 120
                       }));
118 121
                     break;
119 122
                 case 3:
120 123
                     Dispatcher.Invoke(
121 124
                       DispatcherPriority.Send,
122
-                      new Action(() => {
125
+                      new Action(() =>
126
+                      {
123 127
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_3.png"));
124 128
                       }));
125 129
                     break;
126 130
                 case 4:
127 131
                     Dispatcher.Invoke(
128 132
                       DispatcherPriority.Send,
129
-                      new Action(() => {
133
+                      new Action(() =>
134
+                      {
130 135
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_2.png"));
131 136
                       }));
132 137
                     break;
133 138
                 case 5:
134 139
                     Dispatcher.Invoke(
135 140
                       DispatcherPriority.Send,
136
-                      new Action(() => {
141
+                      new Action(() =>
142
+                      {
137 143
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_1.png"));
138 144
                       }));
139 145
                     break;
140 146
                 case 6:
141 147
                     Dispatcher.Invoke(
142 148
                       DispatcherPriority.Send,
143
-                      new Action(() => {
149
+                      new Action(() =>
150
+                      {
144 151
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_7.png"));
145 152
                       }));
146 153
                     break;
147 154
                 case 7:
148 155
                     Dispatcher.Invoke(
149 156
                       DispatcherPriority.Send,
150
-                      new Action(() => {
157
+                      new Action(() =>
158
+                      {
151 159
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_6.png"));
152 160
                       }));
153 161
                     break;
154 162
                 case 8:
155 163
                     Dispatcher.Invoke(
156 164
                       DispatcherPriority.Send,
157
-                      new Action(() => {
165
+                      new Action(() =>
166
+                      {
158 167
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_5.png"));
159 168
                       }));
160 169
                     break;
161 170
                 case 9:
162 171
                     Dispatcher.Invoke(
163 172
                       DispatcherPriority.Send,
164
-                      new Action(() => {
173
+                      new Action(() =>
174
+                      {
165 175
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_4.png"));
166 176
                       }));
167 177
                     break;
168 178
                 case 10:
169 179
                     Dispatcher.Invoke(
170 180
                       DispatcherPriority.Send,
171
-                      new Action(() => {
181
+                      new Action(() =>
182
+                      {
172 183
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_3.png"));
173 184
                       }));
174 185
                     break;
175 186
                 case 11:
176 187
                     Dispatcher.Invoke(
177 188
                       DispatcherPriority.Send,
178
-                      new Action(() => {
189
+                      new Action(() =>
190
+                      {
179 191
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_2.png"));
180 192
                       }));
181 193
                     break;
182 194
                 case 12:
183 195
                     Dispatcher.Invoke(
184 196
                       DispatcherPriority.Send,
185
-                      new Action(() => {
197
+                      new Action(() =>
198
+                      {
186 199
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_1.png"));
187 200
                       }));
188 201
                     break;
189 202
                 case 13:
190 203
                     Dispatcher.Invoke(
191 204
                       DispatcherPriority.Send,
192
-                      new Action(() => {
205
+                      new Action(() =>
206
+                      {
193 207
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_9.png"));
194 208
                       }));
195 209
                     break;
196 210
                 case 14:
197 211
                     Dispatcher.Invoke(
198 212
                       DispatcherPriority.Send,
199
-                      new Action(() => {
213
+                      new Action(() =>
214
+                      {
200 215
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_8.png"));
201 216
                       }));
202 217
                     break;
203 218
                 case 15:
204 219
                     Dispatcher.Invoke(
205 220
                       DispatcherPriority.Send,
206
-                      new Action(() => {
221
+                      new Action(() =>
222
+                      {
207 223
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_7.png"));
208 224
                       }));
209 225
                     break;
210 226
                 case 16:
211 227
                     Dispatcher.Invoke(
212 228
                       DispatcherPriority.Send,
213
-                      new Action(() => {
229
+                      new Action(() =>
230
+                      {
214 231
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_6.png"));
215 232
                       }));
216 233
                     break;
217 234
                 case 17:
218 235
                     Dispatcher.Invoke(
219 236
                       DispatcherPriority.Send,
220
-                      new Action(() => {
237
+                      new Action(() =>
238
+                      {
221 239
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_5.png"));
222 240
                       }));
223 241
                     break;
224 242
                 case 18:
225 243
                     Dispatcher.Invoke(
226 244
                       DispatcherPriority.Send,
227
-                      new Action(() => {
245
+                      new Action(() =>
246
+                      {
228 247
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_4.png"));
229 248
                       }));
230 249
                     break;
231 250
                 case 19:
232 251
                     Dispatcher.Invoke(
233 252
                       DispatcherPriority.Send,
234
-                      new Action(() => {
253
+                      new Action(() =>
254
+                      {
235 255
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_3.png"));
236 256
                       }));
237 257
                     break;
238 258
                 case 20:
239 259
                     Dispatcher.Invoke(
240 260
                       DispatcherPriority.Send,
241
-                      new Action(() => {
261
+                      new Action(() =>
262
+                      {
242 263
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_2.png"));
243 264
                       }));
244 265
                     break;
245 266
                 case 21:
246 267
                     Dispatcher.Invoke(
247 268
                       DispatcherPriority.Send,
248
-                      new Action(() => {
269
+                      new Action(() =>
270
+                      {
249 271
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
250 272
                       }));
251 273
                     break;

+ 31
- 21
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs Целия файл

@@ -1,13 +1,12 @@
1 1
 using Common.system;
2 2
 
3 3
 using System;
4
-using System.Diagnostics;
5 4
 using System.Threading;
6 5
 using System.Windows;
7 6
 using System.Windows.Forms;
8 7
 using System.Windows.Input;
8
+
9 9
 using XHWK.Model;
10
-using XHWK.WKTool.Config;
11 10
 
12 11
 namespace XHWK.WKTool
13 12
 {
@@ -94,15 +93,17 @@ namespace XHWK.WKTool
94 93
                 return;
95 94
             }
96 95
             #endregion
97
-            string wkpath=FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim()+"/";
96
+            string wkpath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
98 97
             //读取微课数据
99 98
             APP.ReadWkData(wkpath);
100
-            if(APP.WKData==null)
99
+            if (APP.WKData == null)
101 100
             {
102
-                APP.WKData = new Model.Model_WKData();
103
-                APP.WKData.WkPath = wkpath;
104
-                APP.WKData.WkName = txbExplainName.Text;
105
-                APP.WKData.WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
101
+                APP.WKData = new Model.Model_WKData
102
+                {
103
+                    WkPath = wkpath,
104
+                    WkName = txbExplainName.Text,
105
+                    WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
106
+                };
106 107
             }
107 108
             //创建文件夹
108 109
             FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
@@ -138,11 +139,11 @@ namespace XHWK.WKTool
138 139
                 //APP.W_XHMicroLessonSystemWindow .Topmost = true;
139 140
             }
140 141
             APP.W_XHMicroLessonSystemWindow.Show();
141
-            this.Hide();
142
+            Hide();
142 143
         }
143
-        double screeHeight = SystemParameters.FullPrimaryScreenHeight;
144 144
 
145
-        double screeWidth = SystemParameters.FullPrimaryScreenWidth;
145
+        private double screeHeight = SystemParameters.FullPrimaryScreenHeight;
146
+        private double screeWidth = SystemParameters.FullPrimaryScreenWidth;
146 147
         /// <summary>
147 148
         /// 窗体移动
148 149
         /// </summary>
@@ -161,7 +162,7 @@ namespace XHWK.WKTool
161 162
         {
162 163
             new Thread(o =>
163 164
             {
164
-                string url = ZConfig.apiUrl + "/apprecord/get_new";
165
+                string url = APP.apiUrl + "/apprecord/get_new";
165 166
 
166 167
                 string result = HttpHelper.PostAndRespStr(url, "{}");
167 168
                 Model.ResultVo<Model_App> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_App>>(result);
@@ -169,14 +170,21 @@ namespace XHWK.WKTool
169 170
                 {
170 171
                     if (resultObj.obj != null)
171 172
                     {
172
-                        int versionCode = resultObj.obj.versioncode;
173
-                        int versionThis = ZConfig.versionCode;
174
-                        if (versionThis < versionCode)
173
+                        try
175 174
                         {
176
-                            Dispatcher.Invoke(new Action(() =>
175
+                            int versionCode = resultObj.obj.versioncode;
176
+                            int versionThis = int.Parse(FileToolsCommon.GetConfigValue("VersionCode"));
177
+                            if (versionThis < versionCode)
177 178
                             {
178
-                                appUpdateShow(resultObj.obj);
179
-                            }));
179
+                                Dispatcher.Invoke(new Action(() =>
180
+                                {
181
+                                    appUpdateShow(resultObj.obj);
182
+                                }));
183
+                            }
184
+                        }
185
+                        catch (Exception ex)
186
+                        {
187
+                            LogHelper.WriteErrLog("【检查更新】(getNewApp)版本号错误:" + ex.Message, ex);
180 188
                         }
181 189
                     }
182 190
                 }
@@ -188,9 +196,11 @@ namespace XHWK.WKTool
188 196
         /// <param name="app"></param>
189 197
         private void appUpdateShow(Model_App app)
190 198
         {
191
-            AppUpdateWin win = new AppUpdateWin(app);
192
-            win.Topmost = true;
193
-            win.Owner = this;
199
+            AppUpdateWin win = new AppUpdateWin(app)
200
+            {
201
+                Topmost = true,
202
+                Owner = this
203
+            };
194 204
             win.ShowDialog();
195 205
         }
196 206
         private void Window_Loaded(object sender, RoutedEventArgs e)

+ 28
- 21
XHWK.WKTool/DAL/DAL_Upload.cs Целия файл

@@ -4,13 +4,8 @@ using Common.system;
4 4
 using Newtonsoft.Json.Linq;
5 5
 
6 6
 using System;
7
-using System.Collections.Generic;
8 7
 using System.Collections.Specialized;
9
-using System.IO;
10
-using System.Linq;
11
-using System.Text;
12 8
 using System.Threading;
13
-using System.Threading.Tasks;
14 9
 
15 10
 using XHWK.Model;
16 11
 
@@ -23,9 +18,9 @@ namespace XHWK.WKTool.DAL
23 18
     /// </summary>
24 19
     public class DAL_Upload
25 20
     {
26
-        string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
27
-        string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
28
-        string schoolfileRequestAddress = FileToolsCommon.GetConfigValue("schoolfileRequestAddress");
21
+        //private string APIRequestAddress = APP.apiUrl;
22
+        private string FileRequestAddress = APP.uploadUrl;
23
+        //private string schoolfileRequestAddress = APP.showImageUrl;
29 24
         /// <summary>
30 25
         /// 文件是否允许上传
31 26
         /// </summary>
@@ -40,7 +35,7 @@ namespace XHWK.WKTool.DAL
40 35
             {
41 36
                 try
42 37
                 {
43
-                    JObject jo = HttpHelper.PostFunction(FileRequestAddress /*"http://192.168.2.18:8908"*/ + @"/chunkdb/isexist", @"application/x-www-form-urlencoded", @"md5=" + MD5, "");
38
+                    JObject jo = HttpHelper.PostFunction(FileRequestAddress + @"/chunkdb/isexist", @"application/x-www-form-urlencoded", @"md5=" + MD5, "");
44 39
                     //0成功,1失败
45 40
                     if (jo["code"].ToString() == "0")
46 41
                     {
@@ -87,7 +82,7 @@ namespace XHWK.WKTool.DAL
87 82
             {
88 83
                 try
89 84
                 {
90
-                    JObject jo = HttpHelper.PostFunction(FileRequestAddress /*"http://192.168.2.18:8908"*/ + @"/chunkdb/mergechunk", @"application/x-www-form-urlencoded", @"savefolder=" + Savefolder + "&identifier=" + FileCode, "");
85
+                    JObject jo = HttpHelper.PostFunction(FileRequestAddress + @"/chunkdb/mergechunk", @"application/x-www-form-urlencoded", @"savefolder=" + Savefolder + "&identifier=" + FileCode, "");
91 86
                     Model.ResultVo<Model_ResourceAddTwo> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_ResourceAddTwo>>(jo.ToString()); ;
92 87
                     APP.ResourceAddTwo = new Model_ResourceAddTwo();
93 88
                     //0成功,1失败
@@ -128,24 +123,29 @@ namespace XHWK.WKTool.DAL
128 123
                 foreach (Model_WKData Vdata in APP.WKDataList)
129 124
                 {
130 125
                     if (Vdata.VideoList == null)
126
+                    {
131 127
                         continue;
128
+                    }
129
+
132 130
                     foreach (Model_Video videoinfo in Vdata.VideoList)
133 131
                     {
134
-                        if(videoinfo.FileGuid== VideoGuid)
132
+                        if (videoinfo.FileGuid == VideoGuid)
135 133
                         {
136 134
                             VideoInfo = videoinfo;
137 135
                             break;
138 136
                         }
139 137
                     }
140 138
                     if (VideoInfo != null)
139
+                    {
141 140
                         break;
141
+                    }
142 142
                 }
143
-                if (VideoInfo==null)
143
+                if (VideoInfo == null)
144 144
                 {
145 145
                     ErrMessage = "未找到课程!";
146 146
                     return false;
147 147
                 }
148
-                string UploadUrl = FileRequestAddress /*"http://192.168.2.18:8908" */+ "/chunkdb/upchunk";//zxyceshi
148
+                string UploadUrl = FileRequestAddress + "/chunkdb/upchunk";//zxyceshi
149 149
                 if (VideoInfo.IsUpload)
150 150
                 {
151 151
                     ErrMessage = "视频已上传";
@@ -167,7 +167,7 @@ namespace XHWK.WKTool.DAL
167 167
         /// 上传视频
168 168
         /// </summary>
169 169
         /// <returns></returns>
170
-        public bool UploadVideoTwo(string VideoGuid, out string ErrMessage) 
170
+        public bool UploadVideoTwo(string VideoGuid, out string ErrMessage)
171 171
         {
172 172
             ErrMessage = "";
173 173
             try
@@ -176,7 +176,10 @@ namespace XHWK.WKTool.DAL
176 176
                 foreach (Model_WKData Vdata in APP.WKDataList)
177 177
                 {
178 178
                     if (Vdata.VideoList == null)
179
+                    {
179 180
                         continue;
181
+                    }
182
+
180 183
                     foreach (Model_Video videoinfo in Vdata.VideoList)
181 184
                     {
182 185
                         if (videoinfo.FileGuid == VideoGuid)
@@ -186,14 +189,16 @@ namespace XHWK.WKTool.DAL
186 189
                         }
187 190
                     }
188 191
                     if (VideoInfo != null)
192
+                    {
189 193
                         break;
194
+                    }
190 195
                 }
191 196
                 if (VideoInfo == null)
192 197
                 {
193 198
                     ErrMessage = "未找到课程!";
194 199
                     return false;
195 200
                 }
196
-                string UploadUrl = FileRequestAddress /*"http://192.168.2.18:8908" */+ "/chunkdb/upchunk";//zxyceshi
201
+                string UploadUrl = FileRequestAddress + "/chunkdb/upchunk";//zxyceshi
197 202
                 if (VideoInfo.IsUpload)
198 203
                 {
199 204
                     ErrMessage = "视频已上传";
@@ -255,12 +260,14 @@ namespace XHWK.WKTool.DAL
255 260
                             //取指定长度的流
256 261
                             byte[] byteArray = FileToolsCommon.ReadBigFileSpecifyLength(VideoInfo.VideoPath, len, (int)VideoInfo.SliceLen);
257 262
                             //参数
258
-                            NameValueCollection formFields = new NameValueCollection();
259
-                            formFields.Add("identifier", VideoInfo.FileGuid);
260
-                            formFields.Add("chunkNumber", (VideoInfo.Uploaded + 1).ToString());
261
-                            formFields.Add("filename", fileName);
262
-                            formFields.Add("totalchunk", VideoInfo.Block.ToString());
263
-                            formFields.Add("md5", VideoInfo.FileMD5);
263
+                            NameValueCollection formFields = new NameValueCollection
264
+                            {
265
+                                { "identifier", VideoInfo.FileGuid },
266
+                                { "chunkNumber", (VideoInfo.Uploaded + 1).ToString() },
267
+                                { "filename", fileName },
268
+                                { "totalchunk", VideoInfo.Block.ToString() },
269
+                                { "md5", VideoInfo.FileMD5 }
270
+                            };
264 271
                             VideoInfo.Uploaded++;
265 272
                             //formFields.Add();///教材
266 273
                             //if()//章节若没选不传

+ 36
- 35
XHWK.WKTool/DAL/Interface.cs Целия файл

@@ -1,20 +1,19 @@
1 1
 using Common.system;
2
+
2 3
 using Newtonsoft.Json.Linq;
4
+
3 5
 using System;
4 6
 using System.Collections.Generic;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading.Tasks;
7
+
8 8
 using XHWK.Model;
9
-using XHWK.WKTool.Config;
10 9
 
11 10
 namespace XHWK.WKTool.DAL
12 11
 {
13 12
     public class Interface
14 13
     {
15
-        string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
16
-        string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
17
-        string schoolfileRequestAddress = FileToolsCommon.GetConfigValue("schoolfileRequestAddress");
14
+        //private string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
15
+        //private string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
16
+        //private string schoolfileRequestAddress = FileToolsCommon.GetConfigValue("schoolfileRequestAddress");
18 17
         /// <summary>
19 18
         /// 登陆
20 19
         /// </summary>
@@ -22,7 +21,7 @@ namespace XHWK.WKTool.DAL
22 21
         /// <returns></returns>
23 22
         public int Login(string loginname, string loginpwd)
24 23
         {
25
-            string url = ZConfig.apiUrl + "/user/login";//地址 
24
+            string url = APP.apiUrl + "/user/login";//地址 
26 25
             Dictionary<string, object> dic = new Dictionary<string, object>
27 26
             {
28 27
                 { "loginname", loginname},
@@ -40,7 +39,7 @@ namespace XHWK.WKTool.DAL
40 39
             else
41 40
             {
42 41
                 APP.ServerMsg = "网络异常!";
43
-                APP.UserInfo =new Model_UserInfo();
42
+                APP.UserInfo = new Model_UserInfo();
44 43
                 return 1;
45 44
             }
46 45
         }
@@ -54,7 +53,7 @@ namespace XHWK.WKTool.DAL
54 53
             APP.TsubjectbookList = new List<Model_TsubjectbookList>();
55 54
             try
56 55
             {
57
-                string url = ZConfig.apiUrl + "/tsubjectbook/list";//地址
56
+                string url = APP.apiUrl + "/tsubjectbook/list";//地址
58 57
                 Dictionary<string, int> dic = new Dictionary<string, int>
59 58
                 {
60 59
                     { "teacherid",APP.UserInfo.Userid}
@@ -84,12 +83,12 @@ namespace XHWK.WKTool.DAL
84 83
         /// </summary>
85 84
         /// <param name="request"></param>
86 85
         /// <returns></returns>
87
-        public int DirectorList(int lsbid,int directortype,int createid)
86
+        public int DirectorList(int lsbid, int directortype, int createid)
88 87
         {
89 88
             APP.DirectorList = new List<Model_DirectorList>();
90 89
             try
91 90
             {
92
-                string url = ZConfig.apiUrl + "/director/list";//地址
91
+                string url = APP.apiUrl + "/director/list";//地址
93 92
                 Dictionary<string, int> dic = new Dictionary<string, int>
94 93
                 {
95 94
                     { "lsbid", lsbid },
@@ -126,29 +125,31 @@ namespace XHWK.WKTool.DAL
126 125
             APP.DirectorList = new List<Model_DirectorList>();
127 126
             try
128 127
             {
129
-                string url = ZConfig.apiUrl + "/resource/add";//地址
130
-                Dictionary<string, object> dic = new Dictionary<string, object>();
131
-                //            converted: 0
132
-                //createid: 80
133
-                //directorid: 1009
134
-                //duration: 39
135
-                //imgUrl: ""
136
-                //level: 2
137
-                //lsbid: 40
138
-                //mp4code: "h264"
139
-                //resourcebelong: 3
140
-                //resourceclass: 2
141
-                //resourcecover: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.jpg"
142
-                //resourcename: "weather_pic"
143
-                //resourcesize: 6105268
144
-                //resourcetype: 0
145
-                //resourceurl: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.mp4"
146
-                //schoolid: 12
147
-                //suffix: "mp4"
148
-                //uid: 80
149
-                dic.Add("converted", model.converted);
150
-                dic.Add("createid", model.createid);
151
-                if(model.directorid!=999999)//章节上传可以不选
128
+                string url = APP.apiUrl + "/resource/add";//地址
129
+                Dictionary<string, object> dic = new Dictionary<string, object>
130
+                {
131
+                    //            converted: 0
132
+                    //createid: 80
133
+                    //directorid: 1009
134
+                    //duration: 39
135
+                    //imgUrl: ""
136
+                    //level: 2
137
+                    //lsbid: 40
138
+                    //mp4code: "h264"
139
+                    //resourcebelong: 3
140
+                    //resourceclass: 2
141
+                    //resourcecover: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.jpg"
142
+                    //resourcename: "weather_pic"
143
+                    //resourcesize: 6105268
144
+                    //resourcetype: 0
145
+                    //resourceurl: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.mp4"
146
+                    //schoolid: 12
147
+                    //suffix: "mp4"
148
+                    //uid: 80
149
+                    { "converted", model.converted },
150
+                    { "createid", model.createid }
151
+                };
152
+                if (model.directorid != 999999)//章节上传可以不选
152 153
                 {
153 154
                     dic.Add("directorid", model.directorid);
154 155
                 }

+ 1
- 7
XHWK.WKTool/DAL/ResultVo.cs Целия файл

@@ -1,10 +1,4 @@
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.DAL
1
+namespace XHWK.WKTool.DAL
8 2
 {
9 3
     internal class ResultVo<T>
10 4
     {

+ 12
- 8
XHWK.WKTool/FileDirectoryWindow.xaml.cs Целия файл

@@ -1,13 +1,9 @@
1 1
 using Common.system;
2 2
 
3
-using Org.BouncyCastle.Asn1.Crmf;
4
-
5 3
 using System;
6 4
 using System.Collections.Generic;
7 5
 using System.Collections.ObjectModel;
8 6
 using System.Diagnostics;
9
-using System.Security.AccessControl;
10
-using System.Text;
11 7
 using System.Windows;
12 8
 using System.Windows.Controls;
13 9
 using System.Windows.Input;
@@ -26,7 +22,7 @@ namespace XHWK.WKTool
26 22
         /// <summary>
27 23
         /// 视频模型
28 24
         /// </summary>
29
-        List<Model_Video> model_VideoList = null;
25
+        private List<Model_Video> model_VideoList = null;
30 26
         /// <summary>
31 27
         /// 数据列表
32 28
         /// </summary>
@@ -134,7 +130,10 @@ namespace XHWK.WKTool
134 130
                 foreach (Model_WKData Vdata in APP.WKDataList)
135 131
                 {
136 132
                     if (Vdata.VideoList == null)
133
+                    {
137 134
                         continue;
135
+                    }
136
+
138 137
                     foreach (Model_Video videoinfo in Vdata.VideoList)
139 138
                     {
140 139
                         try
@@ -170,7 +169,7 @@ namespace XHWK.WKTool
170 169
         private void btnDown_Click(object sender, RoutedEventArgs e)
171 170
         {
172 171
             APP.SaveWkData();
173
-            this.Hide();
172
+            Hide();
174 173
         }
175 174
         /// <summary>
176 175
         /// 窗口移动
@@ -240,7 +239,10 @@ namespace XHWK.WKTool
240 239
                     foreach (Model_WKData wKData in APP.WKDataList)
241 240
                     {
242 241
                         if (wKData.VideoList == null)
242
+                        {
243 243
                             continue;
244
+                        }
245
+
244 246
                         if (wKData.VideoList.Exists(x => x.FileGuid == pageData.menuList[i].FileGuid))
245 247
                         {
246 248
                             try
@@ -357,7 +359,8 @@ namespace XHWK.WKTool
357 359
                 }
358 360
             }
359 361
         }
360
-        int MouseNumber = 0;
362
+
363
+        private int MouseNumber = 0;
361 364
         /// <summary>
362 365
         /// 鼠标按下
363 366
         /// </summary>
@@ -442,6 +445,7 @@ namespace XHWK.WKTool
442 445
             //        MouseNumber++;
443 446
             //    }
444 447
         }
448
+
445 449
         /// <summary>
446 450
         /// 修改文件名
447 451
         /// </summary>
@@ -449,7 +453,7 @@ namespace XHWK.WKTool
449 453
         /// <param name="NewName">新文件名带后缀 不带路径</param>
450 454
         /// <param name="Errmessage">错误信息</param>
451 455
         /// <returns></returns>
452
-        bool ModifyPathName(string FileGuid, string NewName, out string Errmessage)
456
+        private bool ModifyPathName(string FileGuid, string NewName, out string Errmessage)
453 457
         {
454 458
             Errmessage = "";
455 459
             Model_Video model_Video = APP.VideoList.Find(x => x.FileGuid == FileGuid);

+ 7
- 2
XHWK.WKTool/JieTuWindow.xaml.cs Целия файл

@@ -2,6 +2,7 @@
2 2
 using ComeCapture.Controls;
3 3
 using ComeCapture.Helpers;
4 4
 using ComeCapture.Models;
5
+
5 6
 using Common.system;
6 7
 
7 8
 
@@ -15,7 +16,9 @@ using System.Windows.Controls;
15 16
 using System.Windows.Input;
16 17
 using System.Windows.Media;
17 18
 using System.Windows.Media.Imaging;
19
+
18 20
 using XHWK.WKTool;
21
+
19 22
 using static XHWK.WKTool.XHMicroLessonSystemWindow;
20 23
 
21 24
 namespace ComeCapture
@@ -82,7 +85,9 @@ namespace ComeCapture
82 85
             }
83 86
             string imagePath = Path.Combine(tempPath, time + ".jpg");
84 87
             if (ImageHelper.GetScreenshot(new Rectangle(0, 0, 0, 0), null, true, out BitmapImage bitmap))
88
+            {
85 89
                 Background = new ImageBrush(bitmap);
90
+            }
86 91
         }
87 92
 
88 93
         public void initialization()
@@ -234,8 +239,8 @@ namespace ComeCapture
234 239
             //string imagePath = ImageHelper.GetImagePath(out string serverSavePath);
235 240
 
236 241
             //BitmapSource bitmap = ImageHelper.GetBitmapSource((int)AppModel.Current.MaskLeftWidth + 1, (int)AppModel.Current.MaskTopHeight + 1, (int)MainImage.ActualWidth - 2, (int)MainImage.ActualHeight - 2, out JieTuBitmapPtr);
237
-           /* BitmapImage bitmap = */
238
-            ImageHelper.GetScreenshot(new Rectangle((int)AppModel.Current.MaskLeftWidth + 1, (int)AppModel.Current.MaskTopHeight + 1, (int)MainImage.ActualWidth - 2, (int)MainImage.ActualHeight - 2), imagePath,true,out BitmapImage bitmapimg);
242
+            /* BitmapImage bitmap = */
243
+            ImageHelper.GetScreenshot(new Rectangle((int)AppModel.Current.MaskLeftWidth + 1, (int)AppModel.Current.MaskTopHeight + 1, (int)MainImage.ActualWidth - 2, (int)MainImage.ActualHeight - 2), imagePath, true, out BitmapImage bitmapimg);
239 244
             _IsMouseDown = false;
240 245
             _IsCapture = false;
241 246
             ImageEditBar.Current.Visibility = Visibility.Collapsed;

+ 1
- 13
XHWK.WKTool/LoadDialog.xaml.cs Целия файл

@@ -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
 {

+ 9
- 8
XHWK.WKTool/LoginWindow.xaml.cs Целия файл

@@ -1,9 +1,10 @@
1 1
 using Common.system;
2
+
2 3
 using System;
3 4
 using System.Configuration;
4
-using System.IO;
5 5
 using System.Text;
6 6
 using System.Windows;
7
+
7 8
 using XHWK.WKTool.DAL;
8 9
 
9 10
 namespace XHWK.WKTool
@@ -22,13 +23,13 @@ namespace XHWK.WKTool
22 23
             InitializeComponent();
23 24
             Initialize();
24 25
         }
25
-        public void Initialize() 
26
+        public void Initialize()
26 27
         {
27 28
 
28 29
             if (FileToolsCommon.IsExistFile(APP.DataPath + "accountNumber.txt"))
29 30
             {
30 31
                 string accountNumber = System.IO.File.ReadAllText(APP.DataPath + "accountNumber.txt", Encoding.Default);
31
-                if(!string.IsNullOrWhiteSpace(accountNumber))
32
+                if (!string.IsNullOrWhiteSpace(accountNumber))
32 33
                 {
33 34
                     txbAccountNumber.Text = accountNumber;
34 35
                     ckSaveName.IsChecked = true;
@@ -49,7 +50,7 @@ namespace XHWK.WKTool
49 50
         {
50 51
             txbAccountNumber.Text = string.Empty;
51 52
             pobPassword.Password = string.Empty;
52
-            this.Hide();
53
+            Hide();
53 54
         }
54 55
         /// <summary>
55 56
         /// 登陆事件
@@ -84,13 +85,13 @@ namespace XHWK.WKTool
84 85
                 password = pobPassword.Password.Replace(" ", "").Trim();
85 86
             }));
86 87
             int code = @interface.Login(accountNumber, password);
87
-            if(code==0)
88
+            if (code == 0)
88 89
             {
89 90
                 FileToolsCommon.CreateDirectory(APP.DataPath);
90 91
                 string applicationData = APP.DataPath + "accountNumber.txt";
91
-                if (ckSaveName.IsChecked==true)
92
+                if (ckSaveName.IsChecked == true)
92 93
                 {
93
-                    
94
+
94 95
                     string accountNumbers = txbAccountNumber.Text;
95 96
                     System.IO.File.WriteAllText(applicationData, accountNumbers, Encoding.Default);//存放账号
96 97
                 }
@@ -128,7 +129,7 @@ namespace XHWK.WKTool
128 129
                 //    }
129 130
                 //}
130 131
                 #endregion
131
-                this.Hide();
132
+                Hide();
132 133
             }
133 134
             else
134 135
             {

+ 8
- 19
XHWK.WKTool/MessageWindow.xaml.cs Целия файл

@@ -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
 {
@@ -25,7 +14,7 @@ namespace XHWK.WKTool
25 14
         /// <param name="MessageType">取消按钮  1不显示2显示</param>
26 15
         /// <param name="Title">标题</param>
27 16
         /// <param name="content">消息内容</param>
28
-        public MessageWindow(int MessageType,string Title,string Content)
17
+        public MessageWindow(int MessageType, string Title, string Content)
29 18
         {
30 19
             InitializeComponent();
31 20
             switch (MessageType)
@@ -42,7 +31,7 @@ namespace XHWK.WKTool
42 31
             lblTitle.Content = Title;
43 32
             if (!string.IsNullOrWhiteSpace(Content))
44 33
             {
45
-                if(Content.Length>143)
34
+                if (Content.Length > 143)
46 35
                 {
47 36
                     Content = Content.Substring(0, 140) + "...";
48 37
                 }
@@ -86,7 +75,7 @@ namespace XHWK.WKTool
86 75
         /// </summary>
87 76
         /// <param name="Message">消息</param>
88 77
         /// <returns></returns>
89
-        public static MessageBoxResult Show(string Message,string Title)
78
+        public static MessageBoxResult Show(string Message, string Title)
90 79
         {
91 80
             MessageWindow message = new MessageWindow(1, Title, Message);
92 81
             message.ShowDialog();
@@ -98,14 +87,14 @@ namespace XHWK.WKTool
98 87
         /// <param name="Title">标题</param>
99 88
         /// <param name="Message">消息</param>
100 89
         /// <returns></returns>
101
-        public static MessageBoxResult Show(string Message,string Title, MessageBoxButton messageBox)
90
+        public static MessageBoxResult Show(string Message, string Title, MessageBoxButton messageBox)
102 91
         {
103 92
             if (string.IsNullOrWhiteSpace(Title))
104 93
             {
105 94
                 Title = "消息提示";
106 95
             }
107
-            MessageWindow message = new MessageWindow(2,Title,Message);
108
-            bool? res= message.ShowDialog();
96
+            MessageWindow message = new MessageWindow(2, Title, Message);
97
+            bool? res = message.ShowDialog();
109 98
             if ((bool)res)
110 99
             {
111 100
                 if (messageBox == MessageBoxButton.OKCancel)
@@ -151,7 +140,7 @@ namespace XHWK.WKTool
151 140
             if (e.LeftButton == MouseButtonState.Pressed)
152 141
             {
153 142
                 //this.DragMove();              
154
-                this.DragMove();
143
+                DragMove();
155 144
             }
156 145
         }
157 146
     }

+ 6
- 12
XHWK.WKTool/MyLicense.cs
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 18
- 21
XHWK.WKTool/PracticeWindow.xaml.cs Целия файл

@@ -1,18 +1,13 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using System.IO;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7 4
 using System.Windows;
8 5
 using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11 6
 using System.Windows.Ink;
12 7
 using System.Windows.Input;
13 8
 using System.Windows.Media;
14 9
 using System.Windows.Media.Imaging;
15
-using System.Windows.Shapes;
10
+
16 11
 using XHWK.Model;
17 12
 
18 13
 namespace XHWK.WKTool
@@ -23,17 +18,18 @@ namespace XHWK.WKTool
23 18
     public partial class PracticeWindow : Window
24 19
     {
25 20
         //声明一个 DrawingAttributes 类型的变量  
26
-        DrawingAttributes drawingAttributes;
21
+        private DrawingAttributes drawingAttributes;
27 22
 
28 23
         private ViewModel viewModel;
29 24
         /// <summary>
30 25
         /// 0 画笔 1 矩形 2 圆形 
31 26
         /// </summary>
32 27
         private int flg = 0;
28
+
33 29
         /// <summary>
34 30
         /// 当前画笔颜色
35 31
         /// </summary>
36
-        Color Colour=Colors.Red;
32
+        private Color Colour = Colors.Red;
37 33
         /// <summary>
38 34
         /// 当前画笔宽
39 35
         /// </summary>
@@ -96,7 +92,7 @@ namespace XHWK.WKTool
96 92
         {
97 93
             //flg = 0;
98 94
             drawingAttributes.Color = Colors.White;
99
-            Colour= Colors.White; 
95
+            Colour = Colors.White;
100 96
         }
101 97
         /// <summary>
102 98
         /// 画笔颜色事件 红色
@@ -197,7 +193,7 @@ namespace XHWK.WKTool
197 193
         /// <summary>
198 194
         /// 橡皮
199 195
         /// </summary>
200
-        public void Eraser() 
196
+        public void Eraser()
201 197
         {
202 198
             flg = 0;
203 199
             //this.type = ZPenType.Erase;
@@ -215,7 +211,7 @@ namespace XHWK.WKTool
215 211
             blackboard_canvas.UseCustomCursor = true;
216 212
             drawingAttributes.FitToCurve = true;
217 213
             drawingAttributes.IgnorePressure = false;
218
-        
214
+
219 215
             blackboard_canvas.Cursor = Cursors.Pen;
220 216
         }
221 217
         /// <summary>
@@ -271,11 +267,12 @@ namespace XHWK.WKTool
271 267
                 }
272 268
             }
273 269
         }
274
-        Stroke StrokeRound;
275
-        Stroke StrokeRectangle; 
270
+
271
+        private Stroke StrokeRound;
272
+        private Stroke StrokeRectangle;
276 273
         private void blackboard_canvas_MouseMove(object sender, MouseEventArgs e)
277 274
         {
278
-            if(flg!=0)
275
+            if (flg != 0)
279 276
             {
280 277
                 if (e.LeftButton == MouseButtonState.Pressed)
281 278
                 {
@@ -297,7 +294,7 @@ namespace XHWK.WKTool
297 294
                         {
298 295
                             DrawingAttributes = blackboard_canvas.DefaultDrawingAttributes.Clone()
299 296
                         };
300
-                        if(StrokeRectangle!=null)
297
+                        if (StrokeRectangle != null)
301 298
                         {
302 299
                             viewModel.InkStrokes.Remove(StrokeRectangle);
303 300
                         }
@@ -316,7 +313,7 @@ namespace XHWK.WKTool
316 313
                             DrawingAttributes = blackboard_canvas.DefaultDrawingAttributes.Clone()
317 314
                         };
318 315
                         //viewModel.InkStrokes.Clear();
319
-                        if(StrokeRound!=null)
316
+                        if (StrokeRound != null)
320 317
                         {
321 318
                             viewModel.InkStrokes.Remove(StrokeRound);
322 319
                         }
@@ -328,7 +325,7 @@ namespace XHWK.WKTool
328 325
         }
329 326
         private List<System.Windows.Point> GenerateEclipseGeometry(System.Windows.Point st, System.Windows.Point ed)
330 327
         {
331
-                double a = 0.5 * (ed.X - st.X);
328
+            double a = 0.5 * (ed.X - st.X);
332 329
             double b = 0.5 * (ed.Y - st.Y);
333 330
             List<System.Windows.Point> pointList = new List<System.Windows.Point>();
334 331
             for (double r = 0; r <= 2 * Math.PI; r = r + 0.01)
@@ -354,7 +351,7 @@ namespace XHWK.WKTool
354 351
         /// <param name="e"></param>
355 352
         private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
356 353
         {
357
-            if (APP.W_ScreenRecordingToolbarWindow.flg==10)
354
+            if (APP.W_ScreenRecordingToolbarWindow.flg == 10)
358 355
             {
359 356
                 APP.W_ScreenRecordingToolbarWindow.flg = 0;
360 357
             }
@@ -362,7 +359,7 @@ namespace XHWK.WKTool
362 359
             {
363 360
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
364 361
             }
365
-            this.Hide();
362
+            Hide();
366 363
         }
367 364
 
368 365
         private void blackboard_canvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
@@ -375,7 +372,7 @@ namespace XHWK.WKTool
375 372
             {
376 373
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
377 374
             }
378
-            this.Hide();
375
+            Hide();
379 376
         }
380 377
 
381 378
         private void blackboard_canvas_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
@@ -388,7 +385,7 @@ namespace XHWK.WKTool
388 385
             {
389 386
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
390 387
             }
391
-            this.Hide();
388
+            Hide();
392 389
         }
393 390
     }
394 391
 }

+ 10
- 21
XHWK.WKTool/PrintWindow.xaml.cs Целия файл

@@ -1,19 +1,11 @@
1 1
 using Common.system;
2
+
2 3
 using System;
3 4
 using System.Collections.Generic;
4 5
 using System.Data;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading.Tasks;
8 6
 using System.Windows;
9
-using System.Windows.Controls;
10
-using System.Windows.Data;
11
-using System.Windows.Documents;
12
-using System.Windows.Forms;
13 7
 using System.Windows.Input;
14
-using System.Windows.Media;
15 8
 using System.Windows.Media.Imaging;
16
-using System.Windows.Shapes;
17 9
 
18 10
 namespace XHWK.WKTool
19 11
 {
@@ -32,7 +24,7 @@ namespace XHWK.WKTool
32 24
             InitializeComponent();
33 25
             string defa = string.Empty;
34 26
             List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
35
-            if(defaList.Count>0)
27
+            if (defaList.Count > 0)
36 28
             {
37 29
                 data.Columns.Add("Value");
38 30
                 data.Columns.Add("Key");
@@ -52,7 +44,7 @@ namespace XHWK.WKTool
52 44
         }
53 45
         public void Initialize(string _imgPath)
54 46
         {
55
-         if(!string.IsNullOrWhiteSpace(_imgPath))
47
+            if (!string.IsNullOrWhiteSpace(_imgPath))
56 48
             {
57 49
                 imgPri.Source = new BitmapImage(new Uri(_imgPath));
58 50
             }
@@ -64,7 +56,7 @@ namespace XHWK.WKTool
64 56
         /// <param name="e"></param>
65 57
         private void BtnPrint_Click(object sender, RoutedEventArgs e)
66 58
         {
67
-            if(string.IsNullOrWhiteSpace(cmbClass.Text))
59
+            if (string.IsNullOrWhiteSpace(cmbClass.Text))
68 60
             {
69 61
                 //MessageWindow.Show("打印机不能为空!");
70 62
                 MessageWindow.Show("打印机不能为空!", "", MessageBoxButton.OKCancel);
@@ -74,15 +66,13 @@ namespace XHWK.WKTool
74 66
             FileToolsCommon.CreateFile(imgPath);
75 67
             string pdf = imgPath + "\\101.pdf";
76 68
             string tpf = imgPath + "\\102.TPF";
77
-            int pr = 1;
78 69
             string msg = string.Empty;
79 70
             string outPut = string.Empty;
80
-            int pyte = 0; //0为方点 1为圆点
81 71
             //if(rbnSquarePoint.IsChecked==false)
82 72
             //{
83 73
             //    pyte = 1;
84 74
             //}
85
-            LatticeFileHelper.GeneratingPDF(pdf, tpf, out pr, out msg, out outPut/*, pyte*/);
75
+            LatticeFileHelper.GeneratingPDF(pdf, tpf, out int pr, out msg, out outPut/*, pyte*/);
86 76
             if (pr == 0)
87 77
             {
88 78
                 //outPut = outPut.Replace("[", "").Replace("]", "").Replace("\"", "").Trim();
@@ -92,19 +82,18 @@ namespace XHWK.WKTool
92 82
                 //{
93 83
                 //    APP.PageDrawList[i].PageCode = page[i];
94 84
                 //}
95
-              
85
+
96 86
                 //string defa = string.Empty;
97 87
                 //List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
98 88
 
99
-                int printResult = 1;
100 89
                 string standardError = string.Empty;
101 90
                 string standardOutput = string.Empty;
102 91
                 int frequency = Convert.ToInt32(txbNumberOfCopies.Text);
103 92
                 //for (int i=0;i< frequency;i++)
104 93
                 //{
105
-                    LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out printResult, out standardError, out standardOutput);
94
+                LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out int printResult, out standardError, out standardOutput);
106 95
                 //}
107
-                if(printResult==0)// 0为成功
96
+                if (printResult == 0)// 0为成功
108 97
                 {
109 98
                     MessageWindow.Show("打印成功", "", MessageBoxButton.OKCancel);
110 99
                 }
@@ -134,7 +123,7 @@ namespace XHWK.WKTool
134 123
         /// <param name="e"></param>
135 124
         private void BtnClose_Click(object sender, RoutedEventArgs e)
136 125
         {
137
-            this.Hide();
126
+            Hide();
138 127
         }
139 128
         /// <summary>
140 129
         /// 减
@@ -144,7 +133,7 @@ namespace XHWK.WKTool
144 133
         private void BtnLess_Click(object sender, RoutedEventArgs e)
145 134
         {
146 135
             int num = Convert.ToInt32(txbNumberOfCopies.Text);
147
-            if(num>1)
136
+            if (num > 1)
148 137
             {
149 138
                 num = num - 1;
150 139
                 txbNumberOfCopies.Text = num.ToString();

+ 1
- 12
XHWK.WKTool/PromptWindow.xaml.cs Целия файл

@@ -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;
10
-using System.Windows.Input;
1
+using System.Windows;
11 2
 using System.Windows.Media;
12
-using System.Windows.Media.Imaging;
13
-using System.Windows.Shapes;
14 3
 
15 4
 namespace XHWK.WKTool
16 5
 {

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs Целия файл

@@ -49,5 +49,5 @@ using System.Windows;
49 49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50 50
 //通过使用 "*",如下所示:
51 51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("1.0.0.0")]
53
-[assembly: AssemblyFileVersion("1.0.0.0")]
52
+[assembly: AssemblyVersion("1.0.7.0")]
53
+[assembly: AssemblyFileVersion("1.0.7.0")]

+ 58
- 48
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Целия файл

@@ -1,16 +1,14 @@
1
-using Aspose.Pdf.Text;
2
-using Common.system;
1
+using Common.system;
3 2
 
4 3
 using System;
5
-using System.Configuration;
6 4
 using System.IO;
7 5
 using System.Threading;
8 6
 using System.Windows;
9 7
 using System.Windows.Forms;
10 8
 using System.Windows.Ink;
11
-using System.Windows.Media;
12 9
 using System.Windows.Media.Imaging;
13 10
 using System.Windows.Threading;
11
+
14 12
 using XHWK.Model;
15 13
 
16 14
 namespace XHWK.WKTool
@@ -24,21 +22,25 @@ namespace XHWK.WKTool
24 22
         /// <summary>
25 23
         /// 视频保存名称
26 24
         /// </summary>
27
-        string VideoSavePathName;
25
+        private string VideoSavePathName;
26
+
28 27
         /// <summary>
29 28
         /// 是否首次录屏
30 29
         /// </summary>
31
-        bool IsFirstRS = true;
30
+        private bool IsFirstRS = true;
31
+
32 32
         /// <summary>
33 33
         /// 是否暂停
34 34
         /// </summary>
35
-        bool IsSuspend = true;
35
+        private bool IsSuspend = true;
36
+
36 37
         /// <summary>
37 38
         /// 视频信息
38 39
         /// </summary>
39
-        Model_Video VideoInfo = null;
40
+        private Model_Video VideoInfo = null;
41
+
40 42
         //声明一个 DrawingAttributes 类型的变量  
41
-        DrawingAttributes drawingAttributes;
43
+        private DrawingAttributes drawingAttributes;
42 44
         private DispatcherTimer t = null;
43 45
         /// <summary>
44 46
         /// 计时器状态
@@ -57,13 +59,12 @@ namespace XHWK.WKTool
57 59
         /// 计时用
58 60
         /// </summary>
59 61
         private TimeSpan _timeSpan = new TimeSpan(0, 0, 0, 0, 0);
60
-
61
-        KeyboardHookCommon k_hook;
62
+        private KeyboardHookCommon k_hook;
62 63
         /// <summary>
63 64
         /// 🖊状态 0红色 1蓝色 10红色批注内 11蓝色批注内
64 65
         /// </summary>
65
-       public int flg = 0;
66
-        System.Timers.Timer timer = new System.Timers.Timer();
66
+        public int flg = 0;
67
+        private System.Timers.Timer timer = new System.Timers.Timer();
67 68
         #endregion
68 69
 
69 70
         #region 初始化
@@ -100,7 +101,7 @@ namespace XHWK.WKTool
100 101
             gridThickness.Visibility = Visibility.Hidden;
101 102
 
102 103
             ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar26.png"));//大圆圈三角形
103
-            ImgEndRecordingScreen.Source= new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
104
+            ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
104 105
             BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
105 106
             imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
106 107
             btnBlackPenOne.IsEnabled = false;//蓝笔不可点击
@@ -122,11 +123,12 @@ namespace XHWK.WKTool
122 123
             //ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar25.png"));
123 124
             //BtnRecordingScreen_Click(null, null);
124 125
         }
125
-        void TimerDealy(object o, EventArgs e)
126
+
127
+        private void TimerDealy(object o, EventArgs e)
126 128
         {
127 129
             Dispatcher.Invoke(() =>
128 130
             {
129
-                if (this.Left > 1630)
131
+                if (Left > 1630)
130 132
                 {
131 133
                     return;
132 134
                 }
@@ -134,17 +136,17 @@ namespace XHWK.WKTool
134 136
                 double mouse_x = Form.MousePosition.X;   //需要添加引用System.Drawing
135 137
                 double mouse_y = Form.MousePosition.Y;
136 138
 
137
-                bool is_in_collasped_range = (mouse_y > this.Left + this.Height) || (mouse_x < this.Left || mouse_x > this.Left + this.Width);//缩起的条件
138
-                bool is_in_visiable_range = (mouse_y < 1 && mouse_x >= this.Left && mouse_x <= this.Left + this.Width); //展开的条件         
139
+                bool is_in_collasped_range = (mouse_y > Left + Height) || (mouse_x < Left || mouse_x > Left + Width);//缩起的条件
140
+                bool is_in_visiable_range = (mouse_y < 1 && mouse_x >= Left && mouse_x <= Left + Width); //展开的条件         
139 141
 
140
-                if (this.Left < 1630 && this.Left >= 0 && is_in_collasped_range)
142
+                if (Left < 1630 && Left >= 0 && is_in_collasped_range)
141 143
                 {
142 144
                     System.Threading.Thread.Sleep(300);
143
-                    this.Left +=20 /*-this.ActualWidth - 3*/;
145
+                    Left += 20 /*-this.ActualWidth - 3*/;
144 146
                 }
145
-                else if (this.Left < 0 && is_in_visiable_range)
147
+                else if (Left < 0 && is_in_visiable_range)
146 148
                 {
147
-                    this.Left = 1;
149
+                    Left = 1;
148 150
                 }
149 151
             });
150 152
         }
@@ -226,7 +228,7 @@ namespace XHWK.WKTool
226 228
         /// <summary>
227 229
         /// 设置录屏文件地址
228 230
         /// </summary>
229
-        void SetUpVideoPathName()
231
+        private void SetUpVideoPathName()
230 232
         {
231 233
             //FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
232 234
             FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
@@ -293,9 +295,11 @@ namespace XHWK.WKTool
293 295
                     }
294 296
                     #endregion
295 297
 
296
-                    VideoInfo = new Model_Video();
297
-                    VideoInfo.VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"));
298
-                    VideoInfo.WkType = Enum_WKVidetype.RecordingScreen;
298
+                    VideoInfo = new Model_Video
299
+                    {
300
+                        VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType")),
301
+                        WkType = Enum_WKVidetype.RecordingScreen
302
+                    };
299 303
                     SetUpVideoPathName();
300 304
                     IsFirstRS = false;
301 305
                     k_hook.Start();//安装键盘钩子
@@ -442,7 +446,7 @@ namespace XHWK.WKTool
442 446
                     string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
443 447
                     FileToolsCommon.CreateDirectory(ThumbnailPath);
444 448
                     //缩略图存储位置
445
-                    string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".","") + ".JPG";
449
+                    string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
446 450
                     new Thread(new ThreadStart(new Action(() =>
447 451
                     {
448 452
                         while (!FileToolsCommon.IsExistFile(VideoSavePathName))
@@ -510,7 +514,7 @@ namespace XHWK.WKTool
510 514
                     flg = 1;
511 515
                     APP.W_PracticeWindow.Hide();
512 516
                 }
513
-                else if(flg==10)
517
+                else if (flg == 10)
514 518
                 {
515 519
                     APP.W_PracticeWindow.Blue();
516 520
                     flg = 11;
@@ -519,12 +523,14 @@ namespace XHWK.WKTool
519 523
                 {
520 524
                     if (APP.W_PracticeWindow == null)
521 525
                     {
522
-                        APP.W_PracticeWindow = new PracticeWindow();
523
-                        //APP.W_PracticeWindow.Topmost = true;
524
-                        APP.W_PracticeWindow.Width = pwidth;
525
-                        APP.W_PracticeWindow.Height = pHeight;
526
-                        APP.W_PracticeWindow.Left = 0;
527
-                        APP.W_PracticeWindow.Top = 0;
526
+                        APP.W_PracticeWindow = new PracticeWindow
527
+                        {
528
+                            //APP.W_PracticeWindow.Topmost = true;
529
+                            Width = pwidth,
530
+                            Height = pHeight,
531
+                            Left = 0,
532
+                            Top = 0
533
+                        };
528 534
                         //practiceWin.Owner = this;
529 535
                     }
530 536
                     APP.W_PracticeWindow.Initialize(imagePath);
@@ -770,7 +776,7 @@ namespace XHWK.WKTool
770 776
                     flg = 0;
771 777
                     APP.W_PracticeWindow.Hide();
772 778
                 }
773
-                else if(flg==11)
779
+                else if (flg == 11)
774 780
                 {
775 781
                     flg = 10;
776 782
                     APP.W_PracticeWindow.Red();
@@ -779,12 +785,14 @@ namespace XHWK.WKTool
779 785
                 {
780 786
                     if (APP.W_PracticeWindow == null)
781 787
                     {
782
-                        APP.W_PracticeWindow = new PracticeWindow();
783
-                        //APP.W_PracticeWindow.Topmost = true;
784
-                        APP.W_PracticeWindow.Width = pwidth;
785
-                        APP.W_PracticeWindow.Height = pHeight;
786
-                        APP.W_PracticeWindow.Left = 0;
787
-                        APP.W_PracticeWindow.Top = 0;
788
+                        APP.W_PracticeWindow = new PracticeWindow
789
+                        {
790
+                            //APP.W_PracticeWindow.Topmost = true;
791
+                            Width = pwidth,
792
+                            Height = pHeight,
793
+                            Left = 0,
794
+                            Top = 0
795
+                        };
788 796
                         //practiceWin.Owner = this;
789 797
                     }
790 798
                     APP.W_PracticeWindow.Initialize(imagePath);
@@ -824,12 +832,14 @@ namespace XHWK.WKTool
824 832
                 {
825 833
                     if (APP.W_PracticeWindow == null)
826 834
                     {
827
-                        APP.W_PracticeWindow = new PracticeWindow();
828
-                        //APP.W_PracticeWindow.Topmost = true;
829
-                        APP.W_PracticeWindow.Width = pwidth;
830
-                        APP.W_PracticeWindow.Height = pHeight;
831
-                        APP.W_PracticeWindow.Left = 0;
832
-                        APP.W_PracticeWindow.Top = 0;
835
+                        APP.W_PracticeWindow = new PracticeWindow
836
+                        {
837
+                            //APP.W_PracticeWindow.Topmost = true;
838
+                            Width = pwidth,
839
+                            Height = pHeight,
840
+                            Left = 0,
841
+                            Top = 0
842
+                        };
833 843
                         //practiceWin.Owner = this;
834 844
                     }
835 845
                     APP.W_PracticeWindow.Initialize(imagePath);
@@ -864,7 +874,7 @@ namespace XHWK.WKTool
864 874
                 APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
865 875
             }
866 876
             APP.W_XHMicroLessonSystemWindow.Show();
867
-            this.Hide();
877
+            Hide();
868 878
         }
869 879
     }
870 880
 }

+ 25
- 30
XHWK.WKTool/UploadWindow.xaml.cs Целия файл

@@ -1,18 +1,11 @@
1 1
 using Common.system;
2
+
2 3
 using System;
3
-using System.Collections.Generic;
4 4
 using System.Collections.ObjectModel;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading.Tasks;
8 5
 using System.Windows;
9 6
 using System.Windows.Controls;
10
-using System.Windows.Data;
11
-using System.Windows.Documents;
12 7
 using System.Windows.Input;
13
-using System.Windows.Media;
14
-using System.Windows.Media.Imaging;
15
-using System.Windows.Shapes;
8
+
16 9
 using XHWK.Model;
17 10
 using XHWK.WKTool.DAL;
18 11
 
@@ -54,7 +47,7 @@ namespace XHWK.WKTool
54 47
         /// <summary>
55 48
         /// 初始化
56 49
         /// </summary>
57
-        public void Initialize(string _resourcename,long _resourcesize,string _suffix,string _guid) 
50
+        public void Initialize(string _resourcename, long _resourcesize, string _suffix, string _guid)
58 51
         {
59 52
             Resourcename = _resourcename;
60 53
             Resourcesize = _resourcesize;
@@ -94,11 +87,11 @@ namespace XHWK.WKTool
94 87
         private void Director()
95 88
         {
96 89
             int selectIndex = book_list.SelectedIndex;
97
-            if(selectIndex<0)
90
+            if (selectIndex < 0)
98 91
             {
99 92
                 selectIndex = 0;
100 93
             }
101
-            int code = @interface.DirectorList(APP.TsubjectbookList[selectIndex].Lsbid,2,APP.UserInfo.Userid);
94
+            int code = @interface.DirectorList(APP.TsubjectbookList[selectIndex].Lsbid, 2, APP.UserInfo.Userid);
102 95
             if (code == 0)
103 96
             {
104 97
                 pageData.zhangjieList.Clear();
@@ -181,7 +174,7 @@ namespace XHWK.WKTool
181 174
 
182 175
         private void BtnDown_Click(object sender, RoutedEventArgs e)
183 176
         {
184
-            this.Hide();
177
+            Hide();
185 178
         }
186 179
         /// <summary>
187 180
         /// 上传到个人空间
@@ -216,23 +209,25 @@ namespace XHWK.WKTool
216 209
                     //schoolid: 12
217 210
                     //suffix: "mp4"
218 211
                     //uid: 80
219
-                    Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd();
220
-                    model_ResourceAdd.converted = 0;
221
-                    model_ResourceAdd.createid = APP.UserInfo.Userid;
222
-                    model_ResourceAdd.directorid = Convert.ToInt32(cmbTeachingMaterial.SelectedValue.ToString());
223
-                    model_ResourceAdd.duration = APP.ResourceAddTwo.duration;
224
-                    model_ResourceAdd.imgUrl = "";
225
-                    model_ResourceAdd.level = 2;
226
-                    model_ResourceAdd.lsbid = Convert.ToInt32(book_list.SelectedValue.ToString());
227
-                    model_ResourceAdd.mp4code = APP.ResourceAddTwo.mp4code;
228
-                    model_ResourceAdd.resourcebelong = 3;
229
-                    model_ResourceAdd.resourceclass = 2;
230
-                    model_ResourceAdd.resourcecover = APP.ResourceAddTwo.coverpath;
231
-                    model_ResourceAdd.resourcename = Resourcename;
232
-                    model_ResourceAdd.resourcesize = Resourcesize;//zxy 文件大小
233
-                    model_ResourceAdd.resourcetype = 0;
234
-                    model_ResourceAdd.resourceurl = APP.ResourceAddTwo.videopath;
235
-                    model_ResourceAdd.schoolid = APP.UserInfo.Schoolid;
212
+                    Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd
213
+                    {
214
+                        converted = 0,
215
+                        createid = APP.UserInfo.Userid,
216
+                        directorid = Convert.ToInt32(cmbTeachingMaterial.SelectedValue.ToString()),
217
+                        duration = APP.ResourceAddTwo.duration,
218
+                        imgUrl = "",
219
+                        level = 2,
220
+                        lsbid = Convert.ToInt32(book_list.SelectedValue.ToString()),
221
+                        mp4code = APP.ResourceAddTwo.mp4code,
222
+                        resourcebelong = 3,
223
+                        resourceclass = 2,
224
+                        resourcecover = APP.ResourceAddTwo.coverpath,
225
+                        resourcename = Resourcename,
226
+                        resourcesize = Resourcesize,//zxy 文件大小
227
+                        resourcetype = 0,
228
+                        resourceurl = APP.ResourceAddTwo.videopath,
229
+                        schoolid = APP.UserInfo.Schoolid
230
+                    };
236 231
                     if (Suffix.Equals("FLV"))
237 232
                     {
238 233
                         Suffix = "flv";

+ 461
- 368
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 0
- 1
XHWK.WKTool/XHWK.WKTool.csproj Целия файл

@@ -173,7 +173,6 @@
173 173
       <DependentUpon>CreateAMicroLessonWindow.xaml</DependentUpon>
174 174
       <SubType>Code</SubType>
175 175
     </Compile>
176
-    <Compile Include="ZConfig.cs" />
177 176
     <Page Include="AppUpdateWin.xaml">
178 177
       <Generator>MSBuild:Compile</Generator>
179 178
       <SubType>Designer</SubType>

+ 0
- 51
XHWK.WKTool/ZConfig.cs Целия файл

@@ -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 = 7;
17
-
18
-        public static string versionName = "1.0.6";
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
-}

Loading…
Отказ
Запис