Browse Source

日志配置和C++环境监测

tags/对接微服务前
张剑 3 years ago
parent
commit
0dc0bfa8fa

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

5
   </startup>
5
   </startup>
6
   <appSettings>
6
   <appSettings>
7
     <!--0正式 1测试-->
7
     <!--0正式 1测试-->
8
-    <add key="IsDebug" value="1" />
8
+    <add key="IsDebug" value="0" />
9
     <!--参数是否加密 0不加密 1加密-->
9
     <!--参数是否加密 0不加密 1加密-->
10
     <add key="IsParameterEncryption" value="0" />
10
     <add key="IsParameterEncryption" value="0" />
11
     <!--版本号-->
11
     <!--版本号-->
12
-    <add key="VersionCode" value="92" />
13
-    <add key="VersionName" value="3.0.0" />
12
+    <add key="VersionCode" value="97" />
13
+    <add key="VersionName" value="3.1.3" />
14
     <!--皮肤样式 0白 1蓝 2黑色 -->
14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15
     <add key="SkinStyle" value="0" />
15
     <add key="SkinStyle" value="0" />
16
     <!--是否输出视频记录日志:0否-->
16
     <!--是否输出视频记录日志:0否-->
17
     <add key="OutputVideoLog" value="0" />
17
     <add key="OutputVideoLog" value="0" />
18
     <!--是否输出其他测试日志-->
18
     <!--是否输出其他测试日志-->
19
-    <add key="IsOutputInfoLog" value="0" />
19
+    <add key="IsOutputInfoLog" value="1" />
20
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
20
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
21
     <add key="VideoSavePath" value="D:\星火微课" />
21
     <add key="VideoSavePath" value="D:\星火微课" />
22
     <!--视频格式 1、MP4 2、FlV 3、AVI-->
22
     <!--视频格式 1、MP4 2、FlV 3、AVI-->

+ 11
- 6
XHWK.WKTool/App.xaml.cs View File

328
         public APP()
328
         public APP()
329
         {
329
         {
330
             Console.WriteLine("初始化APP");
330
             Console.WriteLine("初始化APP");
331
+            LogHelper.InitLog4Net();
331
             myloading = new LoadDialog();
332
             myloading = new LoadDialog();
332
             StopSameProcess();
333
             StopSameProcess();
333
             Killffmpeg();
334
             Killffmpeg();
435
         /// <summary>
436
         /// <summary>
436
         /// 错误处理
437
         /// 错误处理
437
         /// </summary>
438
         /// </summary>
438
-        /// <param name="sender"></param>
439
-        /// <param name="e"></param>
439
+        /// <param name="sender">
440
+        /// </param>
441
+        /// <param name="e">
442
+        /// </param>
440
         private void MyApp_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
443
         private void MyApp_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
441
         {
444
         {
442
             LogHelper.WriteErrLog("未标示错误:" + e.Exception.Message, e.Exception);
445
             LogHelper.WriteErrLog("未标示错误:" + e.Exception.Message, e.Exception);
504
                         VideoList = new List<Model_Video>();
507
                         VideoList = new List<Model_Video>();
505
                         WKData.VideoList = WKData.VideoList.Where((x, i) => WKData.VideoList.FindIndex(z => z.FileGuid == x.FileGuid) == i).ToList();
508
                         WKData.VideoList = WKData.VideoList.Where((x, i) => WKData.VideoList.FindIndex(z => z.FileGuid == x.FileGuid) == i).ToList();
506
                         VideoList = WKData.VideoList;
509
                         VideoList = WKData.VideoList;
507
-                        //List<Model_Video> companyList = WKData.VideoList;
508
-                        //VideoList = companyList.Where((x, i) => companyList.FindIndex(z => z.FileGuid == x.FileGuid) == i).ToList();
509
-                        //VideoList = companyList.Distinct().ToList();
510
                     }
510
                     }
511
                 }
511
                 }
512
             }
512
             }
557
                     string PageDataXmlStr = FileToolsCommon.FileToString(SavePath);
557
                     string PageDataXmlStr = FileToolsCommon.FileToString(SavePath);
558
                     PageDrawList = XmlUtilHelper.DESerializer<List<Model_DrawData>>(PageDataXmlStr);
558
                     PageDrawList = XmlUtilHelper.DESerializer<List<Model_DrawData>>(PageDataXmlStr);
559
                 }
559
                 }
