1
1
懒得勤快 6 жил өмнө
parent
commit
cb61ccd012

+ 5 - 0
Masuit.Tools.Core/Masuit.Tools.Core.csproj

@@ -79,6 +79,11 @@ string s = html.HtmlSantinizerStandard();//清理后:<div><span>&l
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
     <DocumentationFile>bin\Release\netstandard2.0\Masuit.Tools.Core.xml</DocumentationFile>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <CodeAnalysisRuleSet />
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+    <CodeAnalysisRuleSet />
   </PropertyGroup>
 
   <ItemGroup>

+ 8 - 0
Masuit.Tools.NoSQL.MongoDBClient.Core/Masuit.Tools.NoSQL.MongoDBClient.Core.csproj

@@ -17,6 +17,14 @@
     <FileVersion>1.8.6.0</FileVersion>
   </PropertyGroup>
 
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+    <CodeAnalysisRuleSet />
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+    <CodeAnalysisRuleSet />
+  </PropertyGroup>
+
   <ItemGroup>
     <PackageReference Include="MongoDB.Bson" Version="2.7.2" />
     <PackageReference Include="MongoDB.Driver" Version="2.7.2" />

+ 2 - 0
Masuit.Tools.NoSQL.MongoDBClient/Masuit.Tools.NoSQL.MongoDBClient.csproj

@@ -20,6 +20,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <CodeAnalysisRuleSet />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -29,6 +30,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <DocumentationFile>bin\Release\Masuit.Tools.NoSQL.MongoDBClient.xml</DocumentationFile>
+    <CodeAnalysisRuleSet />
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="AngleSharp, Version=0.9.9.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">

+ 1 - 1
Masuit.Tools.UnitTest/ClassHelperTest.cs

@@ -22,7 +22,7 @@ namespace Masuit.Tools.UnitTest
             // act
             Assert.Equal("张三", newObj.Name);
             Assert.Equal(20, newObj.Age);
-            Assert.IsType(typeof(List<string>), newObj.List);
+            Assert.IsType<List<string>>(newObj.List);
         }
 
         [Fact]

+ 1 - 1
Masuit.Tools/Files/SevenZipCompressor.cs

