• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ICSharpFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICSharpFile的典型用法代码示例。如果您正苦于以下问题:C# ICSharpFile类的具体用法?C# ICSharpFile怎么用?C# ICSharpFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICSharpFile类属于命名空间,在下文中一共展示了ICSharpFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateProcess

        /// <summary>
        /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document.
        /// </summary>
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind, ICSharpFile file)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            return new CloneDetectionDaemonStageProcess(process);
        }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:10,代码来源:CloneDetectionDaemonStage.cs


示例2: FileHeader

        /// <summary>
        /// Initializes a new instance of the <see cref="FileHeader"/> class.
        /// </summary>
        /// <param name="file">
        /// The file to load the header for. 
        /// </param>
        public FileHeader(ICSharpFile file)
        {
            try
            {
                this.File = file;

                string headerText = Utils.GetFileHeader(file);

                if (string.IsNullOrEmpty(headerText))
                {
                    // no header provided so we'll load the default one
                    headerText = StandardHeader;
                }

                this.LoadFileHeader(headerText);
            }
            catch (XmlException)
            {
                this.ResetToStandardHeader();
            }
            catch (ArgumentException)
            {
                this.headerXml = null;
            }

            this.InsertSummary = true;
        }
开发者ID:RainsSoft,项目名称:StyleCop,代码行数:33,代码来源:FileHeader.cs


示例3: GetClassDeclarations

 private IEnumerable<IClassDeclaration> GetClassDeclarations(ICSharpFile csharpFile)
 {
     var namespaceDeclarations = csharpFile.NamespaceDeclarations.SelectMany(x => x.DescendantsAndSelf(y => y.NamespaceDeclarations));
       var classDeclarations = namespaceDeclarations.Cast<ITypeDeclarationHolder>().SelectMany(x => x.TypeDeclarations)
       .SelectMany(x => x.DescendantsAndSelf(y => y.TypeDeclarations)).OfType<IClassDeclaration>();
       return classDeclarations;
 }
开发者ID:igor-toporet,项目名称:TestFx,代码行数:7,代码来源:FileAggregator.cs


示例4: DaemonStageProcess

 public DaemonStageProcess(IDaemonProcess process, SearchDomainFactory searchDomainFactory, ICSharpFile csFile)
 {
     this.searchDomainFactory = searchDomainFactory;
     this.csFile = csFile;
     DaemonProcess = process;
     usages = process.GetStageProcess<CollectUsagesStageProcess>();
     Assertion.Assert(usages != null, "usages != null");
 }
开发者ID:TestStack,项目名称:TestStack.BDDfy.ReSharper,代码行数:8,代码来源:DaemonStage.cs


示例5: ContextActionExecutorBase

        protected ContextActionExecutorBase(ICSharpStatement statement)
        {
            Contract.Requires(statement != null);

            _psiModule = statement.GetPsiModule();
            _psiServices = statement.GetPsiServices();
            _factory = CSharpElementFactory.GetInstance(statement);
            _currentFile = (ICSharpFile)statement.GetContainingFile();
        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:9,代码来源:ContextActionExecutorBase.cs


示例6: Execute

        /// <summary>
        /// Executes the specified options.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="file">The file.</param>
        public void Execute(ValueAnalysisOptions options, ICSharpFile file)
        {
            foreach (var namespaceDeclaration in file.NamespaceDeclarations)
              {
            this.ProcessCSharpTypeDeclarations(options, namespaceDeclaration.TypeDeclarations);
              }

              this.ProcessCSharpTypeDeclarations(options, file.TypeDeclarations);
        }
开发者ID:jamiebriant,项目名称:agentjohnson,代码行数:14,代码来源:ValueAnalysisRules.cs


示例7: CreateProcess

 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
     DaemonProcessKind processKind, ICSharpFile file)
 {
     if (processKind == DaemonProcessKind.VISIBLE_DOCUMENT &&
         settings.GetValue(HighlightingSettingsAccessor.ColorUsageHighlightingEnabled))
     {
         return new UnityColorHighlighterProcess(process, settings, file);
     }
     return null;
 }