560
+                else
561
+                {
562
+                    PageDrawList = new List<Model_DrawData>();
563
+                }
560
             }
564
             }
561
             catch (Exception ex)
565
             catch (Exception ex)
562
             {
566
             {
643
         /// <summary>
647
         /// <summary>
644
         /// 内存释放压缩
648
         /// 内存释放压缩
645
         /// </summary>
649
         /// </summary>
646
-        /// <param name="e"></param>
650
+        /// <param name="e">
651
+        /// </param>
647
         protected override void OnStartup(StartupEventArgs e)
652
         protected override void OnStartup(StartupEventArgs e)
648
         {
653
         {
649
             new Thread(o =>
654
             new Thread(o =>

+ 101
- 78
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs View File

2
 
2
 
3
 using System;
3
 using System;
4
 using System.Threading;
4
 using System.Threading;
5
+using System.Threading.Tasks;
5
 using System.Windows;
6
 using System.Windows;
6
 using System.Windows.Forms;
7
 using System.Windows.Forms;
7
 using System.Windows.Input;
8
 using System.Windows.Input;
17
     public partial class CreateAMicroLessonWindow : Window
18
     public partial class CreateAMicroLessonWindow : Window
18
     {
19
     {
19
         #region 字段
20
         #region 字段
21
+
20
         private FolderBrowserDialog ofd;
22
         private FolderBrowserDialog ofd;
21
         private DialogResult result;
23
         private DialogResult result;
22
-        #endregion
24
+
25
+        #endregion 字段
26
+
23
         /// <summary>
27
         /// <summary>
24
         /// 创建微课
28
         /// 创建微课
25
         /// </summary>
29
         /// </summary>
27
         {
31
         {
28
             InitializeComponent();
32
             InitializeComponent();
29
             ResizeMode = ResizeMode.NoResize;
33
             ResizeMode = ResizeMode.NoResize;
30
-       
34
+
31
             //if (!APP.CheckScreenCapturerRecorder())
35
             //if (!APP.CheckScreenCapturerRecorder())
32
             //{
36
             //{
33
             //    MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
37
             //    MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
40
         }
44
         }
41
 
45
 
42
         #region 轮播图
46
         #region 轮播图
47
+
43
         /// <summary>
48
         /// <summary>
44
         /// 图片宽度,每次切换的宽度
49
         /// 图片宽度,每次切换的宽度
45
         /// </summary>
50
         /// </summary>
46
-        double ImgWidth = 502.00;
51
+        private double ImgWidth = 502.00;
52
+
47
         /// <summary>
53
         /// <summary>
48
         /// 轮播时移动增加的宽度
54
         /// 轮播时移动增加的宽度
49
         /// </summary>
55
         /// </summary>
50
-        double ImgMove = 1;
56
+        private double ImgMove = 1;
57
+
51
         /// <summary>
58
         /// <summary>
52
         /// 当前展示的图片序号Index从0开始
59
         /// 当前展示的图片序号Index从0开始
53
         /// </summary>
60
         /// </summary>
54
-        int ImgNumIndex = 0;
61
+        private int ImgNumIndex = 0;
62
+
55
         /// <summary>
63
         /// <summary>
56
         /// 加载录播图
64
         /// 加载录播图
57
         /// </summary>
65
         /// </summary>
58
-        void LoadingCarouseImg()
66
+        private void LoadingCarouseImg()
59
         {
67
         {
60
             new Thread(new ThreadStart(new Action(() =>
68
             new Thread(new ThreadStart(new Action(() =>
61
             {
69
             {
71
                 });
79
                 });
72
             }))).Start();
80
             }))).Start();
73
         }
81
         }
82
+
74
         /// <summary>
83
         /// <summary>
75
         /// 轮播图
84
         /// 轮播图
76
         /// </summary>
85
         /// </summary>
77
-        void CarouseImg()
86
+        private void CarouseImg()
78
         {
87
         {
79
             new Thread(new ThreadStart(new Action(() =>
88
             new Thread(new ThreadStart(new Action(() =>
80
             {
89
             {
81
-                while(true)
90
+                while (true)
82
                 {
91
                 {
83
                     for (double i = ImgMove; i < ImgWidth; i += ImgMove)
92
                     for (double i = ImgMove; i < ImgWidth; i += ImgMove)
84
                     {
93
                     {
86
                         {
95
                         {
87
                             if (Math.Abs(i + ImgMove) < ImgWidth)
96
                             if (Math.Abs(i + ImgMove) < ImgWidth)
88
                             {
97
                             {
89
-                            //图片移动轮播
90
-                            SplCarouse.Margin = new Thickness(SplCarouse.Margin.Left - ImgMove, 0, 0, 0);
98
+                                //图片移动轮播
99
+                                SplCarouse.Margin = new Thickness(SplCarouse.Margin.Left - ImgMove, 0, 0, 0);
91
                             }
100
                             }
92
                             else
101
                             else
93
                             {
102
                             {
120
                         break;
129
                         break;
121
                     }
130
                     }
122
                 }
131
                 }
123
-
124
             }))).Start();
132
             }))).Start();
125
         }
133
         }
134
+
126
         /// <summary>
135
         /// <summary>
127
         /// 轮播图切换
136
         /// 轮播图切换
128
         /// </summary>
137
         /// </summary>
129
-        /// <param name="sender"></param>
130
-        /// <param name="e"></param>
138
+        /// <param name="sender">
139
+        /// </param>
140
+        /// <param name="e">
141
+        /// </param>
131
         private void TimesCarouse_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
142
         private void TimesCarouse_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
132
         {
143
         {
133
             //SplCarouse
144
             //SplCarouse
134
             //ImgCarouse1
145
             //ImgCarouse1
135
         }
146
         }
136
-        #endregion
147
+
148
+        #endregion 轮播图
137
 
149
 
138
         #region 事件
150
         #region 事件
151
+
139
         /// <summary>
152
         /// <summary>
140
         /// 关闭
153
         /// 关闭
141
         /// </summary>
154
         /// </summary>
142
-        /// <param name="sender"></param>
143
-        /// <param name="e"></param>
155
+        /// <param name="sender">
156
+        /// </param>
157
+        /// <param name="e">
158
+        /// </param>
144
         private void BtnDown_Click(object sender, RoutedEventArgs e)
159
         private void BtnDown_Click(object sender, RoutedEventArgs e)
145
         {
160
         {
146
             MessageBoxResult dr = MessageWindow.Show("确定退出系统?", "提示", MessageBoxButton.OKCancel);
161
             MessageBoxResult dr = MessageWindow.Show("确定退出系统?", "提示", MessageBoxButton.OKCancel);
153
                 return;
168
                 return;
154
             }
169
             }
155
         }
170
         }
171
+
156
         /// <summary>
172
         /// <summary>
157
         /// 浏览
173
         /// 浏览
158
         /// </summary>
174
         /// </summary>
159
-        /// <param name="sender"></param>
160
-        /// <param name="e"></param>
175
+        /// <param name="sender">
176
+        /// </param>
177
+        /// <param name="e">
178
+        /// </param>
161
         private void BtnBrowse_Click(object sender, RoutedEventArgs e)
179
         private void BtnBrowse_Click(object sender, RoutedEventArgs e)
162
         {
180
         {
163
             //string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
181
             //string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
175
                 }
193
                 }
176
             }
194
             }
177
         }
195
         }
178
-        bool IsPressButton = false;
196
+
197
+        private bool IsPressButton = false;
198
+
179
         /// <summary>
199
         /// <summary>
180
         /// 开始
200
         /// 开始
181
         /// </summary>
201
         /// </summary>
182
-        /// <param name="sender"></param>
183
-        /// <param name="e"></param>
184
-        private void BtnStart_Click(object sender, RoutedEventArgs e)
202
+        /// <param name="sender">
203
+        /// </param>
204
+        /// <param name="e">
205
+        /// </param>
206
+        private async void BtnStart_Click(object sender, RoutedEventArgs e)
185
         {
207
         {
186
             #region 防止连击
208
             #region 防止连击
209
+
187
             if (IsPressButton)
210
             if (IsPressButton)
188
             {
211
             {
189
                 return;
212
                 return;
197
                     IsPressButton = false;
220
                     IsPressButton = false;
198
                 }))).Start();
221
                 }))).Start();
