Program.cs 2.1 KB

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