Program.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using CommonLang.IO;
  2. using CommonLang.Xml;
  3. using CommonNetwork.Http;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. namespace CommonTest
  11. {
  12. public static class Test
  13. {
  14. public static bool TEST_XML = false;
  15. public static bool TEST_VLQ = false;
  16. public static bool TEST_MPQ = false;
  17. public static bool TEST_HTTP_CHUNK = true;
  18. public static void Execute()
  19. {
  20. // if (TEST_XML)
  21. // {
  22. // var xml = XmlUtil.FromString("<f><f size= '20' color='FF5BC61A'>破甲之剑</f><br/><f size= '20'>需等级:1</f><br/>需要声望崇拜</f>");
  23. // Console.WriteLine(XmlUtil.ToString(xml));
  24. // }
  25. // if (TEST_VLQ)
  26. // {
  27. // using (var ms = new MemoryStream())
  28. // {
  29. // Random random = new Random();
  30. // OutputStream input = new OutputStream(ms, null);
  31. // InputStream output = new InputStream(ms, null);
  32. // int a = 1, b = 0;
  33. // long len = 0;
  34. // for (int i = 0; i < 10000; i++)
  35. // {
  36. // a = random.Next(-i, i);
  37. // ms.Position = 0;
  38. // input.PutVS32(a);
  39. // len = ms.Position;
  40. // ms.Position = 0;
  41. // b = output.GetVS32();
  42. // if (a != b)
  43. // {
  44. // throw new Exception("VLQ Error");
  45. // }
  46. // else
  47. // {
  48. // Console.WriteLine(string.Format("vlq : len={2} {0}={1}", a, b, len));
  49. // }
  50. // }
  51. // }
  52. // }
  53. // if (TEST_MPQ)
  54. // {
  55. // MPQ.FileSystem.MPQFileSystem fs = new MPQ.FileSystem.MPQFileSystem();
  56. // fs.init(new DirectoryInfo(@"K:\morefuntek\Zeus\GameEditors\Http\res_develop\updates_etc"));
  57. // }
  58. if (TEST_HTTP_CHUNK)
  59. {
  60. var uil = new Uri("http://dl.sjcs.moreu.cn/tt/res_release/updates_etc/res_20161103182256.mpq.z");
  61. var data = WebClient.Get(uil);
  62. Console.WriteLine(data);
  63. }
  64. }
  65. }
  66. static class Program
  67. {
  68. /// <summary>
  69. /// 应用程序的主入口点。
  70. /// </summary>
  71. [STAThread]
  72. static void Main()
  73. {
  74. Test.Execute();
  75. // Application.EnableVisualStyles();
  76. // Application.SetCompatibleTextRenderingDefault(false);
  77. // Application.Run(new FormLaunch());
  78. //Application.Run(new FormAstar());
  79. }
  80. }
  81. }