199
             }
222
             }
200
-            #endregion
223
+
224
+            #endregion 防止连击
225
+
201
             #region 合法性判断
226
             #region 合法性判断
227
+
202
             if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
228
             if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
203
             {
229
             {
204
                 MessageWindow.Show("讲解名称不可为空!");
230
                 MessageWindow.Show("讲解名称不可为空!");
218
                 MessageWindow.Show("路径无法访问,解决方案:\r\n1,检查路径是否可访问。\r\n2,关闭杀毒软件或信任软件。");
244
                 MessageWindow.Show("路径无法访问,解决方案:\r\n1,检查路径是否可访问。\r\n2,关闭杀毒软件或信任软件。");
219
                 return;
245
                 return;
220
             }
246
             }
221
-            #endregion
247
+
248
+            #endregion 合法性判断
249
+
222
             LblCreate.Visibility = Visibility.Visible;
250
             LblCreate.Visibility = Visibility.Visible;
223
             string wkpath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
251
             string wkpath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
224
             string StoragePath = txbStoragePath.Text;
252
             string StoragePath = txbStoragePath.Text;
225
-            new Thread(new ThreadStart(new Action(() =>
253
+            string WkName = txbExplainName.Text;
254
+            await Task.Run(() =>
226
             {
255
             {
227
-                //读取微课数据
228
-                APP.ReadWkData(wkpath);
229
-                if (APP.WKData == null)
256
+                try
230
                 {
257
                 {
231
-                    Dispatcher.Invoke(() =>
258
+                    //读取微课数据
259
+                    APP.ReadWkData(wkpath);
260
+                    if (APP.WKData == null)
232
                     {
261
                     {
233
-                        APP.WKData = new Model.Model_WKData
262
+                        APP.WKData = new Model_WKData
234
                         {
263
                         {
235
                             WkPath = wkpath,
264
                             WkPath = wkpath,
236
-                            WkName = txbExplainName.Text,
265
+                            WkName = WkName,
237
                             WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
266
                             WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
238
                         };
267
                         };
239
-                    });
240
-                }
241
-                //创建文件夹
242
-                FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
243
-                FileToolsCommon.DeleteDirectory(wkpath + "temp");
244
-                FileToolsCommon.DeleteDirectory(wkpath + "temprs");
245
-                //存储文件
246
-                FileToolsCommon.SetConfigValue("VideoSavePath", StoragePath);
247
-                APP.ReadDrawData();
248
-                #region 微课不允许有多个视频 废弃
249
-                ////判断微课是否存在,存在则询问
250
-                //if (APP.WKDataList != null&& APP.WKDataList.Count>0)
251
-                //{
252
-                //    if (APP.WKDataList.Exists(x => x.WkName == APP.WKData.WkName))
253
-                //    {
254
-                //        MessageBoxResult dr = MessageWindow.Show("此微课已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
255
-                //        if (dr == MessageBoxResult.OK)
256
-                //        {
257
-                //            FileToolsCommon.DeleteDirectory(APP.WKData.WkPath);
258
-                //            FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
259
-                //            APP.WKDataList.RemoveAll(x => x.WkName == APP.WKData.WkName);
260
-                //        }
261
-                //        else
262
-                //        {
263
-                //            return;
264
-                //        }
265
-                //    }
266
-                //}
267
-                #endregion
268
+                    }
268
 
269
 
269
-                Dispatcher.Invoke(() =>
270
-                {
271
-                    if (APP.W_XHMicroLessonSystemWindow == null)
270
+                    try
272
                     {
271
                     {
273
-                        //double proportion = 1036.0 / 1276.0;
274
-                        APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
275
-                        //APP.W_XHMicroLessonSystemWindow.Width = proportion * (PrimaryScreen.ScaleScreenSize().Height-40);
276
-                        //APP.W_XHMicroLessonSystemWindow.Height =/*1276-*/ PrimaryScreen.ScaleScreenSize().Height-40;
277
-                        //APP.W_XHMicroLessonSystemWindow .Topmost = true;
272
+                        //创建文件夹
273
+                        FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
274
+                        FileToolsCommon.DeleteDirectory(wkpath + "temp");
275
+                        FileToolsCommon.DeleteDirectory(wkpath + "temprs");
278
                     }
276
                     }
279
-                    APP.W_XHMicroLessonSystemWindow.Show();
280
-                    LblCreate.Visibility = Visibility.Hidden;
281
-                    Hide();
282
-                });
283
-            }))).Start();
277
+                    catch (Exception ex)
278
+                    {
279
+                        LogHelper.WriteErrLog("【微课创建课程】文件夹创建删除失败:" + ex.Message, ex);
280
+                    }
281
+
282
+                    //存储文件
283
+                    FileToolsCommon.SetConfigValue("VideoSavePath", StoragePath);
284
+
285
+                    APP.ReadDrawData();
286
+                }
287
+                catch (Exception ex)
288
+                {
289
+                    LogHelper.WriteErrLog("【微课创建课程】读取课堂数据失败:" + ex.Message, ex);
290
+                }
291
+            });
292
+
293
+            if (APP.W_XHMicroLessonSystemWindow == null)
294
+            {
295
+                APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
296
+            }
297
+            APP.W_XHMicroLessonSystemWindow.Show();
298
+            LblCreate.Visibility = Visibility.Hidden;
299
+            Hide();
284
         }