开发者ID:JetBrains,项目名称:resharper-unity,代码行数:10,代码来源:UnityColorHighlighterProcess.cs


示例8: ExceptionalDaemonStageProcess

        public ExceptionalDaemonStageProcess(ICSharpFile file, IContextBoundSettingsStore settings)
            : base(ServiceLocator.Process, file)
        {
            _settings = settings;

            #if R2016_1 || R2016_2
            _consumer = new FilteringHighlightingConsumer(this, _settings, file);
            #else
            _consumer = new DefaultHighlightingConsumer(this, _settings);
            #endif
        }
开发者ID:CSharpAnalyzers,项目名称:ExceptionalReSharper,代码行数:11,代码来源:ExceptionalDaemonStageProcess.cs


示例9: CreateProcess

        protected override IDaemonStageProcess CreateProcess(
        IDaemonProcess process,
        IContextBoundSettingsStore settings,
        DaemonProcessKind processKind,
        ICSharpFile file)
        {
            var testFile = file.ToTestFile();
              if (testFile == null)
            return null;

              return new TestFileDaemonStageProcess(process, testFile, _testFileAnalyzers);
        }
开发者ID:igor-toporet,项目名称:TestFx,代码行数:12,代码来源:TestFileDaemonStage.cs


示例10: StyleCopStageProcess

        /// <summary>
        /// Initializes a new instance of the StyleCopStageProcess class, using the specified <see cref="IDaemonProcess"/> .
        /// </summary>
        /// <param name="lifetime">
        /// The <see cref="Lifetime"/> of the owning <see cref="IDaemonProcess"/>
        /// </param>
        /// <param name="apiPool">
        /// A reference to the StyleCop runner.
        /// </param>
        /// <param name="daemon">
        /// A reference to the <see cref="IDaemon"/> manager.
        /// </param>
        /// <param name="daemonProcess">
        /// <see cref="IDaemonProcess"/> to execute within. 
        /// </param>
        /// <param name="threading">
        /// A reference to the <see cref="IThreading"/> instance for timed actions.
        /// </param>
        /// <param name="file">
        /// The file to analyze.
        /// </param>
        public StyleCopStageProcess(Lifetime lifetime, StyleCopApiPool apiPool, IDaemon daemon, IDaemonProcess daemonProcess, IThreading threading, ICSharpFile file)
        {
            StyleCopTrace.In(daemonProcess, file);

            this.lifetime = lifetime;
            this.apiPool = apiPool;
            this.daemon = daemon;
            this.daemonProcess = daemonProcess;
            this.threading = threading;
            this.file = file;

            StyleCopTrace.Out();
        }
开发者ID:RainsSoft,项目名称:StyleCop,代码行数:34,代码来源:StyleCopStageProcess.cs


示例11: GetTestFile

        public ITestFile GetTestFile(ICSharpFile csharpFile)
        {
            var assemblyIdentity = new Identity(_project.GetOutputFilePath().FullPath);
              var classTests = TreeNodeEnumerable.Create(
              () =>
              {
            return GetClassDeclarations(csharpFile)
                .TakeWhile(_notInterrupted)
                .Select(x => GetClassTest(x, assemblyIdentity))
                .WhereNotNull();
              });

              return new TestFile(classTests, csharpFile);
        }
开发者ID:igor-toporet,项目名称:TestFx,代码行数:14,代码来源:FileAggregator.cs


