private void CheckOutput(IProjectFile projectFile, Encoding encoding) { Assert.IsNotNull(projectFile, "projectFile == null"); this.ExecuteWithGold( projectFile.Location.Name, sw => { using (var sr = new StreamReader(projectFile.Location.OpenFileForReadingExclusive(), encoding, true)) { var lexer = this.CreateLexer(projectFile, sr); int position = 0; lexer.Start(); while (lexer.TokenType != null) { Assert.AreEqual( lexer.TokenStart, position, "Token start error. Expected: {0}, actual: {1}", position, lexer.TokenStart); position = lexer.TokenEnd; this.WriteToken(sw, lexer); lexer.Advance(); } Assert.AreEqual(lexer.Buffer.Length, position, "position == lexer.Buffer.Length"); } }); }
//private readonly IWordIndexLanguageProvider m_WordIndexLanguageProvider = new XmlWordIndexLanguageProvider(); public ProjectFileType GetProjectFileType(IProjectFile file) { //Logger.LogMessage("MappingFileProjectFileLanguageService.GetProjectFileType for file {0}", file.Name); if (file.Name.EndsWith(Constants.MappingFileExtension)) { return MAPPING_FILE; } return ProjectFileType.UNKNOWN; }
public IEnumerable<JetTuple<IProjectFile, string>> GetRelatedFiles(IProjectFile projectFile) { return new List<JetTuple<IProjectFile, string>>(); // IDeclarationsCache dc = CacheManager.GetInstance(_provider.Solution).GetDeclarationsCache( //_provider.PsiModule, true, true); // var inheritors = dc.GetPossibleInheritors("BuisnessObjectBuilder").Select(type => type.GetAttributeInstances()); // var shortNames = dc.GetAllShortNames(); // foreach (var file in projectFile.EnumeratePsiFiles().OfType<ICSharpFile>()) // { // var classDeclaration =file.Get // var attribute = file.GetContainingNode<IAttribute>(); // if (attribute != null) // { // var literal = attribute.Arguments.OfType<ICSharpLiteralExpression>(); // //TODO get value and compare with class's name // } // } // // original implementation // return // from file in projectFile.EnumeratePsiFiles() // from reference in new ReferenceCollector<IPathReference>().Process(file).References // where reference.CheckResolveResult() == ResolveErrorType.OK // let declaredElement = reference.Resolve().DeclaredElement // where declaredElement != null // from a in declaredElement.GetSourceFiles().SelectNotNull(f => f.ToProjectFile()) // select JetTuple.Of(a, GetRelationPresentation(reference)); }
public static UnitTestElementDisposition BuildDisposition(UnitTestElement element, ScenarioLocation location, IProjectFile projectFile) { var contents = File.ReadAllText(location.Path); var range = new TextRange(LineToOffset(contents, location.FromLine), LineToOffset(contents, location.ToLine)); return new UnitTestElementDisposition(element, projectFile, range, new TextRange(0)); }
public ErrorStripeRequest InitialErrorStripe(IProjectFile file) { if (PsiSupportManager.Instance.ShouldBuildPsi(file) && (ProjectFileLanguageServiceManager.Instance.GetPsiLanguageType(file) == MappingFileLanguageService.MAPPING_FILE)) { return ErrorStripeRequest.STRIPE_AND_ERRORS; } return ErrorStripeRequest.NONE; }
internal IList<IPsiSourceFile> GetPsiSourceFilesFor(IProjectFile projectFile) { _shellLocks.AssertReadAccessAllowed(); ModuleWrapper wrapper; return projectFile != null && projectFile.IsValid() && _modules.TryGetValue(projectFile, out wrapper) && wrapper.Module.IsValid() ? new[] { wrapper.Module.SourceFile } : EmptyList<IPsiSourceFile>.InstanceList; }
///<summary> /// /// If any of the registered checked answer ///<c>true</c> for the given project file, then PSI will be built /// ///</summary> /// public BuildPsiResult Check(IProjectFile projectFile) { if (projectFile.LanguageType != NHProjectFileLanguageService.NH) { return BuildPsiResult.UNDEF; } return BuildPsiResult.DO_BUILD; }
/// <summary> /// /// </summary> /// <param name="startLineNumber">Indexed from 1</param> /// <param name="endLineNumber">Indexed from 1</param> /// <param name="projectFile"></param> /// <param name="set"></param> /// <param name="range"></param> public Block(int startLineNumber, int endLineNumber, IProjectFile projectFile, Set set, DocumentRange? range) { Range = range; this.set = set; this.projectFile = projectFile; this.startLineNumber = startLineNumber; this.endLineNumber = endLineNumber; }
public override IPsiSourceFileProperties GetPsiProperties(IProjectFile projectFile, IPsiSourceFile sourceFile) { if (!projectFile.IsProjectReferencingNancyRazorViewEngine()) { return base.GetPsiProperties(projectFile, sourceFile); } return new RazorMvcPsiProjectFileProperties(projectFile, sourceFile); }
public override PsiLanguageType GetPsiLanguageType(IProjectFile projectFile) { if (projectFile.IsProjectReferencingNancyRazorViewEngine()) { return GetPsiLanguageType(projectFile.LanguageType); } return base.GetPsiLanguageType(projectFile); }
///<returns> ///True if further search is not needed ///</returns> /// public bool ProcessProjectItem(IProjectFile projectItem) { IFile psiFile = PsiManager.GetInstance(projectItem.GetSolution()).GetPsiFile(projectItem); if (psiFile != null) { return this.ProcessElement(psiFile); } return false; }
public PsiLanguageType GetPsiLanguageType(IProjectFile file) { if (file == null) { return PsiLanguageType.UNKNOWN; } return GetPsiLanguageType(file.LanguageType); }
public void TryRemoveFile(IProjectFile file) { XXLanguageXXFile result; if (_filesMap.TryGetValue(file, out result)) { _filePathsMap.Remove(result.FullName); result.Dispose(); _filesMap.Remove(file); } }
public void Reset(IProjectFile<string> file, TemplateContentLanguage language) { if (file.HasContents == false) throw new ArgumentException("file must have contents"); this.file = file; editor.Text = file.GetContents(); editor.Document.Language = SyntaxEditorHelper.GetDynamicLanguage(language); errorTreeList.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; Reparse(); }
private bool IsIgnoredFile(IProjectFile projectFile) { foreach (Regex spec in SpecsToIgnore) { if (spec.IsMatch(projectFile.Location.Name)) { return true; } } return false; }
public ProjectFileType GetProjectFileType(IProjectFile file) { if (file == null) { return ProjectFileType.UNKNOWN; } if (IsNHFile(file)) return NH; return null; }
private DocumentRange? GetDocumentRange2(string sourceFile, IProjectFile projectFile, int startLineNumber, int endLineNumber) { try { return GetDocumentRange(projectFile, startLineNumber, endLineNumber, solution); } catch (ArgumentOutOfRangeException) { FilesInError.Add(projectFile); return null; } }
protected NBehaveUnitTestElementBase(IProjectFile featureFile, IUnitTestProvider testProvider, string id, ProjectModelElementEnvoy pointer, NBehaveUnitTestElementBase parent) { FeatureFile = featureFile; //FeatureFile = featureFile.Location.FullPath; _project = featureFile.GetProject(); //ProjectFile = _project.Name; _testProvider = testProvider; _id = id; _projectModel = pointer; Parent = parent; }
///<summary> /// /// If any of the registered checked answer ///<c>true</c> for the given project file, then PSI will be built /// ///</summary> /// public BuildPsiResult Check(IProjectFile projectFile) { FixLangServiceOrder(); if (projectFile.Name.EndsWith(NHProjectFileLanguageService.HBM_SUFFIX)) return BuildPsiResult.DO_BUILD; if (projectFile.LanguageType != NHProjectFileLanguageService.NH) { return BuildPsiResult.UNDEF; } return BuildPsiResult.DO_BUILD; }
public static DocumentRange GetDocumentRange(IProjectFile projectFile, int startLineNumber, int endLineNumber, ISolution solution) { if (startLineNumber > endLineNumber) throw new ArgumentException("start line must come before end line."); DocumentManager documentManager = DocumentManager.GetInstance(solution); IDocument document = documentManager.GetProjectFile(projectFile); int startOffset = document.GetLineStartOffset((Int32<DocLine>) (startLineNumber-1)); int endOffset = document.GetLineEndOffsetNoLineBreak((Int32<DocLine>) (endLineNumber-1)); return new DocumentRange(document, new TextRange(startOffset, endOffset)); }
internal XXLanguageXXFile TryAddFile(IProjectFile file) { XXLanguageXXFile nitraFile; if (!_filesMap.TryGetValue(file, out nitraFile)) { var sourceFile = file.ToSourceFile(); nitraFile = new XXLanguageXXFile(null /*TODO: add statistics*/, sourceFile, this); _filesMap.Add(file, nitraFile); _filePathsMap.Add(nitraFile.FullName, nitraFile); } return nitraFile; }
public PsiLanguageType GetPsiLanguageType(IProjectFile file) { if (file == null) { return PsiLanguageType.UNKNOWN; } Assert.CheckNotNull(file.Name); if (file.Name.EndsWith(HBM_SUFFIX)) return NHLanguageService.NH; return GetPsiLanguageType(file.LanguageType); }
protected static IXmlFile GetXmlFile(IProjectFile projectFile) { if (projectFile == null) { return null; } PsiManager manager = PsiManager.GetInstance(projectFile.GetSolution()); if (!manager.IsCommitted(projectFile)) { return null; } return (manager.GetPsiFile(projectFile) as IXmlFile); }
public XunitFileExplorer([NotNull] XunitTestProvider provider, [NotNull] IProjectFile projectFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (provider == null) throw new ArgumentNullException("provider"); if (projectFile == null) throw new ArgumentNullException("projectFile"); this.consumer = consumer; this.provider = provider; this.interrupted = interrupted; this.projectFile = projectFile; project = this.projectFile.GetProject(); envoy = ProjectModelElementEnvoy.Create(project); }
protected DocType GetDocTypeForFile(IProjectFile file) { if (!IsSupportedFile(file)) { throw new NotSupportedException(String.Format("The file {0} is not supported", file.Name)); } if (ourFileTypes.ContainsKey(file.LanguageType)) { return ourFileTypes[file.LanguageType]; } return Settings.Instance.GetDocType(file.Name); }
protected DocType GetDocTypeForFile(IProjectFile file) { if (!IsSupportedFile(file)) { throw new NotSupportedException(String.Format("The file {0} is not supported", file.Name)); } var docType = ourFileTypes .Where(_ => file.LanguageType.IsProjectFileType(_.Key)) .Select(_ => _.Value) .FirstOrDefault(); return docType == DocType.None ? mySettings.GetDocType(file.Name) : docType; }
protected ILexer CreateLexer(IProjectFile projectFile, StreamReader sr) { var lexer = this.CreateLexer(sr); if (lexer != null) { return lexer; } var buffer = new StringBuffer(sr.ReadToEnd()); var sourceFile = projectFile.ToSourceFile(); Assert.IsNotNull(sourceFile, "sourceFile == null"); var lexerFactory = PsiProjectFileTypeCoordinator.Instance.CreateLexerFactory(this.Solution, sourceFile, buffer); Assert.IsNotNull(lexerFactory, "lexerFactory == null"); return lexerFactory.CreateLexer(buffer); }
/// <summary> /// Gets the settings for the file provided. /// </summary> /// <param name="projectFile"> /// The project file to get the Settings for. /// </param> /// <returns> /// Null if it couldn't find one. /// </returns> public Settings GetSettings(IProjectFile projectFile) { StyleCopTrace.In(projectFile); string settingsFile = this.FindSettingsFilePath(projectFile); Settings settings = this.GetMergedSettings(settingsFile); if (settings == null) { string defaultSettingsPath = this.styleCopCore.Environment.GetDefaultSettingsPath(); return string.IsNullOrEmpty(defaultSettingsPath) ? null : this.styleCopCore.Environment.GetSettings(defaultSettingsPath, true); } return StyleCopTrace.Out(this.styleCopCore.Environment.GetSettings(settingsFile, true)); }
public XunitFileExplorer([NotNull] XunitElementFactory factory, [NotNull] ITreeNode file, [NotNull] SearchDomainFactory searchDomainFactory, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted) { if (factory == null) throw new ArgumentNullException("factory"); if (searchDomainFactory == null) throw new ArgumentNullException("searchDomainFactory"); if (file == null) throw new ArgumentNullException("file"); this.factory = factory; this.searchDomainFactory = searchDomainFactory; this.consumer = consumer; this.interrupted = interrupted; projectFile = file.GetSourceFile().ToProjectFile(); if (projectFile != null) project = projectFile.GetProject(); envoy = ProjectModelElementEnvoy.Create(project); }
public override void VisitProjectFile(IProjectFile projectFile) { // Base class handles the recursion. As long as you call on it. base.VisitProjectFile(projectFile); // I really need a way to exclude binary files. Or only include text files. // The GetGeneratedByToolProperty() seems to take care of some of the binary files. // From it's name alone you'd think projectFile.IsTextSearchable() would work. // But it returns false for everything. if (projectFile.Kind == ProjectItemKind.PHYSICAL_FILE /*&& projectFile.GetGeneratedByToolProperty() == false*/) { if (IsIncludedFile(projectFile) && !IsIgnoredFile(projectFile)) { // Add any files we want to analyze // Sometimes they were getting added twice. Not sure why exactly. if(!Files.Contains(projectFile.Location)) Files.Add(projectFile.Location); } } }
public ISingleFileCustomToolExecutionResult Execute(IProjectFile projectFile) { Logger.Verbose("Got request to execute a file"); var file = projectFile.ToSourceFile()?.GetPsiFiles(T4Language.Instance).OfType <IT4File>().SingleOrDefault(); if (file == null) { return(SingleFileCustomToolExecutionResult.NotExecuted); } var solution = file.GetSolution(); var dataManager = solution.GetComponent <IT4TemplateKindProvider>(); var kind = dataManager.GetTemplateKind(projectFile); if (kind is T4TemplateKind.Executable) { Execute(file, solution); } if (kind is T4TemplateKind.Preprocessed) { Preprocess(file, solution); } return(SingleFileCustomToolExecutionResult.NotExecuted); }
/// <summary> /// Processes all the cleanup. /// </summary> /// <param name="projectFile"> /// The project file to clean. /// </param> /// <param name="file"> /// The PSI file to clean. /// </param> /// <param name="fixXmlDocViolations"> /// Flag to indicate if XML doc stubs should be created /// </param> private void InternalProcess(IProjectFile projectFile, ICSharpFile file, bool fixXmlDocViolations) { // Process the file for all the different Code Cleanups we have here // we do them in a very specific order. Do not change it. Lifetime.Using( lifetime => { StyleCopApiPool apiPool = projectFile.GetSolution().GetComponent <StyleCopApiPool>(); Settings settings = apiPool.GetInstance(lifetime).Settings.GetSettings(projectFile); ReadabilityRules.ExecuteAll(file, settings); MaintainabilityRules.ExecuteAll(file, settings); if (fixXmlDocViolations) { DocumentationRules.ExecuteAll(file, settings); } LayoutRules.ExecuteAll(file, settings); SpacingRules.ExecuteAll(file, settings); OrderingRules.ExecuteAll(file, settings); }); }
public void Execute(IDataContext context, DelegateExecute nextExecute) { IProjectFile projectFile = GetProjectFile(context); if (projectFile == null) { return; } IPsiSourceFile sourceFile = projectFile.ToSourceFile(); if (sourceFile == null) { return; } IFile file = sourceFile.GetTheOnlyPsiFile(CSharpLanguage.Instance); if (file == null) { return; } file.GetPsiServices() .Transactions.Execute( "Reflow XML Documentation Comments", () => { using (WriteLockCookie.Create()) { foreach (var docCommentBlockOwner in file.Descendants <IDocCommentBlockOwner>()) { CommentReflowAction.ReFlowCommentBlockNode( docCommentBlockOwner.GetSolution(), null, docCommentBlockOwner.DocCommentBlock); } } }); }
internal T4PsiModule([NotNull] Lifetime lifetime, [NotNull] PsiModuleManager psiModuleManager, [NotNull] DocumentManager documentManager, [NotNull] ChangeManager changeManager, [NotNull] IAssemblyFactory assemblyFactory, [NotNull] IShellLocks shellLocks, [NotNull] IProjectFile projectFile, [NotNull] T4FileDataCache fileDataCache, [NotNull] T4Environment t4Environment, [NotNull] OutputAssembliesCache outputAssembliesCache) { _lifetime = lifetime; lifetime.AddAction(Dispose); _psiModuleManager = psiModuleManager; _documentManager = documentManager; _assemblyFactory = assemblyFactory; _changeManager = changeManager; changeManager.RegisterChangeProvider(lifetime, this); changeManager.AddDependency(lifetime, psiModuleManager, this); _shellLocks = shellLocks; _projectFile = projectFile; _project = projectFile.GetProject(); Assertion.AssertNotNull(_project, "_project != null"); _solution = _project.GetSolution(); _t4Environment = t4Environment; _outputAssembliesCache = outputAssembliesCache; _resolveProject = new T4ResolveProject(_solution, _shellLocks, t4Environment.PlatformID, _project); _sourceFile = new PsiProjectFile( this, _projectFile, (pf, sf) => new DefaultPsiProjectFileProperties(pf, sf), JetFunc <IProjectFile, IPsiSourceFile> .True, _documentManager); _isValid = true; fileDataCache.FileDataChanged.Advise(lifetime, OnDataFileChanged); AddBaseReferences(); }
public void Resolve(IDataContext context, Action <IQuickDocPresenter, PsiLanguageType> resolved) { var elements = context.GetData(PsiDataConstants.DECLARED_ELEMENTS); Assertion.AssertNotNull(elements, "elements != null"); var document = context.GetData(DocumentModelDataConstants.DOCUMENT); IProjectFile projectFile = null; if (document != null) { projectFile = myDocumentManager.TryGetProjectFile(document); } var defaultLanguage = PresentationUtil.GetPresentationLanguageByContainer(projectFile, mySolution); foreach (var element in elements.OfType <IClrDeclaredElement>()) { var eventFunction = GetEventFunction(element); if (eventFunction != null) { var presenter = new UnityEventFunctionQuickDocPresenter(eventFunction, element, myQuickDocTypeMemberProvider, myTheming, myHelpSystem); resolved(presenter, defaultLanguage); return; } var eventFunctionForParameter = GetEventFunctionFromParameter(element as IParameter); if (eventFunctionForParameter != null) { var presenter = new UnityEventFunctionQuickDocPresenter(eventFunctionForParameter, element.ShortName, element, myQuickDocTypeMemberProvider, myTheming, myHelpSystem); resolved(presenter, defaultLanguage); return; } } }
private static void ProcessCppFile(CppHeaderContext cppHeaderContext, string fileName, string dialogClassName) { if (CppFileMap.ContainsKey(fileName.ToLower())) { IProjectFile projectFile = CppFileMap[fileName.ToLower()]; CppCodeContext cppCodeContext = new CppCodeContext(fileName, dialogClassName); cppCodeContext.CppHeaderContext = cppHeaderContext; cppHeaderContext.CppCodeContext = cppCodeContext; cppCodeContext.WidgetTypeFinder = new WidgetTypeFinder(cppCodeContext, cppHeaderContext); CurrentFileContext = cppCodeContext; cppCodeContext.ProjectFile = projectFile; cppCodeContext.Init(); CurrentFileContext = cppCodeContext; AnalyzeCodeContext(cppCodeContext); cppCodeContext.WriteSavedNodes(); cppCodeContext.ProcessResults(); cppCodeContext.Finalize(); cppCodeContext.SaveClassInfo(); cppCodeContext.WidgetTypeFinder.DoAnalytics(); } else { LogManager.Self.Log($"Missing Cpp File in map: {fileName}"); } }
public IProjectFile InsertFile(string fileSystemPath, bool included, bool ignoreDecompileErrors) { IProjectFile file = CreatNewFile(fileSystemPath, included, ignoreDecompileErrors); if (file == null) { return(null); } int index = _items.FindIndex(x => string.Compare(fileSystemPath, x.FileSystemPath, StringComparison.OrdinalIgnoreCase) < 0); if (index < 0) { _items.Add(file); } else { _items.Insert(index, file); } if (_initialized && included) { _isDirty = true; } return(file); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentationRulesConfiguration"/> class. /// </summary> /// <param name="file"> /// The file to get the configuration for. /// </param> public DocumentationRulesConfiguration(IProjectFile file) { this.settings = new StyleCopSettings(StyleCopCoreFactory.Create()).GetSettings(file); // Default for this property is false BooleanProperty property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnorePrivates"); this.IgnorePrivates = property == null ? false : property.Value; // Default for this property is true property = this.GetStyleCopRuleProperty <BooleanProperty>("IncludeFields"); this.RequireFields = property == null ? true : property.Value; // Default for this property is false property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnoreInternals"); this.IgnoreInternals = property == null ? false : property.Value; StringProperty stringProperty = this.GetStyleCopRuleProperty <StringProperty>("CompanyName"); this.CompanyName = stringProperty != null ? stringProperty.Value : string.Empty; stringProperty = this.GetStyleCopRuleProperty <StringProperty>("Copyright"); this.Copyright = stringProperty != null ? stringProperty.Value : string.Empty; }
public void InitializeResolvedPath( IReadOnlyDictionary <string, string> resolveResults, IPsiSourceFile sourceFile, IProjectFile projectFile ) { string expanded = Environment.ExpandEnvironmentVariables(RawPath ?? ""); string result = MacroRegex.Replace(expanded, match => { var group = match.Groups[1]; string macro = group.Value; if (!group.Success) { return(macro); } if (!resolveResults.TryGetValue(macro, out string value)) { return(macro); } return(value); }); MyResolvedPath = new T4ResolvedPath(result, sourceFile, projectFile); }
public IEnumerable <IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind) { process.Solution.GetPsiServices().DependencyStore.AddDependency(MvcSpecificFileImageContributor.Dependency); IProjectFile projectFile = process.SourceFile.ToProjectFile(); if (projectFile == null) { return(Enumerable.Empty <IDaemonStageProcess>()); } if (!projectFile.IsProjectReferencingNancy()) { return(Enumerable.Empty <IDaemonStageProcess>()); } return(new[] { new NancyDaemonStageProcess(searchDomainFactory, process, process.GetStageProcess <CollectUsagesStageProcess>(), settings) }); }
public IProjectFile OpenFile(string fileSystemPath) { if (!File.Exists(fileSystemPath)) { return(null); } IProjectFile file = _solution == null ? null : _solution.GetProjectFile(fileSystemPath); if (file == null) { file = solutionExplorer.FindFile(fileSystemPath); if (file == null) { file = _nonProjectFiles.FirstOrDefault(x => x.FileSystemPath.Equals(fileSystemPath, StringComparison.OrdinalIgnoreCase)); if (file == null) { file = ProjectFileBase.CreatFile(fileSystemPath, false); _nonProjectFiles.Add(file); } } } OpenFile(file); return(file); }
public override bool TryAddUserData(IProjectFile projectFile, out string name, out string value) { var project = projectFile.GetProject(); if (project == null) { return(base.TryAddUserData(projectFile, out name, out value)); } foreach (var configuration in project.ProjectProperties.ActiveConfigurations.Configurations.OfType <IManagedProjectConfiguration>()) { var defines = configuration.DefineConstants; if (defines.Contains("ANDROID") && defines.Contains("UNITY")) { name = "RequiredAndroidPlugin"; value = "true"; return(true); } } name = null; value = null; return(base.TryAddUserData(projectFile, out name, out value)); }
public T DeserializeItem <T>(IProjectFile item) { var filePath = item.FullPath; if (File.Exists(filePath)) { try { using (var reader = new StreamReader(filePath)) { return(JsonConvert.DeserializeObject <T>(reader.ReadToEnd())); } } catch (Exception e) { Log.Error($"Unable to process item {item.Path}: {e.Message}"); } } else { Log.Warning($"File {filePath} does not exists."); } return(default(T)); }
private bool IsActionResult([NotNull] IProjectFile suspect, T4TemplateKind kind) { if (!(suspect.Properties is ProjectFileProperties properties)) { return(false); } string sourceName = properties.DependsUponName; if (sourceName.IsEmpty()) { return(false); } var parentFolder = suspect.ParentFolder; if (parentFolder == null) { return(false); } return(parentFolder .GetSubItems(sourceName) .ToList() .OfType <IProjectFile>() .Any(source => IsActionResult(suspect, source, kind))); }
private PropertyValue GetParserSetting(IProjectFile projectFile, string propertyName) { StyleCopTrace.In(projectFile, propertyName); PropertyValue returnValue = null; SourceParser addIn = this.styleCopCore.GetParser(CsParserId); if (addIn != null) { string settingsFile = this.FindSettingsFilePath(projectFile); if (!string.IsNullOrEmpty(settingsFile)) { Settings settings = this.styleCopCore.Environment.GetSettings(settingsFile, true); if (settings != null) { returnValue = addIn.GetSetting(settings, propertyName); } } } return(StyleCopTrace.Out(returnValue)); }
private string GetNamespace() { IPsiSourceFile sourceFile = _file.GetSourceFile(); if (sourceFile == null) { return(null); } IProjectFile projectFile = sourceFile.ToProjectFile(); if (projectFile == null || !projectFile.IsPreprocessedT4Template()) { return(null); } string ns = projectFile.GetProperties().CustomToolNamespace; if (!String.IsNullOrEmpty(ns)) { return(ns); } return(sourceFile.Properties.GetDefaultNamespace()); }
private static void UpgradeMauiAndroid(IProjectPropertyElements projectproperties, IProjectFile file) { // confirm final mappings https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNet.md#changes-to-msbuild-properties // remove uneeded properties projectproperties.RemoveProjectProperty("AndroidApplication"); projectproperties.RemoveProjectProperty("AndroidResgenFile"); projectproperties.RemoveProjectProperty("AndroidResgenClass"); projectproperties.RemoveProjectProperty("MonoAndroidAssetsPrefix"); projectproperties.RemoveProjectProperty("MonoAndroidAssetsPrefix"); projectproperties.RemoveProjectProperty("AndroidUseLatestPlatformSdk"); projectproperties.RemoveProjectProperty("AndroidEnableSGenConcurrent"); projectproperties.RemoveProjectProperty("AndroidHttpClientHandlerType"); projectproperties.RemoveProjectProperty("AndroidManagedSymbols"); projectproperties.RemoveProjectProperty("AndroidUseSharedRuntime"); projectproperties.RemoveProjectProperty("MonoAndroidResourcePrefix"); projectproperties.RemoveProjectProperty("AndroidUseAapt2"); projectproperties.RemoveProjectProperty("AndroidSupportedAbis"); file.SetPropertyValue("RuntimeIdentifiers", "android-arm;android-arm64;android-x86;android-x64"); var androidLinkMode = projectproperties.GetProjectPropertyValue("AndroidLinkMode"); foreach (var linkMode in androidLinkMode) { projectproperties.RemoveProjectProperty("AndroidLinkMode"); if (string.Equals(linkMode, "SdkOnly", StringComparison.Ordinal) || string.Equals(linkMode, "Full", StringComparison.Ordinal)) { file.SetPropertyValue("PublishTrimmed", "true"); file.SetPropertyValue("TrimMode", "link"); } } }
public AnimationData GetAnimationData(IProjectFile item) { return(ProjectService?.DeserializeItem <AnimationData>(item)); }
public NBehaveFeatureTestElement(string featureTitle, IProjectFile featureFile, IUnitTestProvider testProvider, ProjectModelElementEnvoy projectModel) : base(featureFile, testProvider, featureFile.Location.FullPath + "/" + featureTitle, projectModel, null) { _featureTitle = featureTitle; IdentityGenerator.Reset(); }
public override IEnumerable <IPsiSourceFile> GetPsiSourceFilesFor(IProjectFile projectFile) => base.GetPsiSourceFilesFor(projectFile).Concat(_t4PsiModuleProvider.GetPsiSourceFilesFor(projectFile));
public XmlOutputModel(XElement element, INamespace ns, IProjectFile file = null, string type = null) : base( type, ns, file: file) { this.Element = element; this.Type = type ?? Constants.OutputModelType_Xml; }
internal static string GetCustomToolNamespace([CanBeNull] this IProjectFile projectFile) { return(projectFile != null?projectFile.GetProperties().CustomToolNamespace : null); }
public static bool IsFlaggedAsPreprocessed([NotNull] this IProjectFile thіs) => thіs.HasKey(PreprocessedKey);
public static void FlagAsExecutable([NotNull] this IProjectFile thіs) => thіs.RemoveKey(PreprocessedKey);
public static void FlagAsPreprocessed([NotNull] this IProjectFile thіs) => thіs.PutKey(PreprocessedKey);
public NBehaveScenarioTestElement(string scenario, IProjectFile featureFile, IUnitTestProvider testProvider, ProjectModelElementEnvoy projectModel, NBehaveUnitTestElementBase parent) : base(featureFile, testProvider, parent.Id + "/" + scenario, projectModel, parent) { _scenario = scenario; }
public IList <TestCopProjectItem> GetAssociatedProjectFor(IProject currentProject, IProjectFile projectFile, string overrideClassName = null) { string currentNamespace = projectFile.CalculateExpectedNamespace(projectFile.GetPrimaryPsiFile().Language); var fileNameToProcess = projectFile.Location.NameWithoutExtension; fileNameToProcess = fileNameToProcess.RemoveTrailing(".partial"); var directoryPath = TestCopProjectItem.ExtractFolders(projectFile).AsIList(); return(GetAssociatedProject(currentProject, string.IsNullOrEmpty(overrideClassName) ? fileNameToProcess : overrideClassName, currentNamespace, directoryPath)); }
public CreateSoundAssetCommand(ICreateSoundAssetService createSoundAssetService, IProjectFile soundFile) { _createSoundAssetService = createSoundAssetService; _soundFile = soundFile; }
public CreateTextureAssetCommand Create(IProjectFile textureFile) { return(new CreateTextureAssetCommand(_createTextureAssetService, textureFile)); }
public static bool IsPreprocessedTemplate( [NotNull] this IT4TemplateKindProvider manager, [NotNull] IProjectFile file ) => manager.GetTemplateKind(file) == T4TemplateKind.Preprocessed;