300
         }
285
 
301
 
286
         private double screeHeight = SystemParameters.FullPrimaryScreenHeight;
302
         private double screeHeight = SystemParameters.FullPrimaryScreenHeight;
287
         private double screeWidth = SystemParameters.FullPrimaryScreenWidth;
303
         private double screeWidth = SystemParameters.FullPrimaryScreenWidth;
304
+
288
         /// <summary>
305
         /// <summary>
289
         /// 窗体移动
306
         /// 窗体移动
290
         /// </summary>
307
         /// </summary>
291
-        /// <param name="sender"></param>
292
-        /// <param name="e"></param>
308
+        /// <param name="sender">
309
+        /// </param>
310
+        /// <param name="e">
311
+        /// </param>
293
         private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
312
         private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
294
         {
313
         {
295
             DragMove();
314
             DragMove();
296
         }
315
         }
297
-        #endregion
316
+
317
+        #endregion 事件
298
 
318
 
299
         /// <summary>
319
         /// <summary>
300
         /// 检测APP更新
320
         /// 检测APP更新
340
                 }
360
                 }
341
             }).Start();
361
             }).Start();
342
         }
362
         }
363
+
343
         /// <summary>
364
         /// <summary>
344
         /// 应用更新
365
         /// 应用更新
345
         /// </summary>
