Exemplo n.º 1
0
        public CodeModel CreatePreprocessedModel(ProbeAppSettings appSettings, string fileName, VsText.ITextSnapshot snapshot, bool visible, string reason)
        {
            CodeSource source;
            IEnumerable <Preprocessor.IncludeDependency> includeDependencies = null;

            if (visible)
            {
                source = new CodeSource();
                source.Append(snapshot.GetText(), fileName, 0, snapshot.Length, true, true, false);
                source.Flush();
            }
            else
            {
                var merger = new FileMerger();
                merger.MergeFile(appSettings, fileName, snapshot.GetText(), false, true);
                source = merger.MergedContent;

                includeDependencies = (from f in merger.FileNames
                                       select new Preprocessor.IncludeDependency(f, false, true, merger.GetFileContent(f))).ToArray();
            }

            var model = CreatePreprocessedModel(appSettings, source, fileName, visible, reason, includeDependencies);

            model.Snapshot = snapshot;
            return(model);
        }
Exemplo n.º 2
0
        public CodeModel CreatePreprocessedModel(ProbeAppSettings appSettings, string fileName, VsText.ITextSnapshot snapshot, string reason)
        {
            var source = new CodeSource();

            source.Append(snapshot.GetText(), fileName, 0, snapshot.Length, true, true, false);
            source.Flush();

            var model = CreatePreprocessedModel(appSettings, source, fileName, true, reason, null);

            model.Snapshot = snapshot;
            return(model);
        }