Masuit.Tools.Core.csproj 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <Project Sdk="Microsoft.NET.Sdk">
  2. <PropertyGroup>
  3. <TargetFramework>netstandard2.0</TargetFramework>
  4. <Version>1.7.9</Version>
  5. <Authors>懒得勤快</Authors>
  6. <Company>masuit.com</Company>
  7. <Description>包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
  8. 示例代码:
  9. 1.检验字符串是否是Email
  10. bool isEmail="[email protected]".MatchEmail();
  11. 2.获取CPU核心数
  12. int core = SystemInfo.GetCpuCount();
  13. 3.大文件操作
  14. FileStream fs = new FileStream(@"D:\boot.vmdk", FileMode.OpenOrCreate, FileAccess.ReadWrite);
  15. {
  16. //fs.CopyToFile(@"D:\1.bak");//同步复制大文件
  17. fs.CopyToFileAsync(@"D:\1.bak");//异步复制大文件
  18. string md5 = fs.GetFileMD5Async().Result;//异步获取文件的MD5
  19. }
  20. 4.html的防XSS处理:
  21. string html = @"<link href="/Content/font-awesome/css" rel="stylesheet" />
  22. <!--[if IE 7]>
  23. <link href='/Content/font-awesome-ie7.min.css' rel='stylesheet'/>
  24. <![endif]-->
  25. <script src="/Scripts/modernizr"></script>
  26. <div id="searchBox" role="search">
  27. <form action="/packages" method="get">
  28. <span class="user-actions"><a href="/users/account/LogOff">退出</a></span>
  29. <input name="q" id="searchBoxInput" />
  30. <input id="searchBoxSubmit" type="submit" value="Submit" />
  31. </form>
  32. </div>";
  33. string s = html.HtmlSantinizerStandard();//清理后:<div><span><a href="/users/account/LogOff">退出</a></span></div>
  34. 5.整理操作系统的内存:
  35. Windows.ClearMemorySilent();
  36. ......</Description>
  37. <Copyright>Copyright © 懒得勤快</Copyright>
  38. <PackageProjectUrl>https://github.com/ldqk/Masuit.Tools</PackageProjectUrl>
  39. <PackageTags>Masuit.Tools</PackageTags>
  40. <PackageReleaseNotes>如有问题请联系QQ:1170397736,或者到项目的github反馈问题,详细的API文档在github上:https://github.com/ldqk/Masuit.Tools</PackageReleaseNotes>
  41. <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  42. </PropertyGroup>
  43. <ItemGroup>
  44. <Content Include="DateTimeExt\CCalendarData.xml" />
  45. </ItemGroup>
  46. <ItemGroup>
  47. <PackageReference Include="AngleSharp" Version="0.9.9" />
  48. <PackageReference Include="HtmlSanitizer" Version="4.0.181" />
  49. <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
  50. <PackageReference Include="StackExchange.Redis" Version="1.2.6" />
  51. <PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
  52. </ItemGroup>
  53. </Project>