private MetadataDocumentSaver(string directoryPath, IEnumerable <MetadataSection> documents, MetadataFileNamingConvention namingConvention) { this.DirectoryPath = directoryPath ?? throw new ArgumentNullException(nameof(directoryPath)); this.MetadataFiles = new List <MetadataFileInfo>(); this.NamingConvention = namingConvention; this.FileNameMgr = new MetadataFileNameManager(); this.UnresolvedReferences = new List <UnresolvedUri>(); AddMetadataFiles(documents); }
public static async Task <SaveResult> SaveMetadataAsync(string directoryPath, IEnumerable <MetadataSection> documents, MetadataFileNamingConvention namingConvention, bool overwrite, CancellationToken cancellationToken) { var metadataDocumentSaver = new MetadataDocumentSaver(directoryPath, documents, namingConvention); var mainWsdl = await AsyncHelper.RunAsync(() => metadataDocumentSaver.SaveMetadata(overwrite), cancellationToken).ConfigureAwait(false); return(new SaveResult { WsdlFilePath = mainWsdl?.FilePath, MetadataFiles = metadataDocumentSaver.MetadataFiles.Select(mf => mf.FilePath), DocumentSaveErrors = metadataDocumentSaver.UnresolvedReferences.Distinct().OrderBy(ur => ur.Uri).Select(ur => string.Format(CultureInfo.CurrentCulture, MetadataResources.ErrUnableToResolveSchemaReferenceFormat, ur.Uri)) }); }
public async Task <MetadataDocumentSaver.SaveResult> SaveMetadataAsync(string directoryPath, MetadataFileNamingConvention fileNamingConvention, bool overwrite, CancellationToken cancellationToken) { await ImportMetadataAsync(cancellationToken).ConfigureAwait(false); return(await MetadataDocumentSaver.SaveMetadataAsync(directoryPath, this.metadataDocumentLoader.MetadataSections, fileNamingConvention, overwrite, cancellationToken).ConfigureAwait(false)); }