示例12: CleanCodeDaemonStageProcess

        public CleanCodeDaemonStageProcess(IDaemonProcess daemonProcess, ICSharpFile file, IContextBoundSettingsStore settingsStore)
            : base(daemonProcess, file)
        {
            this.settingsStore = settingsStore;

            // Simple checks.
            methodTooLongCheck = new MethodTooLongCheck(settingsStore);
            classTooBigCheck = new ClassTooBigCheck(settingsStore);
            tooManyArgumentsCheck = new TooManyMethodArgumentsCheck(settingsStore);
            excessiveIndentationCheck = new ExcessiveIndentationCheck(settingsStore);
            tooManyDependenciesCheck = new TooManyDependenciesCheck(settingsStore);
            methodNamesNotMeaningfulCheck = new MethodNamesNotMeaningfulCheck(settingsStore);
            tooManyChainedReferencesCheck = new TooManyChainedReferencesCheck(settingsStore);
        }
开发者ID:DiomedesDominguez,项目名称:CleanCode,代码行数:14,代码来源:CleanCodeDaemonStageProcess.cs


示例13: CreateProcess

        /// <summary>
        /// Invoked by ReSharper each time it wants us to perform some background processing
        /// of a file.
        /// </summary>
        /// <param name="process">Provides information about and services relating to the
        /// work we are being asked to do.</param>
        /// <param name="settings">Settings information.</param>
        /// <param name="processKind">The kind of processing we're being asked to do.</param>
        /// <param name="file">The file to be processed.</param>
        /// <returns>A process object representing the work, or null if no work will be done.</returns>
        protected override IDaemonStageProcess CreateProcess(
            IDaemonProcess process,
            IContextBoundSettingsStore settings,
            DaemonProcessKind processKind,
            ICSharpFile file)
        {
            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            // StyleCop's daemon stage looks for a processKind of DaemonProcessKind.OTHER
            // and does nothing (returns null) if it sees it. This turns out to prevent
            // highlights from showing up when you ask ReSharper to inspect code issues
            // across the whole solution. I'm not sure why StyleCop deliberately opts out
            // of it. Perhaps something goes horribly wrong, but I've not seen any sign
            // of that yet, and we really do want solution-wide inspection to work.

            try
            {
                // I guess the base class checks that this is actually a C# file?
                if (!IsSupported(process.SourceFile))
                {
                    return null;
                }

                // StyleCop checks to see if there are already any errors in the file, and if
                // there are, it decides to do nothing.
                // TODO: Do we need to do that?

                // TODO: We should probably check for exemptions, e.g. generated source files.
            }
            catch (ProcessCancelledException)
            {
                return null;
            }

            // TODO: should we get an injected ISettingsOptimization?
            var orderUsingSettings =
                settings.GetKey<OrderUsingsSettings>(SettingsOptimization.DoMeSlowly);

            OrderUsingsConfiguration config = null;
            if (!string.IsNullOrWhiteSpace(orderUsingSettings.OrderSpecificationXml))
            {
                config = ConfigurationSerializer.FromXml(new StringReader(orderUsingSettings.OrderSpecificationXml));
            }

            return new OrderUsingsDaemonStageProcess(process, file, config);
        }
开发者ID:DiomedesDominguez,项目名称:order-usings,代码行数:59,代码来源:OrderUsingsDaemonStage.cs


示例14: AddContractClassExecutor

        public AddContractClassExecutor(ICSharpContextActionDataProvider provider, AddContractClassAvailability addContractForAvailability, 
            ICSharpFunctionDeclaration requiredFunction = null)
        {
            Contract.Requires(provider != null);
            Contract.Requires(addContractForAvailability != null);
            Contract.Requires(addContractForAvailability.IsAvailable);

            _addContractForAvailability = addContractForAvailability;
            _provider = provider;
            _requiredFunction = requiredFunction;

            _factory = _provider.ElementFactory;
            // TODO: look at this class CSharpStatementNavigator

            Contract.Assert(provider.SelectedElement != null);
            
            _currentFile = (ICSharpFile)provider.SelectedElement.GetContainingFile();
        }
开发者ID:constructor-igor,项目名称:ReSharperContractExtensions,代码行数:18,代码来源:AddContractClassExecutor.cs


