Program.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using CommonAI.Zone.Helper;
  2. using CommonLang;
  3. using CommonLang.IO;
  4. using CommonLang.XCSV;
  5. using CommonNetwork.Http;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Threading;
  11. using System.Windows.Forms;
  12. namespace TestCDNBenchMark
  13. {
  14. static class Program
  15. {
  16. [STAThread]
  17. static void Main(params string[] args)
  18. {
  19. try
  20. {
  21. #if false
  22. Uri uri = new Uri("http://192.168.1.44:18080/passport/common?type=2&username=mfmf002&appid=80&channel=0&ostype=6&logintype=0&version=10000&mac=&password=98CFC52EE234E1D20F9B58D1169F352DFB3E5F01F87901872FA5872B8C826B79B21DC41C73A72944656F883B7FA31A891DD4C587CF1B4BB02EC14E08D837B1E4");
  23. WebClient.PostAsync(uri, CUtils.UTF8, (string rst) =>
  24. {
  25. Console.WriteLine(rst);
  26. });
  27. "3;url='regiest.jsp'",
  28. Application.EnableVisualStyles();
  29. Application.SetCompatibleTextRenderingDefault(false);
  30. Application.Run(new TestForm());
  31. #endif
  32. #if false
  33. Uri uri = new Uri("http://192.168.1.81:5580/XSangoBattleWebService/api/report?abc");
  34. WebClient www = new WebClient(uri);
  35. www.Request.Method = HttpRequest.METHOD_POST;
  36. www.Request.Content = File.ReadAllBytes(@"C:\Users\zhangyifei.MOREFUNTEK\Desktop\Report_PVP");
  37. www.Request.ContentType = HttpRequest.CONTENT_TYPE_OCTET_STREAM;
  38. Stream stream = www.Connect();
  39. byte[] data = IOUtil.ReadExpect(stream, www.Response.ContentLength);
  40. string result = CUtils.UTF8.GetString(data);
  41. Console.Write(result);
  42. #endif
  43. #if false
  44. //http://dl.xsg.moreu.cn/appstore/1.3.6/assets/IOS/mpq/res_20150509171637.mpq.z
  45. //Uri uri = new Uri("http://dl.xsg.moreu.cn/appstore/1.3.6/assets/IOS/mpq/res_20150609095228.mpq.z");
  46. for (int i = 0; i < 100; i++)
  47. {
  48. Uri uri = new Uri("http://dl.xsg.moreu.cn/appstore/1.3.6/assets/IOS/mpq/res_20150509171637.mpq.z");
  49. WebClient www = new WebClient(uri);
  50. Stream stream = www.Connect();
  51. byte[] data = IOUtil.ReadExpect(stream, www.Response.ContentLength);
  52. Console.WriteLine("Done");
  53. }
  54. #endif
  55. #if false
  56. int time1 = MoveHelper.CalculateFlyTimeMS(0, 4, 0, 9.8f, 10);
  57. int time3 = MoveHelper.CalculateFlyTimeMS(0, 4, 0, 9.8f);
  58. Console.Write(time1);
  59. #endif
  60. #if true
  61. //Uri uri = new Uri("https://www.visualstudio.com");
  62. //Uri uri = new Uri("https://www.alipay.com/");
  63. Uri uri = new Uri("https://cdn.morefuntek.com/source/xsg_plist/test/assets/Android/version.json");
  64. WebClient www = new WebClient(uri);
  65. www.Request.SslProtocol = System.Security.Authentication.SslProtocols.Tls;
  66. Stream stream = www.Connect();
  67. Console.WriteLine(www.Response);
  68. byte[] data = IOUtil.ReadExpect(stream, www.Response.ContentLength);
  69. string html = CUtils.UTF8.GetString(data);
  70. Console.WriteLine(html);
  71. Console.WriteLine("Done");
  72. File.WriteAllText(Application.StartupPath + "/doc.html", html, CUtils.UTF8);
  73. #endif
  74. }
  75. catch (Exception err)
  76. {
  77. MessageBox.Show(err.Message);
  78. }
  79. }
  80. }
  81. }