Browse Source

删除废弃代码

master
张剑 1 year ago
parent
commit
a29dfb3a3f
2 changed files with 13 additions and 52 deletions
  1. 0
    43
      XHWK.WKTool/DAL/DAL_Upload.cs
  2. 13
    9
      XHWK.WKTool/system/HttpHelper.cs

+ 0
- 43
XHWK.WKTool/DAL/DAL_Upload.cs View File

55
                         APP.ResourceAddTwo = resultObj.obj;
55
                         APP.ResourceAddTwo = resultObj.obj;
56
                         //已存在 不允许上传
56
                         //已存在 不允许上传
57
                         return false;
57
                         return false;
58
-                        // if (string.IsNullOrWhiteSpace(jo["obj"].ToString())) { //不存在 允许上传 return
59
-                        // true; } else { //已存在 不允许上传 return false; }
60
                     }
58
                     }
61
                     else
59
                     else
62
                     {
60
                     {
111
                     if (resultObj.code == 0 && resultObj.obj != null)
109
                     if (resultObj.code == 0 && resultObj.obj != null)
112
                     {
110
                     {
113
                         APP.ResourceAddTwo = resultObj.obj;
111
                         APP.ResourceAddTwo = resultObj.obj;
114
-                        //foreach (Model_WKData Vdata in APP.WKDataList)
115
-                        //{
116
-                        //    if (Vdata.VideoList == null)
117
-                        //    {
118
-                        //        continue;
119
-                        //    }
120
-                        //    foreach (Model_Video videoinfo in Vdata.VideoList)
121
-                        //    {
122
-                        //        if (videoinfo.FileGuid == FileCode)
123
-                        //        {
124
-                        //            //videoinfo.IsUpload = true;
125
-                        //            break;
126
-                        //        }
127
-                        //    }
128
-                        //}
129
                         return true;
112
                         return true;
130
                     }
113
                     }
131
                     else
114
                     else
319
                         //已上传长度
302
                         //已上传长度
320
                         long len = VideoInfo.Uploaded * VideoInfo.SliceLen;
303
                         long len = VideoInfo.Uploaded * VideoInfo.SliceLen;
321
 
304
 
322
-                        #region 废弃
323
-
324
-                        ////分块
325
-                        //for (; len + VideoInfo.SliceLen < filelen; VideoInfo.Uploaded++)
326
-                        //{
327
-                        //    len = VideoInfo.Uploaded * VideoInfo.SliceLen;
328
-                        //    //取指定长度的流
329
-                        //    byte[] byteArray = FileToolsCommon.ReadBigFileSpecifyLength(VideoInfo.VideoPath, len, (int)VideoInfo.SliceLen);
330
-                        //    //参数
331
-                        //    NameValueCollection formFields = new NameValueCollection();
332
-                        //    formFields.Add("identifier", VideoInfo.FileGuid);
333
-                        //    formFields.Add("chunkNumber", (VideoInfo.Uploaded + 1).ToString());
334
-                        //    formFields.Add("filename", fileName);
335
-                        //    formFields.Add("totalchunk", VideoInfo.Block.ToString());
336
-                        //    formFields.Add("md5", VideoInfo.FileMD5);
337
-                        //    JObject jo = HttpHelper.UploadRequestflow(UploadUrl, byteArray, fileName, formFields);
338
-                        //    //0成功,1失败
339
-                        //    if (jo["code"].ToString() != "0")
340
-                        //    {
341
-                        //        ErrMessage = jo["msg"].ToString();
342
-                        //        return false;
343
-                        //    }
344
-                        //}
345
-
346
-                        #endregion 废弃
347
-
348
                         //分块
305
                         //分块
349
                         do
306
                         do
350
                         {
307
                         {

+ 13
- 9
XHWK.WKTool/system/HttpHelper.cs View File

29
 
29
 
30
         private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
30
         private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
31
         {
31
         {
32
-            return true; //总是接受  
32
+            return true; //总是接受
33
         }
33
         }
34
 
34
 
35
         public static System.Net.HttpWebRequest GetHttpWebRequest(string url)
35
         public static System.Net.HttpWebRequest GetHttpWebRequest(string url)
47
             }
47
             }
48
             return request;
48
             return request;
49
         }
49
         }
50
+
50
         public static WebResponse Download(string downloadUrl, long from, long to, string method)
51
         public static WebResponse Download(string downloadUrl, long from, long to, string method)
51
         {
52
         {
52
             for (int i = 0; i < 10; i++)
53
             for (int i = 0; i < 10; i++)
73
             }
74
             }
74
             throw new Exception("已断开网络!请检查网络连接后重试下载!");
75
             throw new Exception("已断开网络!请检查网络连接后重试下载!");
75
         }
76
         }
77
+
76
         public static string Get(string url, IDictionary<string, string> param)
78
         public static string Get(string url, IDictionary<string, string> param)