示例15: AddContractForExecutor

        public AddContractForExecutor(AddContractForAvailability addContractForAvailability,
            ICSharpContextActionDataProvider provider)
        {
            Contract.Requires(addContractForAvailability != null);
            Contract.Requires(addContractForAvailability.IsAvailable);
            Contract.Requires(provider != null);

            _addContractForAvailability = addContractForAvailability;
            _provider = provider;

            _factory = CSharpElementFactory.GetInstance(provider.PsiModule);
            // TODO: look at this class CSharpStatementNavigator

            _classDeclaration = provider.GetSelectedElement<IClassLikeDeclaration>(true, true);

            Contract.Assert(provider.SelectedElement != null);
            _currentFile = (ICSharpFile)provider.SelectedElement.GetContainingFile();

        }
开发者ID:remyblok,项目名称:ReSharperContractExtensions,代码行数:19,代码来源:AddContractForExecutorOld.cs


示例16: EnsureNamespaceExists

        private static void EnsureNamespaceExists(ICSharpFile file, CSharpElementFactory factory)
        {
            var namespaceExists =
                file.NamespaceDeclarationNodes.Any(
                    n => n.Imports.Any(d => d.ImportedSymbolName.QualifiedName == AsObservableNamespace));

            if (!namespaceExists)
            {
                var directive = factory.CreateUsingDirective(AsObservableNamespace);

                var namespaceNode = file.NamespaceDeclarationNodes.FirstOrDefault();
                if (namespaceNode != null)
                {
                    UsingUtil.AddImportTo(namespaceNode, directive);
                }
                else
                {
                    UsingUtil.AddImportTo(file, directive);
                }
            }
        }
开发者ID:oriches,项目名称:Resharper.ReactivePlugin,代码行数:21,代码来源:AsObservableBulbItem.cs


