示例#1
0
            async Task <ProjectCacheInfo> LoadProjectCacheInfo(
                MonoDevelop.Projects.Project p,
                DotNetProjectConfiguration config,
                string framework,
                CancellationToken token)
            {
                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                var(references, projectReferences) = await metadataHandler.Value.CreateReferences(p, framework, token).ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                var configSelector = config?.Selector;

                if (p is MonoDevelop.Projects.DotNetProject && configSelector != null && !string.IsNullOrEmpty(framework))
                {
                    configSelector = new MonoDevelop.Projects.DotNetProjectFrameworkConfigurationSelector(config.Selector, framework);
                }

                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                var sourceFiles = await p.GetSourceFilesAsync(configSelector).ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                var editorConfigFiles = await p.GetEditorConfigFilesAsync(configSelector).ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                var additionalFiles = await p.GetAdditionalFilesAsync(configSelector).ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                var analyzerFiles = await p.GetAnalyzerFilesAsync(configSelector).ConfigureAwait(false);

                return(new ProjectCacheInfo {
                    AdditionalFiles = additionalFiles,
                    AnalyzerFiles = analyzerFiles,
                    EditorConfigFiles = editorConfigFiles,
                    SourceFiles = sourceFiles,
                    ProjectReferences = projectReferences,
                    References = references
                });
            }