diff --git a/Directory.csproj.props b/Directory.csproj.props index 046a2a4..83379d8 100644 --- a/Directory.csproj.props +++ b/Directory.csproj.props @@ -7,6 +7,7 @@ enable true false + true diff --git a/OpenMcdf/RootStorage.cs b/OpenMcdf/RootStorage.cs index 3b51d7c..64b9e6e 100644 --- a/OpenMcdf/RootStorage.cs +++ b/OpenMcdf/RootStorage.cs @@ -5,6 +5,7 @@ namespace OpenMcdf; /// /// Represents the major version of the compound file. /// +[SuppressMessage("Design", "CA1028:Enum Storage should be Int32", Justification = "Compound file versions are defined as ushort.")] public enum Version : ushort { /// diff --git a/OpenMcdf/Storage.cs b/OpenMcdf/Storage.cs index a8a5a82..1af19e5 100644 --- a/OpenMcdf/Storage.cs +++ b/OpenMcdf/Storage.cs @@ -295,18 +295,23 @@ public void CopyTo(Storage destination) foreach (DirectoryEntry entry in EnumerateDirectoryEntries()) { - if (entry.Type is StorageType.Storage) - { - Storage subSource = new(ContextSite, entry, this); - Storage subDestination = destination.CreateStorage(entry.NameString); - subSource.CopyTo(subDestination); - } - else if (entry.Type is StorageType.Stream) - { - using CfbStream stream = new(ContextSite, entry, this); - using CfbStream destinationStream = destination.CreateStream(entry.NameString); - stream.CopyTo(destinationStream); - } + Copy(entry, destination); + } + } + + private void Copy(DirectoryEntry entry, Storage destination) + { + if (entry.Type is StorageType.Storage) + { + Storage subSource = new(ContextSite, entry, this); + Storage subDestination = destination.CreateStorage(entry.NameString); + subSource.CopyTo(subDestination); + } + else if (entry.Type is StorageType.Stream) + { + using CfbStream stream = new(ContextSite, entry, this); + using CfbStream destinationStream = destination.CreateStream(entry.NameString); + stream.CopyTo(destinationStream); } } diff --git a/OpenMcdf/System/.editorconfig b/OpenMcdf/System/.editorconfig index e4aabe9..7d13f7f 100644 --- a/OpenMcdf/System/.editorconfig +++ b/OpenMcdf/System/.editorconfig @@ -1,2 +1,4 @@ [*.cs] -dotnet_analyzer_diagnostic.severity = none \ No newline at end of file +dotnet_analyzer_diagnostic.severity = none + +dotnet_diagnostic.CA1019.severity = none diff --git a/OpenMcdf/System/CompilerServices.cs b/OpenMcdf/System/IsExternalInit.cs similarity index 100% rename from OpenMcdf/System/CompilerServices.cs rename to OpenMcdf/System/IsExternalInit.cs diff --git a/OpenMcdf/TransactedStream.cs b/OpenMcdf/TransactedStream.cs index de28bd8..f423f37 100644 --- a/OpenMcdf/TransactedStream.cs +++ b/OpenMcdf/TransactedStream.cs @@ -8,6 +8,7 @@ namespace OpenMcdf; internal sealed class TransactedStream : Stream { readonly RootContextSite rootContextSite; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Non-dispose ownership")] readonly Stream originalStream; readonly Dictionary dirtySectorPositions = new(); readonly byte[] buffer;