Program.cs 4.7 KB

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