Program.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Masuit.Tools.Models;
  2. using Masuit.Tools.Reflection;
  3. using Masuit.Tools.Security;
  4. using Microsoft.AspNetCore;
  5. using Microsoft.AspNetCore.Hosting;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. namespace NetCoreTest
  10. {
  11. public class Program
  12. {
  13. public static void Main(string[] args)
  14. {
  15. var myClass = new MyClass()
  16. {
  17. MyProperty1 = 1,
  18. Name = "1",
  19. Parent = new MyClass()
  20. {
  21. Name = "mc"
  22. }
  23. };
  24. var path = myClass.Path();
  25. Console.WriteLine(path);
  26. myClass.SetProperty(nameof(MyClass.MyProperty1), 1);
  27. Console.ReadKey();
  28. var rsaKey = RsaCrypt.GenerateRsaKeys(RsaKeyType.PKCS8, 2048);
  29. Console.WriteLine(rsaKey.PrivateKey);
  30. Console.WriteLine(rsaKey.PublicKey);
  31. var enc = "123456".RSAEncrypt();
  32. Console.WriteLine(enc);
  33. Console.Beep();
  34. var dec = enc.RSADecrypt();
  35. Console.WriteLine(dec);
  36. Console.ReadKey();
  37. //CreateWebHostBuilder(args).Build().Run();
  38. }
  39. public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  40. WebHost.CreateDefaultBuilder(args)
  41. .UseStartup<Startup>();
  42. }
  43. public class MyClass : ITree<MyClass>
  44. {
  45. [Description("test")]
  46. public string MyProperty { get; set; }
  47. public int? MyProperty1 { get; set; }
  48. /// <summary>
  49. /// 名字
  50. /// </summary>
  51. public string Name { get; set; }
  52. /// <summary>
  53. /// 父节点
  54. /// </summary>
  55. public virtual MyClass Parent { get; set; }
  56. /// <summary>
  57. /// 子级
  58. /// </summary>
  59. public ICollection<MyClass> Children { get; set; } = new List<MyClass>();
  60. }
  61. }