예제 #1
0
 /// <summary>
 /// Create a new <see cref="DirectorySource"/> instance to browse and resolve resources
 /// from the specified <paramref name="contentDirectory"/>
 /// and using the default <see cref="DirectorySourceSettings"/>.
 /// </summary>
 /// <para>
 /// Initialization is thread-safe. The source ensures that only a single thread will
 /// collect the artifact summaries, while any other threads will block.
 /// </para>
 /// <param name="contentDirectory">The file path of the target directory.</param>
 /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
 public DirectorySource(string contentDirectory)
 {
     ContentDirectory  = contentDirectory ?? throw Error.ArgumentNull(nameof(contentDirectory));
     _settings         = new DirectorySourceSettings();
     _summaryGenerator = new ArtifactSummaryGenerator(_settings.ExcludeSummariesForUnknownArtifacts);
     // Initialize Lazy
     Refresh();
 }
예제 #2
0
 /// <summary>Clone constructor. Generates a new <see cref="DirectorySourceSettings"/> instance initialized from the state of the specified instance.</summary>
 /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
 public DirectorySourceSettings(DirectorySourceSettings settings)
 {
     if (settings == null)
     {
         throw Error.ArgumentNull(nameof(settings));
     }
     settings.CopyTo(this);
 }
예제 #3
0
 /// <summary>
 /// Create a new <see cref="DirectorySource"/> instance to browse and resolve resources
 /// from the specified <paramref name="contentDirectory"/>
 /// and using the specified <see cref="DirectorySourceSettings"/>.
 /// <para>
 /// Initialization is thread-safe. The source ensures that only a single thread will
 /// collect the artifact summaries, while any other threads will block.
 /// </para>
 /// </summary>
 /// <param name="contentDirectory">The file path of the target directory.</param>
 /// <param name="settings">Configuration settings that control the behavior of the <see cref="DirectorySource"/>.</param>
 /// <exception cref="ArgumentNullException">One of the specified arguments is <c>null</c>.</exception>
 public DirectorySource(string contentDirectory, DirectorySourceSettings settings)
 {
     ContentDirectory = contentDirectory ?? throw Error.ArgumentNull(nameof(contentDirectory));
     // [WMR 20171023] Always copy the specified settings, to prevent shared state
     _settings         = new DirectorySourceSettings(settings);
     _summaryGenerator = new ArtifactSummaryGenerator(_settings.ExcludeSummariesForUnknownArtifacts);
     // Initialize Lazy
     Refresh();
 }
 /// <summary>Copy all configuration settings to another instance.</summary>
 /// <param name="other">Another <see cref="DirectorySourceSettings"/> instance.</param>
 /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
 public void CopyTo(DirectorySourceSettings other)
 {
     if (other == null)
     {
         throw Error.ArgumentNull(nameof(other));
     }
     other.IncludeSubDirectories = this.IncludeSubDirectories;
     other.Masks                    = this.Masks;
     other.Includes                 = this.Includes;
     other.Excludes                 = this.Excludes;
     other.FormatPreference         = this.FormatPreference;
     other.SingleThreaded           = this.SingleThreaded;
     other.SummaryDetailsHarvesters = this.SummaryDetailsHarvesters;
 }
예제 #5
0
 // Internal ctor
 DirectorySource(string contentDirectory, DirectorySourceSettings settings, bool cloneSettings)
 {
     ContentDirectory = contentDirectory ?? throw Error.ArgumentNull(nameof(contentDirectory));
     // [WMR 20171023] Clone specified settings to prevent shared state
     _settings = settings != null
         ? (cloneSettings ? new DirectorySourceSettings(settings) : settings)
         : DirectorySourceSettings.CreateDefault();
     _summaryGenerator = new ArtifactSummaryGenerator(_settings.ExcludeSummariesForUnknownArtifacts);
     _navigatorFactory = new ConfigurableNavigatorStreamFactory(_settings.XmlParserSettings, _settings.JsonParserSettings)
     {
         ThrowOnUnsupportedFormat = false
     };
     // Initialize Lazy
     Refresh();
 }
예제 #6
0
 /// <summary>Create a new <see cref="ZipSource"/> instance for the ZIP archive with the specified file path.</summary>
 /// <param name="zipPath">File path to a ZIP archive.</param>
 /// <param name="settings">Configuration settings for the internal <see cref="DirectorySource"/> instance.</param>
 public ZipSource(string zipPath, DirectorySourceSettings settings)
 {
     if (string.IsNullOrEmpty(zipPath))
     {
         throw Error.ArgumentNull(nameof(zipPath));
     }
     ZipPath = zipPath;
     if (settings == null)
     {
         throw Error.ArgumentNull(nameof(settings));
     }
     // Always clone the incoming reference, especially since we're forcing IncludeSubDirectories
     _settings   = settings.Clone();
     _lazySource = new Lazy <DirectorySource>(createSource);
 }
