Selaa lähdekoodia

请求添加认证参数和用户ID

master
张剑 1 vuosi sitten
vanhempi
commit
effb979b4d

XHWK.Model/Model_UserInfo.cs → XHWK.Model/ModelUserInfo.cs Näytä tiedosto

@@ -2,8 +2,11 @@
2 2
 
3 3
 namespace XHWK.Model
4 4
 {
5
-    public class Model_UserInfo
5
+    public class ModelUserInfo
6 6
     {
7
+        public string token_key { get; set; }
8
+        public string token_value { get; set; }
9
+
7 10
         /// <summary>
8 11
         /// 用户id
9 12
         /// </summary>

+ 1
- 1
XHWK.Model/XHWK.Model.csproj Näytä tiedosto

@@ -81,7 +81,7 @@
81 81
     <Compile Include="Model_Signatures.cs" />
82 82
     <Compile Include="Model_TmatrixCode.cs" />
83 83
     <Compile Include="Model_TsubjectbookList.cs" />
84
-    <Compile Include="Model_UserInfo.cs" />
84
+    <Compile Include="ModelUserInfo.cs" />
85 85
     <Compile Include="Model_Video.cs" />
86 86
     <Compile Include="Model_WKData.cs" />
87 87
     <Compile Include="NotifyModel.cs" />

+ 3
- 3
XHWK.WKTool/App.config Näytä tiedosto

@@ -5,12 +5,12 @@
5 5
   </startup>
6 6
   <appSettings>
7 7
     <!--0正式 1测试-->
8
-    <add key="IsDebug" value="0" />
8
+    <add key="IsDebug" value="1" />
9 9
     <!--参数是否加密 0不加密 1加密-->
10 10
     <add key="IsParameterEncryption" value="0" />
11 11
     <!--版本号-->
12
-    <add key="VersionCode" value="125" />
13
-    <add key="VersionName" value="3.9.8" />
12
+    <add key="VersionCode" value="126" />
13
+    <add key="VersionName" value="3.12.0" />
14 14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15 15
     <add key="SkinStyle" value="0" />
16 16
     <!--是否输出视频记录日志:0否-->

+ 4
- 2
XHWK.WKTool/App.xaml.cs Näytä tiedosto

@@ -136,7 +136,7 @@ namespace XHWK.WKTool
136 136
         /// <summary>
137 137
         /// 用户信息
138 138
         /// </summary>
139
-        public static Model_UserInfo UserInfo;
139
+        public static ModelUserInfo UserInfo;
140 140
 
141 141
         /// <summary>
142 142
         /// 接口返回消息
@@ -316,11 +316,13 @@ namespace XHWK.WKTool
316 316
         {
317 317
             Console.WriteLine(@"初始化APP");
318 318
             LogHelper.InitLog4Net();
319
+            bool isParameterEncryption = FileToolsCommon.GetConfigValue("IsParameterEncryption") != "0";
320
+            HttpHelper.isParameterEncryption = isParameterEncryption;
319 321
             myloading = new LoadDialog();
320 322
             Killffmpeg();
321 323
             try
322 324
             {
323
-                UserInfo = new Model_UserInfo();
325
+                UserInfo = new ModelUserInfo();
324 326
                 WKDataList = new List<Model_WKData>();
325 327
                 VideoList = new List<Model_Video>();
326 328
 

+ 67
- 91
XHWK.WKTool/DAL/XHApi.cs Näytä tiedosto

@@ -13,16 +13,19 @@ namespace XHWK.WKTool.DAL
13 13
 {
14 14
     using system;
15 15
 
16
-    public class XHApi
16
+    public class XhApi
17 17
     {
18 18
         /// <summary>
19 19
         /// 激活信息--添加
20 20
         /// </summary>
21
-        /// <param name="request">
22
-        /// </param>
23 21
         /// <returns>
24 22
         /// </returns>
25
-        public int ActivationAdd(string mac, string device, string projectcode)
23
+        public int ActivationAdd
24
+        (
25
+            string mac,
26
+            string device,
27
+            string projectcode
28
+        )
26 29
         {
27 30
             try
28 31
             {
@@ -42,37 +45,27 @@ namespace XHWK.WKTool.DAL
42 45
                     App.ServerMsg = "网络异常!";
43 46
                     return 1;
44 47
                 }
45
-                else
48
+                JObject obj = JObject.Parse(xmlDoc);
49
+                if (obj["code"].ToString().Equals("0"))
46 50
                 {
47
-                    JObject obj = JObject.Parse(xmlDoc);
48
-                    if (obj != null)
49
-                    {
50
-                        if (obj["code"].ToString().Equals("0"))
51
-                        {
52
-                            App.Signature = obj["obj"].ToString();
53
-                            if (!Directory.Exists(App.DataPath))
54
-                            {
55
-                                Directory.CreateDirectory(App.DataPath);
56
-                            }
57
-                            string ApplicationData = App.DataPath + "signature.txt";
58
-                            System.IO.File.WriteAllText
59
-                            (
60
-                                ApplicationData,
61
-                                App.Signature,
62
-                                Encoding.Default
63
-                            ); //存放签名
64
-                            return 0;
65
-                        }
66
-                        else
67
-                        {
68
-                            App.ServerMsg = obj["msg"].ToString();
69
-                            return Convert.ToInt32(obj["code"].ToString());
70
-                        }
71
-                    }
72
-                    else
51
+                    App.Signature = obj["obj"]?.ToString();
52
+                    if (!Directory.Exists(App.DataPath))
73 53
                     {
74
-                        return 1;
54
+                        Directory.CreateDirectory(App.DataPath);
75 55
                     }
56
+                    string applicationData = App.DataPath + "signature.txt";
57
+                    System.IO.File.WriteAllText
58
+                    (
59
+                        applicationData,
60
+                        App.Signature,
61
+                        Encoding.Default
62
+                    ); //存放签名
63
+                    return 0;
64
+                }
65
+                else
66
+                {
67
+                    App.ServerMsg = obj["msg"]?.ToString();
68
+                    return Convert.ToInt32(obj["code"].ToString());
76 69
                 }
77 70
             }
78 71
             catch (Exception ex)
@@ -86,8 +79,6 @@ namespace XHWK.WKTool.DAL
86 79
         /// <summary>
87 80
         /// 激活信息--添加激活历史
88 81
         /// </summary>
89
-        /// <param name="request">
90
-        /// </param>
91 82
         /// <returns>
92 83
         /// </returns>
93 84
         public int ActivationAddHistory()
@@ -107,15 +98,8 @@ namespace XHWK.WKTool.DAL
107 98
                 else
108 99
                 {
109 100
                     JObject obj = JObject.Parse(xmlDoc);
110
-                    if (obj != null)
111
-                    {
112
-                        App.ServerMsg = obj["msg"].ToString();
113
-                        return Convert.ToInt32(obj["code"].ToString());
114
-                    }
115
-                    else
116
-                    {
117
-                        return 1;
118
-                    }
101
+                    App.ServerMsg = obj["msg"]?.ToString();
102
+                    return Convert.ToInt32(obj["code"]?.ToString());
119 103
                 }
120 104
             }
121 105
             catch (Exception ex)
@@ -128,8 +112,6 @@ namespace XHWK.WKTool.DAL
128 112
         /// <summary>
129 113
         /// 登录
130 114
         /// </summary>
131
-        /// <param name="request">
132
-        /// </param>
133 115
         /// <returns>
134 116
         /// </returns>
135 117
         public int Login(string loginname, string loginpwd)
@@ -138,35 +120,35 @@ namespace XHWK.WKTool.DAL
138 120
             string url = App.apiUrl + "/suser/user/login"; //地址
139 121
 
140 122
             //1.193.37.200
141
-            string Address = "";//河南 郑州
142
-            HttpHelper.GetAddressIP(out string AddressIP, out AddressIP);
123
+            const string address = ""; //河南 郑州
124
+            HttpHelper.GetAddressIp(out string addressIp, out addressIp);
143 125
             Dictionary<string, object> dic = new Dictionary<string, object>
144 126
             {
145
-                { "loginname", loginname},
146
-                { "loginpwd", loginpwd},
147
-                {"logip", AddressIP},
148
-                {"logaddress", Address},
149
-                {"ultype", "microlecture_pc_t"},
150
-                {"versionnum", FileToolsCommon.GetConfigValue("VersionName")}
127
+                { "loginname", loginname },
128
+                { "loginpwd", loginpwd },
129
+                { "logip", addressIp },
130
+                { "logaddress", address },
131
+                { "ultype", "microlecture_pc_t" },
132
+                { "versionnum", FileToolsCommon.GetConfigValue("VersionName") }
151 133
             };
152 134
             string body = JsonHelper.ToJson(dic);
153
-            ResultVo<Model_UserInfo> result = HttpHelper.PostAndRespSignle<ResultVo<Model_UserInfo>>(url, postData: body);
135
+            ResultVo<ModelUserInfo> result = HttpHelper.PostAndRespSignle<ResultVo<ModelUserInfo>>(url, postData: body);
154 136
             if (result != null)
155 137
             {
156
-                App.UserInfo = new Model_UserInfo();
138
+                App.UserInfo = new ModelUserInfo();
157 139
                 App.ServerMsg = result.msg;
158 140
                 if (result.obj != null)
159 141
                 {
160 142
                     App.UserInfo = result.obj;
143
+                    HttpHelper.tokenKey = result.obj.token_key;
144
+                    HttpHelper.tokenValue = result.obj.token_value;
145
+                    HttpHelper.userId = result.obj.Userid + "";
161 146
                 }
162 147
                 return result.code;
163 148
             }
164
-            else
165
-            {
166
-                App.ServerMsg = "网络异常!";
167
-                App.UserInfo = new Model_UserInfo();
168
-                return 1;
169
-            }
149
+            App.ServerMsg = "网络异常!";
150
+            App.UserInfo = new ModelUserInfo();
151
+            return 1;
170 152
         }
171 153
 
172 154
         /// <summary>
@@ -174,22 +156,25 @@ namespace XHWK.WKTool.DAL
174 156
         /// </summary>
175 157
         /// <param name="headPortrait">
176 158
         /// </param>
177
-        /// <param name="SavePath">
159
+        /// <param name="savePath">
178 160
         /// </param>
179 161
         /// <returns>
180 162
         /// </returns>
181
-        public bool DownloadAvatar(string headPortrait, string SavePath)
163
+        public bool DownloadAvatar(string headPortrait, string savePath)
182 164
         {
183 165
             string url = App.showImageUrl + headPortrait;
184
-            bool result = HttpHelper.GetDataGetHtml(url, SavePath, "");
166
+            bool result = HttpHelper.GetDataGetHtml
167
+            (
168
+                url,
169
+                savePath,
170
+                ""
171
+            );
185 172
             return result;
186 173
         }
187 174
 
188 175
         /// <summary>
189 176
         /// 教师教材列表
190 177
         /// </summary>
191
-        /// <param name="request">
192
-        /// </param>
193 178
         /// <returns>
194 179
         /// </returns>
195 180
         public int TsubjectbookList()
@@ -223,11 +208,14 @@ namespace XHWK.WKTool.DAL
223 208
         /// <summary>
224 209
         /// 章节--列表
225 210
         /// </summary>
226
-        /// <param name="request">
227
-        /// </param>
228 211
         /// <returns>
229 212
         /// </returns>
230
-        public int DirectorList(string lsbid, int belong, int createid)
213
+        public int DirectorList
214
+        (
215
+            string lsbid,
216
+            int belong,
217
+            int createid
218
+        )
231 219
         {
232 220
             App.DirectorList = new List<Model_DirectorList>();
233 221
             try
@@ -263,8 +251,6 @@ namespace XHWK.WKTool.DAL
263 251
         /// <summary>
264 252
         /// 资源--添加
265 253
         /// </summary>
266
-        /// <param name="request">
267
-        /// </param>
268 254
         /// <returns>
269 255
         /// </returns>
270 256
         public int ResourceAdd(Model_ResourceAdd model)
@@ -320,16 +306,8 @@ namespace XHWK.WKTool.DAL
320 306
                 string body = JsonHelper.ToJson(dic);
321 307
                 string xmlDoc = HttpHelper.HttpPost(body, url);
322 308
                 JObject obj = JObject.Parse(xmlDoc);
323
-                if (obj != null)
324
-                {
325
-                    App.ServerMsg = obj["msg"].ToString();
326
-                    return Convert.ToInt32(obj["code"].ToString());
327
-                }
328
-                else
329
-                {
330
-                    App.ServerMsg = "网络异常!";
331
-                    return 1;
332
-                }
309
+                App.ServerMsg = obj["msg"]?.ToString();
310
+                return Convert.ToInt32(obj["code"]?.ToString());
333 311
             }
334 312
             catch (Exception ex)
335 313
             {
@@ -342,17 +320,15 @@ namespace XHWK.WKTool.DAL
342 320
         /// <summary>
343 321
         /// 请求服务地址
344 322
         /// </summary>
345
-        /// <param name="Schoolcode">
323
+        /// <param name="schoolcode">
346 324
         /// </param>
325
+        /// <param name="message"></param>
347 326
         /// <returns>
348 327
         /// </returns>
349
-        public bool GetServiceAddress(string Schoolcode, out string Message)
328
+        public bool GetServiceAddress(string schoolcode, out string message)
350 329
         {
351 330
             string url = App.certapiUrl + "/school/find_code"; //地址
352
-            Dictionary<string, object> dic = new Dictionary<string, object>
353
-            {
354
-                { "schoolcode", Schoolcode}
355
-            };
331
+            Dictionary<string, object> dic = new Dictionary<string, object> { { "schoolcode", schoolcode } };
356 332
             string body = JsonHelper.ToJson(dic);
357 333
             ResultVo<Model_ServiceAddress> result = HttpHelper.PostAndRespSignle<ResultVo<Model_ServiceAddress>>(url, postData: body);
358 334
             if (result != null)
@@ -361,26 +337,26 @@ namespace XHWK.WKTool.DAL
361 337
                 {
362 338
                     if (result.obj != null)
363 339
                     {
364
-                        Message = result.msg;
340
+                        message = result.msg;
365 341
                         App.ServiceAddress = result.obj;
366 342
                         App.SaveServiceAddressData();
367 343
                         return true;
368 344
                     }
369 345
                     else
370 346
                     {
371
-                        Message = "服务地址错误,请输入正确的地址!";
347
+                        message = "服务地址错误,请输入正确的地址!";
372 348
                         return false;
373 349
                     }
374 350
                 }
375 351
                 else
376 352
                 {
377
-                    Message = result.msg;
353
+                    message = result.msg;
378 354
                     return false;
379 355
                 }
380 356
             }
381 357
             else
382 358
             {
383
-                Message = "无法与服务器建立连接,请检查网络状态。";
359
+                message = "无法与服务器建立连接,请检查网络状态。";
384 360
                 return false;
385 361
             }
386 362
         }

+ 2
- 2
XHWK.WKTool/KeyVerification.xaml Näytä tiedosto

@@ -44,7 +44,7 @@
44 44
                 Grid.Row="0"
45 45
                 Padding="10,0,10,0"
46 46
                 HorizontalAlignment="Right"
47
-                Click="close_click"
47
+                Click="CloseClick"
48 48
                 Content="×"
49 49
                 Cursor="Hand"
50 50
                 FontSize="30"
@@ -77,7 +77,7 @@
77 77
             Width="138"
78 78
             Height="36"
79 79
             Margin="30,0,30,0"
80
-            Click="btnEnd_Click"
80
+            Click="BtnEndClick"
81 81
             Content="验证"
82 82
             Cursor="Hand"
83 83
             FontSize="16"

+ 3
- 3
XHWK.WKTool/KeyVerification.xaml.cs Näytä tiedosto

@@ -17,7 +17,7 @@ namespace XHWK.WKTool
17 17
          */
18 18
     public partial class KeyVerification
19 19
     {
20
-        private readonly XHApi _registerController = new XHApi();
20
+        private readonly XhApi _registerController = new XhApi();
21 21
         private int _serverReturnCode;
22 22
 
23 23
         public KeyVerification()
@@ -34,7 +34,7 @@ namespace XHWK.WKTool
34 34
             DragMove();
35 35
         }
36 36
 
37
-        private void btnEnd_Click(object sender, RoutedEventArgs e)
37
+        private void BtnEndClick(object sender, RoutedEventArgs e)
38 38
         {
39 39
             if (string.IsNullOrWhiteSpace(TxbKey.Text))
40 40
             {
@@ -154,7 +154,7 @@ namespace XHWK.WKTool
154 154
             }
155 155
         }
156 156
 
157
-        private void close_click(object sender, RoutedEventArgs e)
157
+        private void CloseClick(object sender, RoutedEventArgs e)
158 158
         {
159 159
             CloseAction();
160 160
         }

+ 1
- 1
XHWK.WKTool/LoginWindow.xaml Näytä tiedosto

@@ -122,7 +122,7 @@
122 122
                                 FontSize="14"
123 123
                                 Foreground="#FF999999"
124 124
                                 InputMethod.IsInputMethodEnabled="False"
125
-                                PreviewTextInput="txbAccountNumber_PreviewTextInput"
125
+                                PreviewTextInput="TxbAccountNumberPreviewTextInput"
126 126
                                 Text="" />
127 127
                             <Label Height="1.5" Background="#3F6FFF" />
128 128
                         </StackPanel>

+ 2
- 2
XHWK.WKTool/LoginWindow.xaml.cs Näytä tiedosto

@@ -23,7 +23,7 @@ namespace XHWK.WKTool
23 23
         /// <summary>
24 24
         /// 调用接口
25 25
         /// </summary>
26
-        private readonly XHApi xhapi = new XHApi();
26
+        private readonly XhApi xhapi = new XhApi();
27 27
 
28 28
         public LoginWindow()
29 29
         {
@@ -224,7 +224,7 @@ namespace XHWK.WKTool
224 224
         /// </param>
225 225
         /// <param name="e">
226 226
         /// </param>
227
-        private void txbAccountNumber_PreviewTextInput(object sender, TextCompositionEventArgs e)
227
+        private void TxbAccountNumberPreviewTextInput(object sender, TextCompositionEventArgs e)
228 228
         {
229 229
             try
230 230
             {

+ 1
- 1
XHWK.WKTool/MainWindow.xaml.cs Näytä tiedosto

@@ -376,7 +376,7 @@ namespace XHWK.WKTool
376 376
             TxbLoginType.Text = "未登录";
377 377
             ImgHeadImgN.Visibility = Visibility.Visible;
378 378
             ImgHeadImg.Visibility = Visibility.Collapsed;
379
-            App.UserInfo = new Model_UserInfo();
379
+            App.UserInfo = new ModelUserInfo();
380 380
         }
381 381
 
382 382
         #endregion 登录

+ 1
- 1
XHWK.WKTool/ProductVerification.xaml Näytä tiedosto

@@ -85,7 +85,7 @@
85 85
                     HorizontalAlignment="Right"
86 86
                     VerticalAlignment="Center"
87 87
                     Background="White"
88
-                    Click="close_click"
88
+                    Click="CloseClick"
89 89
                     Cursor="Hand"
90 90
                     >
91 91
                     <Button.Template>

+ 5
- 4
XHWK.WKTool/ProductVerification.xaml.cs Näytä tiedosto

@@ -20,7 +20,7 @@ namespace XHWK.WKTool
20 20
          */
21 21
     public partial class ProductVerification : Window
22 22
     {
23
-        private readonly XHApi registerController = new XHApi();
23
+        private readonly XhApi registerController = new XhApi();
24 24
         private int serverReturnCode = 0;
25 25
 
26 26
         public ProductVerification()
@@ -132,14 +132,15 @@ namespace XHWK.WKTool
132 132
         /// </summary>
133 133
         /// <param name="sender"></param>
134 134
         /// <param name="e"></param>
135
-        private void close_click(object sender, RoutedEventArgs e)
135
+        private void CloseClick(object sender, RoutedEventArgs e)
136 136
         {
137
-            closeAction();
137
+            CloseAction();
138 138
         }
139
+
139 140
         /// <summary>
140 141
         /// 退出程序
141 142
         /// </summary>
142
-        private void closeAction()
143
+        private void CloseAction()
143 144
         {
144 145
             Dispatcher.Invoke(new Action(() =>
145 146
             {

+ 1
- 1
XHWK.WKTool/UploadWindow.xaml Näytä tiedosto

@@ -93,7 +93,7 @@
93 93
             Foreground="Black"
94 94
             ItemsSource="{Binding bookList}"
95 95
             SelectedValuePath="Key"
96
-            SelectionChanged="toolbar_list_SelectionChanged">
96
+            SelectionChanged="ToolbarListSelectionChanged">
97 97
             <ComboBox.Resources>
98 98
                 <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="White" />
99 99
                 <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Gray" />

+ 136
- 115
XHWK.WKTool/UploadWindow.xaml.cs Näytä tiedosto

@@ -17,12 +17,12 @@ namespace XHWK.WKTool
17 17
     /// <summary>
18 18
     /// UploadWindow.xaml 的交互逻辑
19 19
     /// </summary>
20
-    public partial class UploadWindow : Window
20
+    public partial class UploadWindow
21 21
     {
22 22
         /// <summary>
23 23
         /// 调用接口
24 24
         /// </summary>
25
-        private readonly XHApi xhapi = new XHApi();
25
+        private readonly XhApi _xhapi = new XhApi();
26 26
 
27 27
         /// <summary>
28 28
         /// 前台数据
@@ -32,22 +32,22 @@ namespace XHWK.WKTool
32 32
         /// <summary>
33 33
         /// 文件名
34 34
         /// </summary>
35
-        private string Resourcename = string.Empty;
35
+        private string _resourcename = string.Empty;
36 36
 
37 37
         /// <summary>
38 38
         /// 文件大小
39 39
         /// </summary>
40
-        private long Resourcesize = 0;
40
+        private long _resourcesize;
41 41
 
42 42
         /// <summary>
43 43
         /// 文件类型
44 44
         /// </summary>
45
-        private string Suffix = string.Empty;
45
+        private string _suffix = string.Empty;
46 46
 
47 47
         /// <summary>
48 48
         /// 唯一编号
49 49
         /// </summary>
50
-        private string Guid = string.Empty;
50
+        private string _guid = string.Empty;
51 51
 
52 52
         //定义事件
53 53
         public event ChangeTextHandlers ChangeTextEvents;
@@ -55,9 +55,9 @@ namespace XHWK.WKTool
55 55
         /// <summary>
56 56
         /// 当前视频的下标
57 57
         /// </summary>
58
-        private int i = 0;
58
+        private int _i;
59 59
 
60
-        private System.Timers.Timer times;
60
+        private System.Timers.Timer _times;
61 61
 
62 62
         public UploadWindow()
63 63
         {
@@ -67,13 +67,20 @@ namespace XHWK.WKTool
67 67
         /// <summary>
68 68
         /// 初始化
69 69
         /// </summary>
70
-        public void Initialize(string _resourcename, long _resourcesize, string _suffix, string _guid, int _i)
70
+        public void Initialize
71
+        (
72
+            string mResourcename,
73
+            long mResourcesize,
74
+            string mSuffix,
75
+            string mGuid,
76
+            int m
77
+        )
71 78
         {
72
-            i = _i;
73
-            Resourcename = _resourcename;
74
-            Resourcesize = _resourcesize;
75
-            Suffix = _suffix;
76
-            Guid = _guid;
79
+            this._i = m;
80
+            this._resourcename = mResourcename;
81
+            this._resourcesize = mResourcesize;
82
+            this._suffix = mSuffix;
83
+            this._guid = mGuid;
77 84
             tip_outer.Visibility = Visibility.Collapsed;
78 85
             Tsubjectbook();
79 86
         }
@@ -85,7 +92,7 @@ namespace XHWK.WKTool
85 92
         /// </returns>
86 93
         private void Tsubjectbook()
87 94
         {
88
-            int code = xhapi.TsubjectbookList();
95
+            int code = _xhapi.TsubjectbookList();
89 96
             if (code == 0)
90 97
             {
91 98
                 for (int i = 0; i < App.TsubjectbookList.Count; i++)
@@ -132,7 +139,7 @@ namespace XHWK.WKTool
132 139
             }
133 140
             if (App.TsubjectbookList.Count > selectIndex)
134 141
             {
135
-                int code = xhapi.DirectorList
142
+                int code = _xhapi.DirectorList
136 143
                 (
137 144
                     App.TsubjectbookList[selectIndex].Lsbid,
138 145
                     4,
@@ -162,7 +169,7 @@ namespace XHWK.WKTool
162 169
                                 leaf = item.leaf
163 170
                             }
164 171
                         );
165
-                        addChild(item);
172
+                        AddChild(item);
166 173
                     }
167 174
                     cmbTeachingMaterial.SelectedIndex = 0;
168 175
                 }
@@ -178,21 +185,24 @@ namespace XHWK.WKTool
178 185
         /// </summary>
179 186
         /// <param name="directorList">
180 187
         /// </param>
181
-        private void addChild(Model_DirectorList directorList)
188
+        private void AddChild(Model_DirectorList directorList)
182 189
         {
183 190
             if (directorList.children != null && directorList.children.Count > 0)
184 191
             {
185 192
                 foreach (Model_DirectorList child in directorList.children)
186 193
                 {
187
-                    pageData.zhangjieList.Add(new ComboBoxBean()
188
-                    {
189
-                        Key = child.directorid,
190
-                        Value = getSpace(child.directorlevel) + child.directorname,
191
-                        leaf = child.leaf
192
-                    });
194
+                    pageData.zhangjieList.Add
195
+                    (
196
+                        new ComboBoxBean()
197
+                        {
198
+                            Key = child.directorid,
199
+                            Value = GetSpace(child.directorlevel) + child.directorname,
200
+                            leaf = child.leaf
201
+                        }
202
+                    );
193 203
                     if (child.children != null && child.children.Count > 0)
194 204
                     {
195
-                        addChild(child);
205
+                        AddChild(child);
196 206
                     }
197 207
                 }
198 208
             }
@@ -205,7 +215,7 @@ namespace XHWK.WKTool
205 215
         /// </param>
206 216
         /// <returns>
207 217
         /// </returns>
208
-        private string getSpace(int num)
218
+        private string GetSpace(int num)
209 219
         {
210 220
             string str = "";
211 221
             for (int i = 0; i < num; i++)
@@ -231,7 +241,7 @@ namespace XHWK.WKTool
231 241
         /// </param>
232 242
         /// <param name="e">
233 243
         /// </param>
234
-        private void toolbar_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
244
+        private void ToolbarListSelectionChanged(object sender, SelectionChangedEventArgs e)
235 245
         {
236 246
             if (App.TsubjectbookList.Count > 0)
237 247
             {
@@ -280,21 +290,20 @@ namespace XHWK.WKTool
280 290
             book_list.IsEnabled = false;
281 291
             cmbTeachingMaterial.IsEnabled = false;
282 292
             Thread myThread = new Thread(StartUpload);
283
-
284
-            num = 0;
293
+            _num = 0;
285 294
             tip_outer.Visibility = Visibility.Visible;
286 295
             myThread.Start();
287
-            times = new System.Timers.Timer(100);
288
-            times.Elapsed += Times_ElapsedClick;
289
-            times.Start();
296
+            _times = new System.Timers.Timer(100);
297
+            _times.Elapsed += Times_ElapsedClick;
298
+            _times.Start();
290 299
         }
291 300
 
292 301
         private void StartUpload()
293 302
         {
294 303
             try
295 304
             {
296
-                DalUpload dAL_Upload = new DalUpload();
297
-                if (dAL_Upload.UploadVideoTwo(Guid, out string ErrMessage))
305
+                DalUpload dAlUpload = new DalUpload();
306
+                if (dAlUpload.UploadVideoTwo(_guid, out string errMessage))
298 307
                 {
299 308
                     //        converted: 0
300 309
                     //createid: 80
@@ -314,104 +323,116 @@ namespace XHWK.WKTool
314 323
                     //schoolid: 12
315 324
                     //suffix: "mp4"
316 325
                     //uid: 80
317
-                    Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd();
318
-                    Dispatcher.Invoke(() =>
319
-                    {
320
-                        model_ResourceAdd = new Model_ResourceAdd
326
+                    Model_ResourceAdd modelResourceAdd = new Model_ResourceAdd();
327
+                    Dispatcher.Invoke
328
+                    (
329
+                        () =>
321 330
                         {
322
-                            converted = 0,
323
-                            createid = App.UserInfo.Userid,
324
-                            directorid = cmbTeachingMaterial.SelectedValue.ToString(),
325
-                            duration = App.ResourceAddTwo.duration,
326
-                            subjectid = App.TsubjectbookList[book_list.SelectedIndex].Subjectid,
327
-                            imgUrl = "",
328
-                            level = 2,
329
-                            lsbid = book_list.SelectedValue.ToString(),
330
-                            mp4code = App.ResourceAddTwo.mp4code,
331
-                            resourcebelong = 3,
332
-                            resourceclass = 5,
333
-                            resourcecover = App.ResourceAddTwo.coverpath,
334
-                            resourcename = Resourcename,
335
-                            resourcesize = Resourcesize,
336
-                            resourcetype = 10,
337
-                            resourceurl = App.ResourceAddTwo.videopath,
338
-                            schoolid = App.UserInfo.Schoolid
339
-                        };
340
-                    });
341
-
342
-                    if (Suffix.Equals("FLV"))
331
+                            modelResourceAdd = new Model_ResourceAdd
332
+                            {
333
+                                converted = 0,
334
+                                createid = App.UserInfo.Userid,
335
+                                directorid = cmbTeachingMaterial.SelectedValue.ToString(),
336
+                                duration = App.ResourceAddTwo.duration,
337
+                                subjectid = App.TsubjectbookList[book_list.SelectedIndex].Subjectid,
338
+                                imgUrl = "",
339
+                                level = 2,
340
+                                lsbid = book_list.SelectedValue.ToString(),
341
+                                mp4code = App.ResourceAddTwo.mp4code,
342
+                                resourcebelong = 3,
343
+                                resourceclass = 5,
344
+                                resourcecover = App.ResourceAddTwo.coverpath,
345
+                                resourcename = _resourcename,
346
+                                resourcesize = _resourcesize,
347
+                                resourcetype = 10,
348
+                                resourceurl = App.ResourceAddTwo.videopath,
349
+                                schoolid = App.UserInfo.Schoolid
350
+                            };
351
+                        }
352
+                    );
353
+                    if (_suffix.Equals("FLV"))
343 354
                     {
344
-                        Suffix = "flv";
355
+                        _suffix = "flv";
345 356
                     }
346
-                    else if (Suffix.Equals("AVI"))
357
+                    else if (_suffix.Equals("AVI"))
347 358
                     {
348
-                        Suffix = "avi";
359
+                        _suffix = "avi";
349 360
                     }
350 361
                     else
351 362
                     {
352
-                        Suffix = "mp4";
363
+                        _suffix = "mp4";
353 364
                     }
354
-
355
-                    model_ResourceAdd.suffix = Suffix;
365
+                    modelResourceAdd.suffix = _suffix;
356 366
                     //model_ResourceAdd.uid = 0;//zxy
357
-                    int code = xhapi.ResourceAdd(model_ResourceAdd);
367
+                    int code = _xhapi.ResourceAdd(modelResourceAdd);
358 368
                     if (code == 0)
359 369
                     {
360
-                        Dispatcher.Invoke(() =>
361
-                        {
362
-                            foreach (Model_WKData Vdata in App.WKDataList)
370
+                        Dispatcher.Invoke
371
+                        (
372
+                            () =>
363 373
                             {
364
-                                if (Vdata.VideoList == null)
374
+                                foreach (Model_WKData vdata in App.WKDataList)
365 375
                                 {
366
-                                    continue;
367
-                                }
368
-                                foreach (Model_Video videoinfo in Vdata.VideoList)
369
-                                {
370
-                                    if (videoinfo.FileGuid == Guid)
376
+                                    if (vdata.VideoList == null)
377
+                                    {
378
+                                        continue;
379
+                                    }
380
+                                    foreach (Model_Video videoinfo in vdata.VideoList)
371 381
                                     {
372
-                                        videoinfo.IsUpload = true;
373
-                                        break;
382
+                                        if (videoinfo.FileGuid == _guid)
383
+                                        {
384
+                                            videoinfo.IsUpload = true;
385
+                                            break;
386
+                                        }
374 387
                                     }
375 388
                                 }
389
+                                btnStart.IsEnabled = true;
390
+                                book_list.IsEnabled = true;
391
+                                cmbTeachingMaterial.IsEnabled = true;
392
+                                _num = 99;
393
+                                _times.Stop();
394
+                                pgbProcess.Value = 100;
395
+                                lbProcess.Content = "100%";
396
+                                MessageWindow.Show("视频上传成功!");
397
+                                tip_outer.Visibility = Visibility.Collapsed;
398
+                                if (ChangeTextEvents != null)
399
+                                {
400
+                                    ChangeTextEvents("上传成功", _i);
401
+                                }
402
+                                Hide();
376 403
                             }
377
-
378
-                            btnStart.IsEnabled = true;
379
-                            book_list.IsEnabled = true;
380
-                            cmbTeachingMaterial.IsEnabled = true;
381
-                            num = 99;
382
-                            times.Stop();
383
-                            pgbProcess.Value = 100;
384
-                            lbProcess.Content = "100%";
385
-                            MessageWindow.Show("视频上传成功!");
386
-                            tip_outer.Visibility = Visibility.Collapsed;
387
-                            ChangeTextEvents("上传成功", i);
388
-                            Hide();
389
-                        });
404
+                        );
390 405
                     }
391 406
                     else
392 407
                     {
393
-                        Dispatcher.Invoke(() =>
408
+                        Dispatcher.Invoke
409
+                        (
410
+                            () =>
411
+                            {
412
+                                btnStart.IsEnabled = true;
413
+                                book_list.IsEnabled = true;
414
+                                cmbTeachingMaterial.IsEnabled = true;
415
+                                _times.Stop();
416
+                                tip_outer.Visibility = Visibility.Collapsed;
417
+                                MessageWindow.Show(App.ServerMsg);
418
+                            }
419
+                        );
420
+                    }
421
+                }
422
+                else
423
+                {
424
+                    Dispatcher.Invoke
425
+                    (
426
+                        () =>
394 427
                         {
395 428
                             btnStart.IsEnabled = true;
396 429
                             book_list.IsEnabled = true;
397 430
                             cmbTeachingMaterial.IsEnabled = true;
398
-                            times.Stop();
431
+                            _times.Stop();
399 432
                             tip_outer.Visibility = Visibility.Collapsed;
400
-                            MessageWindow.Show(App.ServerMsg);
401
-                        });
402
-                    }
403
-                }
404
-                else
405
-                {
406
-                    Dispatcher.Invoke(() =>
407
-                    {
408
-                        btnStart.IsEnabled = true;
409
-                        book_list.IsEnabled = true;
410
-                        cmbTeachingMaterial.IsEnabled = true;
411
-                        times.Stop();
412
-                        tip_outer.Visibility = Visibility.Collapsed;
413
-                        MessageWindow.Show(ErrMessage);
414
-                    });
433
+                            MessageWindow.Show(errMessage);
434
+                        }
435
+                    );
415 436
                 }
416 437
             }
417 438
             catch (Exception ex)
@@ -421,7 +442,7 @@ namespace XHWK.WKTool
421 442
                     btnStart.IsEnabled = true;
422 443
                     book_list.IsEnabled = true;
423 444
                     cmbTeachingMaterial.IsEnabled = true;
424
-                    times.Stop();
445
+                    _times.Stop();
425 446
                     tip_outer.Visibility = Visibility.Collapsed;
426 447
                     MessageWindow.Show("无法上传视频,请检查与服务器链接状态!");
427 448
                     App.IsUpLoad = false;
@@ -431,7 +452,7 @@ namespace XHWK.WKTool
431 452
             }
432 453
         }
433 454
 
434
-        private int num = 0;
455
+        private int _num;
435 456
 
436 457
         /// <summary>
437 458
         /// 计时器
@@ -444,16 +465,16 @@ namespace XHWK.WKTool
444 465
         {
445 466
             Dispatcher.Invoke(() =>
446 467
             {
447
-                pgbProcess.Value = num;
448
-                lbProcess.Content = num.ToString() + "%";
449
-                if (num < 99)
468
+                pgbProcess.Value = _num;
469
+                lbProcess.Content = _num.ToString() + "%";
470
+                if (_num < 99)
450 471
                 {
451
-                    num++;
452
-                    times.Interval += (num / 2);
472
+                    _num++;
473
+                    _times.Interval += _num / 2;
453 474
                 }
454 475
                 else
455 476
                 {
456
-                    times.Stop();
477
+                    _times.Stop();
457 478
                 }
458 479
             });
459 480
         }

+ 107
- 101
XHWK.WKTool/system/HttpHelper.cs Näytä tiedosto

@@ -12,15 +12,18 @@ using System.Threading;
12 12
 
13 13
 namespace Common.system
14 14
 {
15
-    using XHWK.WKTool.system;
16
-
17 15
     /// <summary>
18 16
     /// HttpHelper
19 17
     /// 创建人:赵耀
20 18
     /// </summary>
21 19
     public class HttpHelper
22 20
     {
23
-        public static void init_Request(ref System.Net.HttpWebRequest request)
21
+        public static string tokenKey = "";
22
+        public static string tokenValue = "";
23
+        public static string userId = "";
24
+        public static bool isParameterEncryption = false;
25
+
26
+        public static void InitRequest(ref System.Net.HttpWebRequest request)
24 27
         {
25 28
             request.Accept = "text/json,*/*;q=0.5";
26 29
             request.Headers.Add("Accept-Charset", "utf-8;q=0.7,*;q=0.7");
@@ -36,7 +39,7 @@ namespace Common.system
36 39
 
37 40
         public static System.Net.HttpWebRequest GetHttpWebRequest(string url)
38 41
         {
39
-            HttpWebRequest request = null;
42
+            HttpWebRequest request;
40 43
             if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
41 44
             {
42 45
                 ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
@@ -57,7 +60,7 @@ namespace Common.system
57 60
                 try
58 61
                 {
59 62
                     HttpWebRequest request = HttpHelper.GetHttpWebRequest(downloadUrl);
60
-                    HttpHelper.init_Request(ref request);
63
+                    HttpHelper.InitRequest(ref request);
61 64
                     request.Accept = "text/json,*/*;q=0.5";
62 65
                     request.AddRange(from, to);
63 66
                     request.Headers.Add("Accept-Charset", "utf-8;q=0.7,*;q=0.7");
@@ -95,11 +98,11 @@ namespace Common.system
95 98
                 HttpWebRequest request = GetHttpWebRequest(url);
96 99
                 if (request != null)
97 100
                 {
98
-                    string retval = null;
99
-                    init_Request(ref request);
100
-                    using (WebResponse Response = request.GetResponse())
101
+                    string retval;
102
+                    InitRequest(ref request);
103
+                    using (WebResponse response = request.GetResponse())
101 104
                     {
102
-                        using (StreamReader reader = new System.IO.StreamReader(Response.GetResponseStream(), System.Text.Encoding.UTF8))
105
+                        using (StreamReader reader = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8))
103 106
                         {
104 107
                             retval = reader.ReadToEnd();
105 108
                         }
@@ -121,12 +124,12 @@ namespace Common.system
121 124
                 if (request != null)
122 125
                 {
123 126
                     string retval = null;
124
-                    init_Request(ref request);
127
+                    InitRequest(ref request);
125 128
                     request.Method = "POST";
126 129
                     request.ServicePoint.Expect100Continue = false;
127 130
                     request.ContentType = "application/json; charset=utf-8";
128 131
                     request.Timeout = 5000;
129
-                    byte[] bytes = System.Text.UTF8Encoding.UTF8.GetBytes(data);
132
+                    byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data);
130 133
                     request.ContentLength = bytes.Length;
131 134
                     using (Stream stream = request.GetRequestStream())
132 135
                     {
@@ -148,30 +151,39 @@ namespace Common.system
148 151
             return null;
149 152
         }
150 153
 
151
-        /// <summary>
152
-        ///调用Post接口
153
-        /// </summary>
154
-        /// <param name="request"></param>
155
-        /// <returns></returns>
156
-        public static string HttpPost(string body, string Url)
154
+        ///  <summary>
155
+        /// 调用Post接口
156
+        ///  </summary>
157
+        ///  <returns></returns>
158
+        public static string HttpPost(string body, string url)
157 159
         {
158 160
             try
159 161
             {
160 162
                 Encoding encoding = Encoding.UTF8;
161
-
162
-                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
163
+                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
163 164
                 request.Method = "POST";
164 165
                 request.Accept = "text/html,application/xhtml+xml,*/*";
165 166
                 request.ContentType = "application/json";
166
-
167
-                string postDataAES = body;
168
-                bool IsParameterEncryption = FileToolsCommon.GetConfigValue("IsParameterEncryption") != "0";
169
-                if (IsParameterEncryption)
167
+                string postDataAes = body;
168
+                if (isParameterEncryption)
170 169
                 {
171
-                    postDataAES = AESHelper.AESEncrypt(body, "XINGHUOLIAOYUAN7");
170
+                    postDataAes = AESHelper.AESEncrypt(body, "XINGHUOLIAOYUAN7");
171
+                    request.Headers.Add("st", "true");
172 172
                 }
173
-
174
-                byte[] buffer = encoding.GetBytes(postDataAES);
173
+                else
174
+                {
175
+                    request.Headers.Add("st", "false");
176
+                }
177
+                if (!string.IsNullOrEmpty(tokenKey) && !string.IsNullOrEmpty(tokenValue))
178
+                {
179
+                    request.Headers.Add("Token-Key", tokenKey);
180
+                    request.Headers.Add("Token-Value", tokenValue);
181
+                }
182
+                if (!string.IsNullOrEmpty(userId))
183
+                {
184
+                    request.Headers.Add("User-Id", userId);
185
+                }
186
+                byte[] buffer = encoding.GetBytes(postDataAes);
175 187
                 request.ContentLength = buffer.Length;
176 188
                 request.GetRequestStream().Write(buffer, 0, buffer.Length);
177 189
 
@@ -201,46 +213,30 @@ namespace Common.system
201 213
         {
202 214
             if (!string.IsNullOrEmpty(url) && !string.IsNullOrEmpty(encode) && !string.IsNullOrEmpty(contentType) && postData != null)
203 215
             {
204
-                // webRequest.Headers.Add("Authorization", "Bearer " + "SportApiAuthData");
205
-                HttpWebResponse webResponse = null;
206
-                Stream responseStream = null;
207
-                Stream requestStream = null;
208
-                StreamReader streamReader = null;
209 216
                 try
210 217
                 {
211
-                    string postDataAES = postData;
212
-                    bool IsParameterEncryption = FileToolsCommon.GetConfigValue("IsParameterEncryption") != "0";
213
-                    if (IsParameterEncryption)
218
+                    string postDataAes = postData;
219
+                    if (isParameterEncryption)
214 220
                     {
215
-                        postDataAES = AESHelper.AESEncrypt(postData, "XINGHUOLIAOYUAN7");
221
+                        postDataAes = AESHelper.AESEncrypt(postDataAes, "XINGHUOLIAOYUAN7");
216 222
                     }
217
-                    string respstr = GetStreamReader(url, responseStream, requestStream, streamReader, webResponse, timeout, encode, postDataAES, contentType);
223
+                    string respstr = GetStreamReader
224
+                    (
225
+                        url,
226
+                        null,
227
+                        null,
228
+                        null,
229
+                        null,
230
+                        timeout,
231
+                        encode,
232
+                        postDataAes,
233
+                        contentType
234
+                    );
218 235
                     return JsonHelper.JsonToObj<T>(respstr);
219 236
                 }
220 237
                 catch (Exception)
221 238
                 {
222
-                }
223
-                finally
224
-                {
225
-                    if (responseStream != null)
226
-                    {
227
-                        responseStream.Dispose();
228
-                    }
229
-
230
-                    if (webResponse != null)
231
-                    {
232
-                        webResponse.Close();
233
-                    }
234
-
235
-                    if (requestStream != null)
236
-                    {
237
-                        requestStream.Dispose();
238
-                    }
239
-
240
-                    if (streamReader != null)
241
-                    {
242
-                        streamReader.Dispose();
243
-                    }
239
+                    // ignored
244 240
                 }
245 241
             }
246 242
             return default(T);
@@ -256,6 +252,23 @@ namespace Common.system
256 252
                 webRequest.ContentType = contentType + ";" + encode;
257 253
                 webRequest.ContentLength = data.Length;
258 254
                 webRequest.Timeout = timeout;
255
+                if (isParameterEncryption)
256
+                {
257
+                    webRequest.Headers.Add("st", "true");
258
+                }
259
+                else
260
+                {
261
+                    webRequest.Headers.Add("st", "false");
262
+                }
263
+                if (!string.IsNullOrEmpty(tokenKey) && !string.IsNullOrEmpty(tokenValue))
264
+                {
265
+                    webRequest.Headers.Add("Token-Key", tokenKey);
266
+                    webRequest.Headers.Add("Token-Value", tokenValue);
267
+                }
268
+                if (!string.IsNullOrEmpty(userId))
269
+                {
270
+                    webRequest.Headers.Add("User-Id", userId);
271
+                }
259 272
                 requestStream = webRequest.GetRequestStream();
260 273
                 requestStream.Write(data, 0, data.Length);
261 274
                 webResponse = (HttpWebResponse)webRequest.GetResponse();
@@ -282,8 +295,16 @@ namespace Common.system
282 295
         /// <param name="strcontent">头</param>
283 296
         /// <param name="contenttype">参数</param>
284 297
         /// <param name="header">token</param>
298
+        /// <param name="timeout"></param>
285 299
         /// <returns></returns>
286
-        public static JObject GetFunction(string serviceaddress, string strcontent, string contenttype, string header, int Timeout = 5000)
300
+        public static JObject GetFunction
301
+        (
302
+            string serviceaddress,
303
+            string strcontent,
304
+            string contenttype,
305
+            string header,
306
+            int timeout = 5000
307
+        )
287 308
         {
288 309
             try
289 310
             {
@@ -301,7 +322,7 @@ namespace Common.system
301 322
                 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
302 323
 
303 324
                 string encoding = response.ContentEncoding;
304
-                if (encoding == null || encoding.Length < 1)
325
+                if (encoding.Length < 1)
305 326
                 {
306 327
                     encoding = "UTF-8"; //默认编码
307 328
                 }
@@ -609,44 +630,29 @@ namespace Common.system
609 630
         {
610 631
             if (!string.IsNullOrEmpty(url) && !string.IsNullOrEmpty(encode) && !string.IsNullOrEmpty(contentType) && postData != null)
611 632
             {
612
-                HttpWebResponse webResponse = null;
613
-                Stream responseStream = null;
614
-                Stream requestStream = null;
615
-                StreamReader streamReader = null;
616 633
                 try
617 634
                 {
618
-                    string postDataAES = postData;
619
-                    bool IsParameterEncryption = FileToolsCommon.GetConfigValue("IsParameterEncryption") != "0";
620
-                    if (IsParameterEncryption)
635
+                    string postDataAes = postData;
636
+                    if (isParameterEncryption)
621 637
                     {
622
-                        postDataAES = AESHelper.AESEncrypt(postData, "XINGHUOLIAOYUAN7");
638
+                        postDataAes = AESHelper.AESEncrypt(postData, "XINGHUOLIAOYUAN7");
623 639
                     }
624
-                    return GetStreamReader(url, responseStream, requestStream, streamReader, webResponse, timeout, encode, postDataAES, contentType);
640
+                    return GetStreamReader
641
+                    (
642
+                        url,
643
+                        null,
644
+                        null,
645
+                        null,
646
+                        null,
647
+                        timeout,
648
+                        encode,
649
+                        postDataAes,
650
+                        contentType
651
+                    );
625 652
                 }
626 653
                 catch (Exception)
627 654
                 {
628
-                }
629
-                finally
630
-                {
631
-                    if (responseStream != null)
632
-                    {
633
-                        responseStream.Dispose();
634
-                    }
635
-
636
-                    if (webResponse != null)
637
-                    {
638
-                        webResponse.Close();
639
-                    }
640
-
641
-                    if (requestStream != null)
642
-                    {
643
-                        requestStream.Dispose();
644
-                    }
645
-
646
-                    if (streamReader != null)
647
-                    {
648
-                        streamReader.Dispose();
649
-                    }
655
+                    // ignored
650 656
                 }
651 657
             }
652 658
             return null;
@@ -655,13 +661,13 @@ namespace Common.system
655 661
         /// <summary>
656 662
         /// 获取公网IP和地址,失败则获取局域网IP
657 663
         /// </summary>
658
-        /// <param name="AddressIP">IP地址</param>
659
-        /// <param name="Address">地址</param>
664
+        /// <param name="addressIp">IP地址</param>
665
+        /// <param name="address">地址</param>
660 666
         /// <returns></returns>
661
-        public static bool GetAddressIP(out string AddressIP, out string Address)
667
+        public static bool GetAddressIp(out string addressIp, out string address)
662 668
         {
663
-            AddressIP = "";
664
-            Address = "";
669
+            addressIp = "";
670
+            address = "";
665 671
             try
666 672
             {
667 673
                 //请求搜狐获取公网IP,获取失败后获取局域网IP
@@ -673,8 +679,8 @@ namespace Common.system
673 679
                 string htmlinfo = sr.ReadToEnd();
674 680
                 string jsonStr = htmlinfo.Substring(htmlinfo.IndexOf("{"), htmlinfo.LastIndexOf("}") - htmlinfo.IndexOf("{") + 1);
675 681
                 JObject obj = JObject.Parse(jsonStr);
676
-                AddressIP = obj["cip"].ToString();
677
-                Address = obj["cname"].ToString();
682
+                addressIp = obj["cip"].ToString();
683
+                address = obj["cname"].ToString();
678 684
                 resStream.Close();
679 685
                 sr.Close();
680 686
                 return true;
@@ -685,11 +691,11 @@ namespace Common.system
685 691
             catch (Exception)
686 692
             {
687 693
                 //获取本地局域网IP
688
-                foreach (System.Net.IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
694
+                foreach (System.Net.IPAddress ipAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
689 695
                 {
690
-                    if (_IPAddress.AddressFamily.ToString() == "InterNetwork")
696
+                    if (ipAddress.AddressFamily.ToString() == "InterNetwork")
691 697
                     {
692
-                        AddressIP = _IPAddress.ToString();
698
+                        addressIp = ipAddress.ToString();
693 699
                     }
694 700
                 }
695 701
                 return false;

+ 1
- 1
星火微课/星火微课-测试.iss Näytä tiedosto

@@ -3,7 +3,7 @@
3 3
 
4 4
 #define MyAppName "星火微课测试版"  
5 5
 #define MyAppDir "xhwk_test"
6
-#define MyAppVersion "3.9.8"
6
+#define MyAppVersion "3.12.0"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9 9
 #define MySourcePath "D:\Project\CSharp\xh-wkclient\XHWK.WKTool\bin\x86\Debug\"

Loading…
Peruuta
Tallenna