@@ -21,7 +21,7 @@ namespace Masuit.Tools.Files
     public static class SevenZipCompressor
     {
         /// <summary>
-        /// 将多个文件压缩到一个文件流中,可保存为zip文件,方便于web方式下载
+        /// 将多个文件压缩到一个内存流中,可保存为zip文件,方便于web方式下载
         /// </summary>
         /// <param name="files">多个文件路径,文件或文件夹,或网络路径http/https</param>
         /// <param name="rootdir"></param>

+ 2 - 0
Masuit.Tools/Masuit.Tools.csproj

@@ -25,6 +25,7 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DocumentationFile>bin\Debug\Masuit.Tools.XML</DocumentationFile>
     <NoWarn>1591</NoWarn>
+    <CodeAnalysisRuleSet />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -36,6 +37,7 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DocumentationFile>bin\Release\Masuit.Tools.XML</DocumentationFile>
     <NoWarn>1591</NoWarn>
+    <CodeAnalysisRuleSet />
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="AngleSharp, Version=0.9.9.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">

+ 8 - 0
NetCoreTest/NetCoreTest.csproj

@@ -4,6 +4,14 @@
     <TargetFramework>netcoreapp2.1</TargetFramework>
   </PropertyGroup>
 
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+    <CodeAnalysisRuleSet />
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+    <CodeAnalysisRuleSet />
+  </PropertyGroup>
+
   <ItemGroup>
     <Folder Include="wwwroot\" />
   </ItemGroup>

+ 27 - 1
Test/Program.cs

@@ -1,10 +1,36 @@
-namespace Test
+using SharpCompress.Archives;
+using SharpCompress.Archives.Zip;
+using SharpCompress.Common;
+using SharpCompress.Writers;
+using System.IO;
+using System.Text;
+
+namespace Test
 {
     static class Program
     {
         static void Main(string[] args)
         {
+            string[] files = Directory.GetFiles(@"F:\音乐\part1");
+            using (var fs = new FileStream(@"D:\1.zip", FileMode.OpenOrCreate, FileAccess.ReadWrite))
+            {
+                using (var archive = ZipArchive.Create())
+                {
+                    foreach (var file in files)
+                    {
+                        archive.AddEntry(Path.GetFileName(file), file);
+                    }
 
+                    archive.SaveTo(fs, new WriterOptions(CompressionType.Deflate)
+                    {
+                        LeaveStreamOpen = true,
+                        ArchiveEncoding = new ArchiveEncoding()
+                        {
+                            Default = Encoding.UTF8
+                        }
+                    });
+                }
+            }
         }
     }
 }

+ 4 - 3
Test/Test.csproj

@@ -21,7 +21,8 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>..\..\..\Company\XiLife.NDC.WebAPI\XiLife.NDC.WebAPI\CodeRules\XiLife.ITC.Rules.CSharp.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet>
+    </CodeAnalysisRuleSet>
     <RunCodeAnalysis>true</RunCodeAnalysis>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -33,7 +34,8 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <RunCodeAnalysis>true</RunCodeAnalysis>
-    <CodeAnalysisRuleSet>..\..\..\Company\XiLife.NDC.WebAPI\XiLife.NDC.WebAPI\CodeRules\XiLife.ITC.Rules.CSharp.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet>
+    </CodeAnalysisRuleSet>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@@ -55,7 +57,6 @@
   <ItemGroup>
     <None Include="App.config" />
     <None Include="packages.config" />
-    <None Include="Test.ruleset" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Masuit.Tools\Masuit.Tools.csproj">

+ 0 - 68
Test/Test.ruleset

@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RuleSet Name="Test 的规则" Description="Test.csproj 的代码分析规则。" ToolsVersion="15.0">
-  <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
-    <Rule Id="CA1001" Action="Warning" />
-    <Rule Id="CA1009" Action="Warning" />
-    <Rule Id="CA1016" Action="Warning" />
-    <Rule Id="CA1033" Action="Warning" />
-    <Rule Id="CA1049" Action="Warning" />
-    <Rule Id="CA1060" Action="Warning" />
-    <Rule Id="CA1061" Action="Warning" />
-    <Rule Id="CA1063" Action="Warning" />
-    <Rule Id="CA1065" Action="Warning" />
-    <Rule Id="CA1301" Action="Warning" />
-    <Rule Id="CA1400" Action="Warning" />
-    <Rule Id="CA1401" Action="Warning" />
-    <Rule Id="CA1403" Action="Warning" />
-    <Rule Id="CA1404" Action="Warning" />
-    <Rule Id="CA1405" Action="Warning" />
-    <Rule Id="CA1410" Action="Warning" />
-    <Rule Id="CA1415" Action="Warning" />
-    <Rule Id="CA1502" Action="Error" />
-    <Rule Id="CA1821" Action="Warning" />
-    <Rule Id="CA1900" Action="Warning" />
-    <Rule Id="CA1901" Action="Warning" />
-    <Rule Id="CA2002" Action="Warning" />
-    <Rule Id="CA2100" Action="Warning" />
-    <Rule Id="CA2101" Action="Warning" />
-    <Rule Id="CA2108" Action="Warning" />
-    <Rule Id="CA2111" Action="Warning" />
-    <Rule Id="CA2112" Action="Warning" />
-    <Rule Id="CA2114" Action="Warning" />
-    <Rule Id="CA2116" Action="Warning" />
-    <Rule Id="CA2117" Action="Warning" />
-    <Rule Id="CA2122" Action="Warning" />
-    <Rule Id="CA2123" Action="Warning" />
-    <Rule Id="CA2124" Action="Warning" />
-    <Rule Id="CA2126" Action="Warning" />
-    <Rule Id="CA2131" Action="Warning" />
-    <Rule Id="CA2132" Action="Warning" />
-    <Rule Id="CA2133" Action="Warning" />
-    <Rule Id="CA2134" Action="Warning" />
-    <Rule Id="CA2137" Action="Warning" />
-    <Rule Id="CA2138" Action="Warning" />
-    <Rule Id="CA2140" Action="Warning" />
-    <Rule Id="CA2141" Action="Warning" />
-    <Rule Id="CA2146" Action="Warning" />
-    <Rule Id="CA2147" Action="Warning" />
-    <Rule Id="CA2149" Action="Warning" />
-    <Rule Id="CA2200" Action="Warning" />
-    <Rule Id="CA2202" Action="Warning" />
-    <Rule Id="CA2207" Action="Warning" />
-    <Rule Id="CA2212" Action="Warning" />
-    <Rule Id="CA2213" Action="Warning" />
-    <Rule Id="CA2214" Action="Warning" />
-    <Rule Id="CA2216" Action="Warning" />
-    <Rule Id="CA2220" Action="Warning" />
-    <Rule Id="CA2229" Action="Warning" />
-    <Rule Id="CA2231" Action="Warning" />
-    <Rule Id="CA2232" Action="Warning" />
-    <Rule Id="CA2235" Action="Warning" />
-    <Rule Id="CA2236" Action="Warning" />
-    <Rule Id="CA2237" Action="Warning" />
-    <Rule Id="CA2238" Action="Warning" />
-    <Rule Id="CA2240" Action="Warning" />
-    <Rule Id="CA2241" Action="Warning" />
-    <Rule Id="CA2242" Action="Warning" />
-  </Rules>
-</RuleSet>