366
         /// </summary>
346
-        /// <param name="app"></param>
367
+        /// <param name="app">
368
+        /// </param>
347
         private void appUpdateShow(Model_App app)
369
         private void appUpdateShow(Model_App app)
348
         {
370
         {
349
             AppUpdateWin win = new AppUpdateWin(app)
371
             AppUpdateWin win = new AppUpdateWin(app)
353
             };
375
             };
354
             win.Show();
376
             win.Show();
355
         }
377
         }
378
+
356
         private void Window_Loaded(object sender, RoutedEventArgs e)
379
         private void Window_Loaded(object sender, RoutedEventArgs e)
357
         {
380
         {
358
             getNewApp();
381
             getNewApp();
359
         }
382
         }
360
     }
383
     }
361
-}
384
+}

+ 2
- 5
XHWK.WKTool/LoginWindow.xaml.cs View File

105
         {
105
         {
106
             string accountNumber = string.Empty;
106
             string accountNumber = string.Empty;
107
             string password = string.Empty;
107
             string password = string.Empty;
108
-            Dispatcher.Invoke(new Action(() =>
109
-            {
110
-                accountNumber = txbAccountNumber.Text.Replace(" ", "").Trim();
111
-                password = pobPassword.Password.Replace(" ", "").Trim();
112
-            }));
108
+            accountNumber = txbAccountNumber.Text.Replace(" ", "").Trim();
109
+            password = pobPassword.Password.Replace(" ", "").Trim();
113
 
110
 
114
             int code = @interface.Login(accountNumber, password);
111
             int code = @interface.Login(accountNumber, password);
115
             if (code == 0)
112
             if (code == 0)

+ 1
- 1
XHWK.WKTool/MessageWindow.xaml View File

19
     WindowStyle="None"
19
     WindowStyle="None"
20
     mc:Ignorable="d">
20
     mc:Ignorable="d">
21
 
21
 
22
-    <Border BorderBrush="#eeeeee" BorderThickness="1">
22
+    <Border BorderBrush="#3f6fff" BorderThickness="1">
23
         <Grid>
23
         <Grid>
24
             <Grid.RowDefinitions>
24
             <Grid.RowDefinitions>
25
                 <RowDefinition Height="42" />
25
                 <RowDefinition Height="42" />

+ 3
- 0
XHWK.WKTool/XHWK.WKTool.csproj View File

479
     <EmbeddedResource Include="LatticeXML\S0_O000_B0000_P000-255.tmx">
479
     <EmbeddedResource Include="LatticeXML\S0_O000_B0000_P000-255.tmx">
480
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
480
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
481
     </EmbeddedResource>
481
     </EmbeddedResource>
482
+    <None Include="log4net.config">
483
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
484
+    </None>
482
     <None Include="packages.config" />
485
     <None Include="packages.config" />
483
     <None Include="Properties\app.manifest" />
486
     <None Include="Properties\app.manifest" />
484
     <None Include="Properties\Settings.settings">
487
     <None Include="Properties\Settings.settings">

+ 52
- 0
XHWK.WKTool/log4net.config View File

1
+<?xml version="1.0" encoding="utf-8" ?>
2
+<log4net>
3
+  <!--错误日志类-->
4
+  <logger name="logerror">
5
+    <!--日志类的名字-->
6
+    <level value="ALL" />
7
+    <!--定义记录的日志级别-->
8
+    <appender-ref ref="ErrorAppender" />
9
+    <!--记录到哪个介质中去-->
10
+  </logger>
11
+  <!--信息日志类-->
12
+  <logger name="loginfo">
13
+    <level value="ALL" />
14
+    <appender-ref ref="InfoAppender" />
15
+  </logger>
16
+  <!--错误日志附加介质-->
17
+  <appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
18
+    <!-- name属性指定其名称,type则是log4net.Appender命名空间的一个类的名称,意思是,指定使用哪种介质-->
19
+    <param name="File" value="Log\\LogError\\" />
20
+    <!--日志输出到exe程序这个相对目录下-->
21
+    <param name="AppendToFile" value="true" />
22
+    <!--输出的日志不会覆盖以前的信息-->
23
+    <param name="MaxSizeRollBackups" value="100" />
24
+    <!--备份文件的个数-->
25
+    <param name="MaxFileSize" value="10240" />
26
+    <!--当个日志文件的最大大小-->
27
+    <param name="StaticLogFileName" value="false" />
28
+    <!--是否使用静态文件名-->
29
+    <param name="DatePattern" value="yyyyMMdd&quot;.htm&quot;" />
30
+    <!--日志文件名-->
31
+    <param name="RollingStyle" value="Date" />
32
+    <!--文件创建的方式,这里是以Date方式创建-->
33
+    <!--错误日志布局-->
34
+    <layout type="log4net.Layout.PatternLayout">
35
+      <param name="ConversionPattern" value="&lt;HR COLOR=red&gt;%n异常时间:%d [%t] &lt;BR&gt;%n异常级别:%-5p &lt;BR&gt;%n异 常 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n" />
36
+    </layout>
37
+  </appender>
38
+  <!--信息日志附加介质-->
39
+  <appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
40
+    <param name="File" value="Log\\LogInfo\\" />
41
+    <param name="AppendToFile" value="true" />
42
+    <param name="MaxFileSize" value="10240" />
43
+    <param name="MaxSizeRollBackups" value="100" />
44
+    <param name="StaticLogFileName" value="false" />
45
+    <param name="DatePattern" value="yyyyMMdd&quot;.htm&quot;" />
46
+    <param name="RollingStyle" value="Date" />
47
+    <!--信息日志布局-->
48
+    <layout type="log4net.Layout.PatternLayout">
49
+      <param name="ConversionPattern" value="&lt;HR COLOR=blue&gt;%n日志时间:%d [%t] &lt;BR&gt;%n日志级别:%-5p &lt;BR&gt;%n日 志 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n" />
50
+    </layout>
51
+  </appender>
52
+</log4net>

+ 13
- 2
XHWK.WKTool/system/LogHelper.cs View File

1
-using System;
1
+using log4net.Config;
2
+
3
+using System;
4
+using System.IO;
2
 
5
 
3
 namespace Common.system
6
 namespace Common.system
4
 {
7
 {
6
     {
9
     {
7
         public static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
10
         public static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
8
         public static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
11
         public static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
12
+
13
+        public static void InitLog4Net()
14
+        {
15
+            var logCfg = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config");
16
+            XmlConfigurator.ConfigureAndWatch(logCfg);
17
+            loginfo.Info("日志初始化");
18
+        }
19
+
9
         public static void WriteInfoLog(string info)
20
         public static void WriteInfoLog(string info)
10
         {
21
         {
11
             if (loginfo.IsInfoEnabled)
22
             if (loginfo.IsInfoEnabled)
22
             }
33
             }
23
         }
34
         }
24
     }
35
     }
25
-}
36
+}