示例17: InsertCopyrightText

        /// <summary>
        /// Inserts copyright text into the file's header.
        /// </summary>
        /// <param name="file">
        /// The file to insert the company name into.
        /// </param>
        public void InsertCopyrightText(ICSharpFile file)
        {
            DocumentationRulesConfiguration docConfig = this.GetDocumentationRulesConfig(file);

            FileHeader fileHeader = new FileHeader(file) { CopyrightText = docConfig.Copyright };

            fileHeader.Update();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:14,代码来源:DocumentationRules.cs


示例18: Execute

        /// <summary>
        /// Implement the Execute method.
        /// </summary>
        /// <param name="options">
        /// The options.
        /// </param>
        /// <param name="file">
        /// The file to use.
        /// </param>
        public void Execute(SpacingOptions options, ICSharpFile file)
        {
            StyleCopTrace.In(options, file);

            Param.RequireNotNull(options, "options");
            Param.RequireNotNull(file, "file");

            bool commasMustBeSpacedCorrectly = options.SA1001CommasMustBeSpacedCorrectly;
            bool singleLineCommentsMustBeginWithSingleSpace = options.SA1005SingleLineCommentsMustBeginWithSingleSpace;
            bool preprocessorKeywordsMustNotBePrecededBySpace = options.SA1006PreprocessorKeywordsMustNotBePrecededBySpace;
            bool negativeSignsMustBeSpacedCorrectly = options.SA1021NegativeSignsMustBeSpacedCorrectly;
            bool positiveSignsMustBeSpacedCorrectly = options.SA1022PositiveSignsMustBeSpacedCorrectly;
            bool codeMustNotContainMultipleWhitespaceInARow = options.SA1025CodeMustNotContainMultipleWhitespaceInARow;

            if (codeMustNotContainMultipleWhitespaceInARow)
            {
                this.CodeMustNotContainMultipleWhitespaceInARow(file.FirstChild);
            }

            if (commasMustBeSpacedCorrectly)
            {
                this.CommasMustBeSpacedCorrectly(file.FirstChild);
            }

            if (singleLineCommentsMustBeginWithSingleSpace)
            {
                this.SingleLineCommentsMustBeginWithSingleSpace(file.FirstChild);
            }

            if (preprocessorKeywordsMustNotBePrecededBySpace)
            {
                this.PreprocessorKeywordsMustNotBePrecededBySpace(file.FirstChild);
            }

            if (negativeSignsMustBeSpacedCorrectly)
            {
                this.NegativeAndPositiveSignsMustBeSpacedCorrectly(file.FirstChild, CSharpTokenType.MINUS);
            }

            if (positiveSignsMustBeSpacedCorrectly)
            {
                this.NegativeAndPositiveSignsMustBeSpacedCorrectly(file.FirstChild, CSharpTokenType.PLUS);
            }

            StyleCopTrace.Out();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:55,代码来源:SpacingRules.cs


示例19: InsertCompanyName

        /// <summary>
        /// Inserts the company name into the file's header.
        /// </summary>
        /// <param name="file">
        /// The file to insert the company name into.
        /// </param>
        public void InsertCompanyName(ICSharpFile file)
        {
            DocumentationRulesConfiguration docConfig = this.GetDocumentationRulesConfig(file);

            FileHeader fileHeader = new FileHeader(file) { CompanyName = docConfig.CompanyName };

            fileHeader.Update();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:14,代码来源:DocumentationRules.cs


示例20: Execute

        /// <summary>
        /// Executes the cleanup rules.
        /// </summary>
        /// <param name="options">
        /// The options.
        /// </param>
        /// <param name="file">
        /// The file to process.
        /// </param>
        public void Execute(ReadabilityOptions options, ICSharpFile file)
        {
            StyleCopTrace.In(options, file);
            bool dontPrefixCallsWithBaseUnlessLocalImplementationExists = options.SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists;
            bool codeMustNotContainEmptyStatements = options.SA1106CodeMustNotContainEmptyStatements;
            bool blockStatementsMustNotContainEmbeddedComments = options.SA1108BlockStatementsMustNotContainEmbeddedComments;
            bool blockStatementsMustNotContainEmbeddedRegions = options.SA1109BlockStatementsMustNotContainEmbeddedRegions;
            bool commentsMustContainText = options.SA1120CommentsMustContainText;
            bool useBuiltInTypeAlias = options.SA1121UseBuiltInTypeAlias;
            bool useStringEmptyForEmptyStrings = options.SA1122UseStringEmptyForEmptyStrings;
            bool dontPlaceRegionsWithinElements = options.SA1123DoNotPlaceRegionsWithinElements;
            bool codeMustNotContainEmptyRegions = options.SA1124CodeMustNotContainEmptyRegions;

            if (dontPlaceRegionsWithinElements)
            {
                this.DoNotPlaceRegionsWithinElements(file.FirstChild);
            }

            if (blockStatementsMustNotContainEmbeddedComments)
            {
                this.BlockStatementsMustNotContainEmbeddedComments(file.FirstChild);
            }

            if (blockStatementsMustNotContainEmbeddedRegions)
            {
                this.BlockStatementsMustNotContainEmbeddedRegions(file.FirstChild);
            }

            if (codeMustNotContainEmptyStatements)
            {
                this.CodeMustNotContainEmptyStatements(file.FirstChild);
            }

            if (codeMustNotContainEmptyRegions)
            {
                this.CodeMustNotContainEmptyRegions(file.FirstChild);
            }

            if (useStringEmptyForEmptyStrings)
            {
                ReplaceEmptyStringsWithStringDotEmpty(file.FirstChild);
            }

            if (useBuiltInTypeAlias)
            {
                SwapToBuiltInTypeAlias(file.FirstChild);
            }

            if (commentsMustContainText)
            {
                RemoveEmptyComments(file.FirstChild);
            }

            if (dontPrefixCallsWithBaseUnlessLocalImplementationExists)
            {
                this.DoNotPrefixCallsWithBaseUnlessLocalImplementationExists(file.FirstChild);
            }

            StyleCopTrace.Out();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:69,代码来源:ReadabilityRules.cs



注:本文中的ICSharpFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICache类代码示例发布时间:2022-05-24
下一篇:
C# ICSharpContextActionDataProvider类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap