Program.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Collections.Generic;
  3. using Masuit.Tools;
  4. namespace Test
  5. {
  6. internal static class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. //FileStream fs = new FileStream(@"D:\boot.vmdk", FileMode.OpenOrCreate, FileAccess.ReadWrite);
  11. //{
  12. // fs.CopyToFileAsync(@"D:\1.bak");
  13. // string md5 = fs.GetFileMD5Async().Result;//获取文件的MD5
  14. //}
  15. //Console.WriteLine("复制完成");
  16. //bool isUrl;
  17. //var match = "//music.163.com/#/search/m/?%23%2Fmy%2Fm%2Fmusic%2Fempty=&s=fade&type=1!k".MatchUrl(out isUrl);
  18. //Console.WriteLine(isUrl);
  19. //foreach (Group g in match.Groups)
  20. //{
  21. // if (g.Captures.Count > 0)
  22. // {
  23. // foreach (Capture c in g.Captures)
  24. // {
  25. // Console.WriteLine(c.Index + " : " + c.Value);
  26. // }
  27. // }
  28. // else
  29. // {
  30. // Console.WriteLine(g.Index + " : " + g.Value);
  31. // }
  32. //}
  33. //bool b1 = "512002199509230611".MatchIdentifyCard();//False
  34. //bool b2 = "140108197705058894".MatchIdentifyCard();//True
  35. //Console.WriteLine(b1 + "----" + b2);
  36. //bool isIP;
  37. //"114.114.256.114".MatchInetAddress(out isIP);//False
  38. //"114.114.114.114".MatchInetAddress(out isIP);//True
  39. //Console.WriteLine(isIP);
  40. //Console.WriteLine(WindowsCommand.Execute("help"));
  41. //string match = "vawevbgw".MatchRandomImgSrc();
  42. //Console.WriteLine(match);
  43. //PhysicsAddress address = "4.2.2.1".GetPhysicsAddressInfo();
  44. //List<MyClass> mc = new List<MyClass> {new MyClass() {Name = "aaa", Age = 10, MyClass3 = new MyClass3(), MyClass2s = new List<MyClass2>() {new MyClass2() {Age = 22, Name = "dddd"}}}, new MyClass() {Name = "aaa", Age = 10, MyClass3 = new MyClass3()}, new MyClass() {Name = "aaa", Age = 10, MyClass3 = new MyClass3(), MyClass2s = new List<MyClass2>() {new MyClass2() {Age = 22, Name = "dddd"}}}, new MyClass() {Name = "aaa", Age = 10, MyClass3 = new MyClass3(), MyClass2s = new List<MyClass2>() {new MyClass2() {Age = 22, Name = "dddd"}}}};
  45. //List<MyClass2> list = mc.Map<MyClass, MyClass2>().ToList();
  46. //MyClass mc = null;
  47. //MyClass2 mc2 = mc.Map<MyClass, MyClass2>();
  48. //Dictionary<string, object> dic = new Dictionary<string, object>();
  49. //for (int i = 0; i < 100000; i++)
  50. //{
  51. // string s = string.Empty.CreateShortToken(100);
  52. // Console.WriteLine(s);
  53. // dic.Add(s, s);
  54. //}
  55. //var list = MongoDbClient.GetInstance("mongodb://192.168.3.238:27017", "AccountBalance").Database.GetCollection<BsonDocument>("201803-NEO").Indexes.List();
  56. //while (list.MoveNext())
  57. //{
  58. // if (!list.Current.Any(doc => doc["name"].AsString.StartsWith("AccountId")))
  59. // {
  60. // string index = MongoDbClient.GetInstance("mongodb://192.168.3.238:27017", "AccountBalance").Database.GetCollection<BsonDocument>("201803-NEO").Indexes.CreateOne(Builders<BsonDocument>.IndexKeys.Ascending(doc => doc["AccountId"]));
  61. // }
  62. //}
  63. //LogManager.Event += s =>
  64. //{
  65. // if (s.Contains("ERROR") || s.Contains("FATAL"))
  66. // {
  67. // Console.ForegroundColor = ConsoleColor.Red;
  68. // }
  69. // if (s.Contains("DEBUG"))
  70. // {
  71. // Console.ForegroundColor = ConsoleColor.Green;
  72. // }
  73. // Console.WriteLine(s);
  74. // Console.ForegroundColor = ConsoleColor.White;
  75. //};
  76. //LogManager.Info("aaaaaaaaaaaaaaaaaaaaaaaaa");
  77. //LogManager.Debug("bbbbbbbbbbbbbbbbb");
  78. //LogManager.Error(typeof(object), "bbbbbbbbbbbbbbbbb");
  79. //LogManager.Info("aaaaaaaaaaaaaaaaaaaaaaaaa");
  80. bool b = "[email protected]".MatchEmail();
  81. Console.ReadKey();
  82. }
  83. }
  84. public class Banlance
  85. {
  86. public string Name { get; set; }
  87. public int Amount { get; set; }
  88. }
  89. public class MyClass
  90. {
  91. public string Name { get; set; }
  92. public int Age { get; set; }
  93. public MyClass3 MyClass3 { get; set; }
  94. public List<MyClass2> MyClass2s { get; set; }
  95. }
  96. public class MyClass2
  97. {
  98. public string Name { get; set; }
  99. public int Age { get; set; }
  100. public MyClass3 MyClass3 { get; set; }
  101. public List<MyClass2> MyClass2s { get; set; }
  102. }
  103. public class MyClass3
  104. {
  105. public string MyProperty { get; set; }
  106. }
  107. }