+ 36
- 18
星火微课/星火微课-正式.iss View File

3
 
3
 
4
 #define MyAppName "星火微课"  
4
 #define MyAppName "星火微课"  
5
 #define MyAppDir "xhwk"
5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "3.0.0"
6
+#define MyAppVersion "3.1.3"
7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8
 #define MyAppURL "http://www.xhkjedu.com/"
8
 #define MyAppURL "http://www.xhkjedu.com/"
9
-#define MySourcePath "D:\Project\C#\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
9
+#define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
10
 #define MyAppExeName "星火微课.exe"
10
 #define MyAppExeName "星火微课.exe"
11
 #define MyIcoName "256.ico"
11
 #define MyIcoName "256.ico"
12
 #define MyTargetPath "D:\程序打包\星火微课-正式\"
12
 #define MyTargetPath "D:\程序打包\星火微课-正式\"
143
 var Path:string;   
143
 var Path:string;   
144
     ResultCode: Integer;   
144
     ResultCode: Integer;   
145
 begin  
145
 begin  
146
-  if  IsDotNetDetected('v4.5.2', 0) then  
147
-  begin  
148
-    Result := true;   
149
-  end  
150
-  else  
151
-  begin  
152
-    if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
146
+  if IsDotNetDetected('v4.5.2', 0) then  
153
     begin  
