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

删除废弃代码

master
张剑 преди 1 година
родител
ревизия
a29dfb3a3f
променени са 2 файла, в които са добавени 13 реда и са изтрити 52 реда
  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 Целия файл

@@ -55,8 +55,6 @@ namespace XHWK.WKTool.DAL
55 55
                         APP.ResourceAddTwo = resultObj.obj;
56 56
                         //已存在 不允许上传
57 57
                         return false;
58
-                        // if (string.IsNullOrWhiteSpace(jo["obj"].ToString())) { //不存在 允许上传 return
59
-                        // true; } else { //已存在 不允许上传 return false; }
60 58
                     }
61 59
                     else
62 60
                     {
@@ -111,21 +109,6 @@ namespace XHWK.WKTool.DAL
111 109
                     if (resultObj.code == 0 && resultObj.obj != null)
112 110
                     {
113 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 112
                         return true;
130 113
                     }
131 114
                     else
@@ -319,32 +302,6 @@ namespace XHWK.WKTool.DAL
319 302
                         //已上传长度
320 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 306
                         do
350 307
                         {

+ 13
- 9
XHWK.WKTool/system/HttpHelper.cs Целия файл

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

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