本文整理汇总了C#中ICSharpFile类的典型用法代码示例。如果您正苦于以下问题:C# ICSharpFile类的具体用法?C# ICSharpFile怎么用?C# ICSharpFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICSharpFile类属于命名空间,在下文中一共展示了ICSharpFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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");
}
示例5: ContextActionExecutorBase
protected ContextActionExecutorBase(ICSharpStatement statement)
{
Contract.Requires(statement != null);
_psiModule = statement.GetPsiModule();
_psiServices = statement.GetPsiServices();
_factory = CSharpElementFactory.GetInstance(statement);
_currentFile = (ICSharpFile)statement.GetContainingFile();
}
示例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);
}
示例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;
}
示例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
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}