147
     begin  
154
-      Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
155
-      Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
156
-      MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);   
157
-      Result := false;   
148
+      if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version') then  
149
+        begin  
150
+          Result := true;   
151
+        end  
152
+      else  
153
+      begin  
154
+        if MsgBox('系统检测到您没有安装VC++环境,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
155
+          begin  
156
+            Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
157
+            Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/VC_redist.x86.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
158
+            MsgBox('请安装好VC++环境后,再运行本安装包程序!',mbInformation,MB_OK);   
159
+            Result := false;   
160
+          end  
161
+        else  
162
+          begin  
163
+            MsgBox('取消后请手动安装VC2015-2019环境!',mbInformation,MB_OK);   
164
+            Result := true;   
165
+          end;   
166
+      end;
158
     end  
167
     end  
159
-    else  
168
+  else  
160
     begin  
169
     begin  
161
-      MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);   
162
-      Result := false;   
163
-    end;   
164
-  end;
170
+      if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
171
+        begin  
172
+          Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
173
+          Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
174
+          MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);   
175
+          Result := false;   
176
+        end  
177
+      else  
178
+        begin  
179
+          MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);   
180
+          Result := false;   
181
+        end;   
182
+    end;
165
 end;
183
 end;

+ 34
- 16
星火微课/星火微课-测试.iss View File

143
 var Path:string;   
143
 var Path:string;   
144
     ResultCode: Integer;   
144
     ResultCode: Integer;   
145
 begin  
145
 begin  
146
-  if  IsDotNetDetected('v4.5.2', 0) then  
147
-  begin  
148
-    Result := true;   
149
-  end  
150
-  else  
151
-  begin  
152
-    if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
146
+  if IsDotNetDetected('v4.5.2', 0) then  
153
     begin  
147
     begin  
154
-      Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
155
-      Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
156
-      MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);   
157
-      Result := false;   
148
+      if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version') then  
149
+        begin  
150
+          Result := true;   
151
+        end  
152
+      else  
153
+      begin  
154
+        if MsgBox('系统检测到您没有安装VC++环境,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
155
+          begin  
156
+            Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
157
+            Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/VC_redist.x86.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
158
+            MsgBox('请安装好VC++环境后,再运行本安装包程序!',mbInformation,MB_OK);   
159
+            Result := false;   
160
+          end  
161
+        else  
162
+          begin  
163
+            MsgBox('取消后请手动安装VC2015-2019环境!',mbInformation,MB_OK);   
164
+            Result := true;   
165
+          end;   
166
+      end;
158
     end  
167
     end  
159
-    else  
168
+  else  
160
     begin  
169
     begin  
161
-      MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);   
162
-      Result := false;   
163
-    end;   
164
-  end;
170
+      if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then  
171
+        begin  
172
+          Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');   
173
+          Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);   
174
+          MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);   
175
+          Result := false;   
176
+        end  
177
+      else  
178
+        begin  
179
+          MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);   
180
+          Result := false;   
181
+        end;   
182
+    end;
165
 end;
183
 end;

Loading…
Cancel
Save