예제 #7
0
        /// <summary>Copy all configuration settings to another instance.</summary>
        /// <param name="other">Another <see cref="DirectorySourceSettings"/> instance.</param>
        /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
        public void CopyTo(DirectorySourceSettings other)
        {
            if (other == null)
            {
                throw Error.ArgumentNull(nameof(other));
            }

            // [WMR 20181025] Clone state
            other.IncludeSubDirectories = this.IncludeSubDirectories;
            other.Masks                               = (string[])this.Masks.Clone();
            other.Includes                            = (string[])this.Includes?.Clone();
            other.Excludes                            = (string[])this.Excludes?.Clone();
            other.FormatPreference                    = this.FormatPreference;
            other.MultiThreaded                       = this.MultiThreaded;
            other.SummaryDetailsHarvesters            = (ArtifactSummaryHarvester[])this.SummaryDetailsHarvesters?.Clone();
            other.ExcludeSummariesForUnknownArtifacts = this.ExcludeSummariesForUnknownArtifacts;
            other.ParserSettings                      = new ParserSettings(this.ParserSettings);
            other.XmlParserSettings                   = new FhirXmlParsingSettings(this.XmlParserSettings);
            other.JsonParserSettings                  = new FhirJsonParsingSettings(this.JsonParserSettings);
        }
예제 #8
0
 /// <summary>
 /// Create a new <see cref="DirectorySource"/> instance to browse and resolve resources
 /// from the specified <paramref name="contentDirectory"/>
 /// and using the specified <see cref="DirectorySourceSettings"/>.
 /// <para>
 /// Initialization is thread-safe. The source ensures that only a single thread will
 /// collect the artifact summaries, while any other threads will block.
 /// </para>
 /// </summary>
 /// <param name="contentDirectory">The file path of the target directory.</param>
 /// <param name="settings">Configuration settings that control the behavior of the <see cref="DirectorySource"/>.</param>
 /// <exception cref="ArgumentNullException">One of the specified arguments is <c>null</c>.</exception>
 public DirectorySource(string contentDirectory, DirectorySourceSettings settings)
     : this(contentDirectory, settings, true)
 {
 }
예제 #9
0
 /// <summary>
 /// Create a new <see cref="DirectorySource"/> instance to browse and resolve resources
 /// using the specified <see cref="DirectorySourceSettings"/>.
 /// </summary>
 /// <param name="settings">Configuration settings that control the behavior of the <see cref="DirectorySource"/>.</param>
 /// <exception cref="ArgumentNullException">One of the specified arguments is <c>null</c>.</exception>
 public DirectorySource(DirectorySourceSettings settings)
     : this(SpecificationDirectory, settings, true)
 {
 }
예제 #10
0
 /// <summary>Create a new <see cref="ZipSource"/> instance for the ZIP archive with the specified file path.</summary>
 /// <param name="zipPath">File path to a ZIP archive.</param>
 public ZipSource(string zipPath) : this(zipPath, DirectorySourceSettings.CreateDefault())
 {
 }
예제 #11
0
 /// <summary>
 /// Create a new <see cref="DirectorySource"/> instance to browse and resolve resources
 /// from the specified content directory and using the specified <see cref="DirectorySourceSettings"/>.
 /// </summary>
 /// <param name="contentDirectory">The file path of the target directory.</param>
 /// <param name="settings">Configuration settings that control the behavior of the <see cref="DirectorySource"/>.</param>
 /// <exception cref="ArgumentNullException">One of the specified arguments is <c>null</c>.</exception>
 public DirectorySource(string contentDirectory, DirectorySourceSettings settings)
 {
     _contentDirectory = contentDirectory ?? throw Error.ArgumentNull(nameof(contentDirectory));
     // [WMR 20171023] Always copy the specified settings, to prevent shared state
     _settings = new DirectorySourceSettings(settings);
 }
예제 #12
0
 /// <summary>
 /// Create a new <see cref="DirectorySource"/> instance to browse and resolve resources
 /// from the specified content directory and using the default <see cref="DirectorySourceSettings"/>.
 /// </summary>
 /// <param name="contentDirectory">The file path of the target directory.</param>
 /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
 public DirectorySource(string contentDirectory)
 {
     _contentDirectory = contentDirectory ?? throw Error.ArgumentNull(nameof(contentDirectory));
     _settings         = new DirectorySourceSettings();
 }