From a4c7643523a3fc79c2a79292d22487196ea388fb Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 19 Apr 2021 16:09:46 -0700 Subject: Prefer IReadOnlyCollection<> or IReadOnlyList<> over IEnumerable<> Part of wixtoolset/issues#6422 --- src/WixToolset.Extensibility/Data/IBindContext.cs | 12 ++++---- src/WixToolset.Extensibility/Data/IBindResult.cs | 17 ++++++++-- .../Data/ICompileContext.cs | 2 +- .../Data/IDecompileContext.cs | 2 +- .../Data/IDecompileResult.cs | 2 +- .../Data/ILayoutContext.cs | 6 ++-- .../Data/ILibraryContext.cs | 36 +++++++++++++++++++--- src/WixToolset.Extensibility/Data/ILinkContext.cs | 31 ++++++++++++++++--- .../Data/IPreprocessContext.cs | 29 +++++++++++++++-- .../Data/IPreprocessResult.cs | 12 ++++++-- .../Data/IResolveContext.cs | 10 +++--- .../Data/IResolveFileResult.cs | 12 ++++++-- .../Data/IResolveResult.cs | 4 +-- 13 files changed, 137 insertions(+), 38 deletions(-) (limited to 'src/WixToolset.Extensibility/Data') diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs index f1977c01..d0c65683 100644 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs @@ -35,27 +35,27 @@ namespace WixToolset.Extensibility.Data /// /// Delayed fields that need to be resolved again. /// - IEnumerable DelayedFields { get; set; } + IReadOnlyCollection DelayedFields { get; set; } /// /// Embedded files to extract. /// - IEnumerable ExpectedEmbeddedFiles { get; set; } + IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } /// /// Binder extensions. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// File system extensions. /// - IEnumerable FileSystemExtensions { get; set; } + IReadOnlyCollection FileSystemExtensions { get; set; } /// /// Set of ICEs to execute. /// - IEnumerable Ices { get; set; } + IReadOnlyCollection Ices { get; set; } /// /// Intermedaite folder. @@ -100,7 +100,7 @@ namespace WixToolset.Extensibility.Data /// /// Set of ICEs to skip. /// - IEnumerable SuppressIces { get; set; } + IReadOnlyCollection SuppressIces { get; set; } /// /// Skip all ICEs. diff --git a/src/WixToolset.Extensibility/Data/IBindResult.cs b/src/WixToolset.Extensibility/Data/IBindResult.cs index 1654f24d..7fc52bd7 100644 --- a/src/WixToolset.Extensibility/Data/IBindResult.cs +++ b/src/WixToolset.Extensibility/Data/IBindResult.cs @@ -6,13 +6,24 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of bind operation. + /// public interface IBindResult : IDisposable { - IEnumerable FileTransfers { get; set; } + /// + /// Collection of file transfers to complete. + /// + IReadOnlyCollection FileTransfers { get; set; } - IEnumerable TrackedFiles { get; set; } + /// + /// Collection of files tracked during binding. + /// + IReadOnlyCollection TrackedFiles { get; set; } + /// + /// Ouput of binding. + /// WixOutput Wixout { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs index a86fee1a..2ee8f2a1 100644 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs @@ -26,7 +26,7 @@ namespace WixToolset.Extensibility.Data /// /// Set of extensions provided to the compiler. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs index 63ed27d5..fe7d0465 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs @@ -16,7 +16,7 @@ namespace WixToolset.Extensibility.Data OutputType DecompileType { get; set; } - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } string ExtractFolder { get; set; } diff --git a/src/WixToolset.Extensibility/Data/IDecompileResult.cs b/src/WixToolset.Extensibility/Data/IDecompileResult.cs index ad4d0841..cffd0976 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileResult.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileResult.cs @@ -11,7 +11,7 @@ namespace WixToolset.Extensibility.Data { XDocument Document { get; set; } - IEnumerable ExtractedFilePaths { get; set; } + IReadOnlyCollection ExtractedFilePaths { get; set; } Platform? Platform { get; set; } } diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 3d49b877..b11b4d13 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs @@ -19,17 +19,17 @@ namespace WixToolset.Extensibility.Data /// /// Extensions for use during layout. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// Set of tracked of files created during processing to be cleaned up. /// - IEnumerable TrackedFiles { get; set; } + IReadOnlyCollection TrackedFiles { get; set; } /// /// Set of files to transfer. /// - IEnumerable FileTransfers { get; set; } + IReadOnlyCollection FileTransfers { get; set; } /// /// File to capture list of content files. diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs index d6359ffc..208b6f73 100644 --- a/src/WixToolset.Extensibility/Data/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/Data/ILibraryContext.cs @@ -7,23 +7,49 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context provided during library creation operations. + /// public interface ILibraryContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } + /// + /// Indicates whether files should be bound into the library. + /// bool BindFiles { get; set; } - IEnumerable BindPaths { get; set; } + /// + /// Collection of bindpaths used to bind files. + /// + IReadOnlyCollection BindPaths { get; set; } - IEnumerable Extensions { get; set; } + /// + /// Collection of extensions used during creation of library. + /// + IReadOnlyCollection Extensions { get; set; } + /// + /// Identifier of the library. + /// string LibraryId { get; set; } - IEnumerable Localizations { get; set; } + /// + /// Collection of localization files to use in the library. + /// + IReadOnlyCollection Localizations { get; set; } - IEnumerable Intermediates { get; set; } + /// + /// Collection of intermediates to include in the library. + /// + IReadOnlyCollection Intermediates { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs index 7524d18c..d56866f7 100644 --- a/src/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Data/ILinkContext.cs @@ -7,21 +7,44 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Context provided during linking. + /// public interface ILinkContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } - IEnumerable Extensions { get; set; } + /// + /// Collection of extensions to use during linking. + /// + IReadOnlyCollection Extensions { get; set; } - IEnumerable ExtensionData { get; set; } + /// + /// Collection of extension data to use during linking. + /// + IReadOnlyCollection ExtensionData { get; set; } + /// + /// Expected output type. + /// OutputType ExpectedOutputType { get; set; } - IEnumerable Intermediates { get; set; } + /// + /// Collection of intermediates to link. + /// + IReadOnlyCollection Intermediates { get; set; } + /// + /// Symbol definition creator used to load extension data. + /// ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs index c6bdfe3a..69057c33 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs @@ -7,14 +7,25 @@ namespace WixToolset.Extensibility.Data using System.Threading; using WixToolset.Data; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Preprocessor context. + /// public interface IPreprocessContext { + /// + /// Service provider. + /// IServiceProvider ServiceProvider { get; } - IEnumerable Extensions { get; set; } + /// + /// Collection of extensions to use during preprocessing. + /// + IReadOnlyCollection Extensions { get; set; } - IEnumerable IncludeSearchPaths { get; set; } + /// + /// Collection of search paths to find include files. + /// + IReadOnlyCollection IncludeSearchPaths { get; set; } /// /// Gets the platform which the compiler will use when defaulting 64-bit attributes and elements. @@ -22,12 +33,24 @@ namespace WixToolset.Extensibility.Data /// The platform which the compiler will use when defaulting 64-bit attributes and elements. Platform Platform { get; set; } + /// + /// Path to the source file being preprocessed. + /// string SourcePath { get; set; } + /// + /// Collection of name/value pairs used as preprocessor variables. + /// IDictionary Variables { get; set; } + /// + /// Current source line number of the preprocessor. + /// SourceLineNumber CurrentSourceLineNumber { get; set; } + /// + /// Cancellation token. + /// CancellationToken CancellationToken { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs index d46c8147..af224c1e 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessResult.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessResult.cs @@ -5,11 +5,19 @@ namespace WixToolset.Extensibility.Data using System.Collections.Generic; using System.Xml.Linq; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of preprocessing. + /// public interface IPreprocessResult { + /// + /// Document result of preprocessor. + /// XDocument Document { get; set; } - IEnumerable IncludedFiles { get; set; } + /// + /// Collection of files included during preprocessing. + /// + IReadOnlyCollection IncludedFiles { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs index 6ab5b545..63159ccb 100644 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs @@ -20,22 +20,22 @@ namespace WixToolset.Extensibility.Data /// /// Bind paths used during resolution. /// - IEnumerable BindPaths { get; set; } + IReadOnlyCollection BindPaths { get; set; } /// /// Resolve extensions. /// - IEnumerable Extensions { get; set; } + IReadOnlyCollection Extensions { get; set; } /// /// Extension data. /// - IEnumerable ExtensionData { get; set; } + IReadOnlyCollection ExtensionData { get; set; } /// /// List of cultures to filter the localizations. /// - IEnumerable FilterCultures { get; set; } + IReadOnlyCollection FilterCultures { get; set; } /// /// Intermediate folder. @@ -50,7 +50,7 @@ namespace WixToolset.Extensibility.Data /// /// Localizations used to resolve. /// - IEnumerable Localizations { get; set; } + IReadOnlyCollection Localizations { get; set; } /// /// Indicates whether to allow localization and bind variables to remain unresolved. diff --git a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs index c8dca81a..2f0df96c 100644 --- a/src/WixToolset.Extensibility/Data/IResolveFileResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveFileResult.cs @@ -4,11 +4,19 @@ namespace WixToolset.Extensibility.Data { using System.Collections.Generic; -#pragma warning disable 1591 // TODO: add documentation + /// + /// Result of resolving a file. + /// public interface IResolveFileResult { - IEnumerable CheckedPaths { get; set; } + /// + /// Collection of paths checked to find file. + /// + IReadOnlyCollection CheckedPaths { get; set; } + /// + /// Path to found file, if found. + /// string Path { get; set; } } } diff --git a/src/WixToolset.Extensibility/Data/IResolveResult.cs b/src/WixToolset.Extensibility/Data/IResolveResult.cs index abffb415..0c5e0ccf 100644 --- a/src/WixToolset.Extensibility/Data/IResolveResult.cs +++ b/src/WixToolset.Extensibility/Data/IResolveResult.cs @@ -28,12 +28,12 @@ namespace WixToolset.Extensibility.Data /// /// Fields still requiring resolution. /// - IEnumerable DelayedFields { get; set; } + IReadOnlyCollection DelayedFields { get; set; } /// /// Files to extract from embedded .wixlibs. /// - IEnumerable ExpectedEmbeddedFiles { get; set; } + IReadOnlyCollection ExpectedEmbeddedFiles { get; set; } /// /// Resolved intermediate. -- cgit v1.2.3-55-g6feb