77
         {
79
         {
78
             List<string> paramBuilder = new List<string>();
80
             List<string> paramBuilder = new List<string>();
83
             url = string.Format("{0}?{1}", url.TrimEnd('?'), string.Join(",", paramBuilder.ToArray()));
85
             url = string.Format("{0}?{1}", url.TrimEnd('?'), string.Join(",", paramBuilder.ToArray()));
84
             return Get(url);
86
             return Get(url);
85
         }
87
         }
88
+
86
         public static string Get(string url)
89
         public static string Get(string url)
87
         {
90
         {
88
             try
91
             try
104
             }
107
             }
105
             catch
108
             catch
106
             {
109
             {
107
-
108
             }
110
             }
109
             return null;
111
             return null;
110
         }
112
         }
113
+
111
         public static string Post(string url, string data)
114
         public static string Post(string url, string data)
112
         {
115
         {
113
             try
116
             try
139
             }
142
             }
140
             catch
143
             catch
141
             {
144
             {
142
-
143
             }
145
             }
144
             return null;
146
             return null;
145
         }
147
         }
183
                 return "POST报错:" + ex.Message;
185
                 return "POST报错:" + ex.Message;
184
             }
186
             }
185
         }
187
         }
188
+
186
         /// <summary>
189
         /// <summary>
187
         /// Post Http请求
190
         /// Post Http请求
188
         /// </summary>
191
         /// </summary>
240
             }
243
             }
241
             return default(T);
244
             return default(T);
242
         }
245
         }
246
+
243
         private static string GetStreamReader(string url, Stream responseStream, Stream requestStream, StreamReader streamReader, WebResponse webResponse, int timeout, string encode, string postData, string contentType)
247
         private static string GetStreamReader(string url, Stream responseStream, Stream requestStream, StreamReader streamReader, WebResponse webResponse, int timeout, string encode, string postData, string contentType)
244
         {
248
         {
245
             try
249
             try
263
                 return null;
267
                 return null;
264
             }
268
             }
265
         }
269
         }
270
+
266
         /// <summary>
271
         /// <summary>
267
         /// Cookie
272
         /// Cookie
268
         /// </summary>
273
         /// </summary>
269
         public static CookieContainer cc = new CookieContainer();
274
         public static CookieContainer cc = new CookieContainer();
275
+
270
         /// <summary>
276
         /// <summary>
271
         /// Get请求
277
         /// Get请求
272
         /// </summary>
278
         /// </summary>
295
                 string encoding = response.ContentEncoding;
301
                 string encoding = response.ContentEncoding;
296
                 if (encoding == null || encoding.Length < 1)
302
                 if (encoding == null || encoding.Length < 1)
297
                 {
303
                 {
298
-                    encoding = "UTF-8"; //默认编码  
304
+                    encoding = "UTF-8"; //默认编码
299
                 }
305
                 }
300
                 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
306
                 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
301
                 string retString = reader.ReadToEnd();
307
                 string retString = reader.ReadToEnd();
345
                 string encoding = response.ContentEncoding;
351
                 string encoding = response.ContentEncoding;
346
                 if (encoding == null || encoding.Length < 1)
352
                 if (encoding == null || encoding.Length < 1)
347
                 {
353
                 {
348
-                    encoding = "UTF-8"; //默认编码  
354
+                    encoding = "UTF-8"; //默认编码
349
                 }
355
                 }
350
                 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
356
                 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
351
                 string retString = reader.ReadToEnd();
357
                 string retString = reader.ReadToEnd();
360
                 LogHelper.WriteErrLog("请求失败(若网络无问题,请重置winsock,解决方法:以管理员方式打开cmd执行 netsh winsock reset 后重启)", ex);
366
                 LogHelper.WriteErrLog("请求失败(若网络无问题,请重置winsock,解决方法:以管理员方式打开cmd执行 netsh winsock reset 后重启)", ex);
361
                 return null;
367
                 return null;
362
             }
368
             }
363
-
364
         }
369
         }
365
 
370
 
366
         /// <summary>
371
         /// <summary>
575
                     jobResult = JObject.Parse(returnValue);
580
                     jobResult = JObject.Parse(returnValue);
576
                     response.Close();
581
                     response.Close();
577
                     readStream.Close();
582
                     readStream.Close();
578
-                    //MessageWindow.Show(returnValue);
579
-                    //LogHelper.WriteInfoLog("【文件上传】" + returnValue);
580
                 }
583
                 }
581
                 return jobResult;
584
                 return jobResult;
582
             }
585
             }
590
                 httpReq = null;
593
                 httpReq = null;
591
             }
594
             }
592
         }
595
         }
596
+
593
         /// <summary>
597
         /// <summary>
594
         /// Post Http请求
598
         /// Post Http请求
595
         /// </summary>
599
         /// </summary>
690
             }
694
             }
691
         }
695
         }
692
     }
696
     }
693
-}
697
+}

Loading…
Cancel
Save