Ejemplo n.º 1
0
        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))
            });
        }
Ejemplo n.º 2
0
        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));
        }