當前位置: 首頁>>代碼示例>>C#>>正文


C# Projects.ProjectFile類代碼示例

本文整理匯總了C#中MonoDevelop.Projects.ProjectFile的典型用法代碼示例。如果您正苦於以下問題:C# ProjectFile類的具體用法?C# ProjectFile怎麽用?C# ProjectFile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ProjectFile類屬於MonoDevelop.Projects命名空間,在下文中一共展示了ProjectFile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetCodeBehindClassName

		public static string GetCodeBehindClassName (ProjectFile file)
		{
			AspNetAppProject proj = file.Project as AspNetAppProject;
			if (proj == null)
				return null;
			return proj.GetCodebehindTypeName (file.Name);
		}
開發者ID:transformersprimeabcxyz,項目名稱:monodevelop-1,代碼行數:7,代碼來源:CodeBehind.cs

示例2: GenerateAllFiles

		List<Tuple<string, string, ProjectFile>> GenerateAllFiles ()
		{
			//Slowest thing here is GetRelProjectPath, hence Tuple<,,> needs to be cached
			var list = new List<Tuple<string, string, ProjectFile>> ();
			foreach (var doc in IdeApp.Workbench.Documents) {
				// We only want to check it here if it's not part
				// of the open combine.  Otherwise, it will get
				// checked down below.
				if (doc.Project == null && doc.IsFile) {
					var pf = new ProjectFile (doc.Name);
					list.Add (new Tuple<string, string, ProjectFile> (System.IO.Path.GetFileName (pf.FilePath), FileSearchResult.GetRelProjectPath (pf), pf));
				}
			}

			var projects = IdeApp.Workspace.GetAllProjects ();

			foreach (var p in projects) {
				foreach (ProjectFile pf in p.Files) {
					if (pf.Subtype != Subtype.Directory && (pf.Flags & ProjectItemFlags.Hidden) != ProjectItemFlags.Hidden) {
						list.Add (new Tuple<string, string, ProjectFile> (System.IO.Path.GetFileName (pf.FilePath), FileSearchResult.GetRelProjectPath (pf), pf));
					}
				}
			}
			return list;
		}
開發者ID:sushihangover,項目名稱:monodevelop,代碼行數:25,代碼來源:FileSearchCategory.cs

示例3: GetDefaultCustomToolForFileName

		public string GetDefaultCustomToolForFileName (ProjectFile projectItem)
		{
			if (defaultCustomTools.ContainsKey (projectItem.FilePath.ToString ())) {
				return defaultCustomTools [projectItem.FilePath.ToString ()];
			}
			return String.Empty;
		}
開發者ID:riverans,項目名稱:monodevelop,代碼行數:7,代碼來源:FakePackageManagementProjectService.cs

示例4: FromCodeIssue

		public static IssueSummary FromCodeIssue(ProjectFile file, BaseCodeIssueProvider provider, CodeIssue codeIssue)
		{
			var topLevelProvider = (provider as CodeIssueProvider) ?? provider.Parent;
			if (topLevelProvider == null)
				throw new ArgumentException ("must be a CodeIssueProvider or a BaseCodeIssueProvider with Parent != null", "provider");
			var issueSummary = new IssueSummary {
				IssueDescription = codeIssue.Description,
				Region = codeIssue.Region,
				ProviderTitle = topLevelProvider.Title,
				ProviderDescription = topLevelProvider.Description,
				ProviderCategory = topLevelProvider.Category,
				Severity = topLevelProvider.GetSeverity (),
				IssueMarker = codeIssue.IssueMarker,
				File = file,
				Project = file.Project,
				InspectorIdString = codeIssue.InspectorIdString
			};
			issueSummary.Actions = codeIssue.Actions.Select (a => new ActionSummary {
				Batchable = a.SupportsBatchRunning,
				SiblingKey = a.SiblingKey,
				Title = a.Title,
				Region = a.DocumentRegion,
				IssueSummary = issueSummary
			}).ToList ();
			return issueSummary;
		}
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:26,代碼來源:IssueSummary.cs

示例5: UpdateDesignerFile

		public static BuildResult UpdateDesignerFile (
			CodeBehindWriter writer,
			DotNetProject project,
			ProjectFile file, ProjectFile designerFile
		)
		{
			var result = new BuildResult ();

			//parse the ASP.NET file
			var parsedDocument = TypeSystemService.ParseFile (project, file.FilePath).Result as WebFormsParsedDocument;
			if (parsedDocument == null) {
				result.AddError (string.Format ("Failed to parse file '{0}'", file.Name));
				return result;
			}

			//TODO: ensure type system is up to date

			CodeCompileUnit ccu;
			result.Append (GenerateCodeBehind (project, designerFile.FilePath, parsedDocument, out ccu));
			if (ccu != null) {
				writer.WriteFile (designerFile.FilePath, ccu);
			}

			return result;
		}
開發者ID:polluks,項目名稱:monodevelop,代碼行數:25,代碼來源:WebFormsCodeBehind.cs

示例6: GenerateInternal

		static void GenerateInternal (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
		{
			if (file.Project.SupportedLanguages.All (l => l != "C#")) {
				const string msg = "Razor templates are only supported in C# projects";
				result.Errors.Add (new CompilerError (file.Name, -1, -1, null, msg));
				monitor.Log.WriteLine (msg);
				return;
			}

			var host = new PreprocessedRazorHost (file.FilePath);

			var defaultOutputName = file.FilePath.ChangeExtension (".cs");

			var ns = CustomToolService.GetFileNamespace (file, defaultOutputName);
			host.DefaultNamespace = ns;

			CompilerErrorCollection errors;
			var code = host.GenerateCode (out errors);
			result.Errors.AddRange (errors);

			var writer = new MonoDevelop.DesignerSupport.CodeBehindWriter ();
			writer.WriteFile (defaultOutputName, code);
			writer.WriteOpenFiles ();

			result.GeneratedFilePath = defaultOutputName;

			foreach (var err in result.Errors) {
				monitor.Log.WriteLine (err);
			}
		}
開發者ID:riverans,項目名稱:monodevelop,代碼行數:30,代碼來源:RazorTemplatePreprocessor.cs

示例7: GetDesignerFileName

		private static string GetDesignerFileName (ProjectFile file)
		{
			string directory = Path.GetDirectoryName (file.FilePath);
			string extension = Path.GetExtension (file.Name);
			string designerFile = Path.GetFileNameWithoutExtension (file.Name) + ".Designer" + extension;
			return Path.Combine (directory, designerFile);
		}
開發者ID:JianwenSun,項目名稱:mono-soc-2007,代碼行數:7,代碼來源:CodeBehind.cs

示例8: GetCodeBehindClassName

		public static string GetCodeBehindClassName (ProjectFile file)
		{
			var proj = file.Project.GetService<AspNetAppProjectFlavor> ();
			if (proj == null)
				return null;
			return proj.GetCodebehindTypeName (file.Name);
		}
開發者ID:polluks,項目名稱:monodevelop,代碼行數:7,代碼來源:WebFormsCodeBehind.cs

示例9: HandleException

		private void HandleException(Exception ex, ProjectFile file, SingleFileCustomToolResult result)
		{
			if (ex is SpecFlowParserException)
			{
				SpecFlowParserException sfpex = (SpecFlowParserException) ex;
			                
				if (sfpex.ErrorDetails == null || sfpex.ErrorDetails.Count == 0)
				{
					result.UnhandledException = ex;
				}
				else
				{
					var compilerErrors = new CompilerErrorCollection();
					
					foreach (var errorDetail in sfpex.ErrorDetails)
					{
						var compilerError = new CompilerError(file.Name, errorDetail.ForcedLine, errorDetail.ForcedColumn, "0", errorDetail.Message);
						compilerErrors.Add(compilerError);
					}
							
					result.Errors.AddRange(compilerErrors);
				}
			}
			else
			{
				result.UnhandledException = ex;
			}
		}
開發者ID:roffster,項目名稱:SpecFlow,代碼行數:28,代碼來源:SingleFeatureFileGenerator.cs

示例10: GetGenerator

		static ISingleFileCustomTool GetGenerator (ProjectFile file)
		{
			CustomToolExtensionNode node;
			if (!string.IsNullOrEmpty (file.Generator) && nodes.TryGetValue (file.Generator, out node))
				return node.Tool;
			return null;
		}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:7,代碼來源:CustomToolService.cs

示例11: GenerateInternal

		void GenerateInternal (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
		{
			var dnp = file.Project as DotNetProject;
			if (dnp == null || dnp.LanguageName != "C#") {
				var msg = "Razor templates are only supported in C# projects";
				result.Errors.Add (new CompilerError (file.Name, -1, -1, null, msg));
				monitor.Log.WriteLine (msg);
				return;
			}

			var host = PreprocessedRazorHost.Create (file.FilePath);

			var defaultOutputName = file.FilePath.ChangeExtension (".cs");

			var ns = GetNamespaceHint (file, defaultOutputName);
			host.DefaultNamespace = ns;

			CompilerErrorCollection errors;
			var code = host.GenerateCode (out errors);
			result.Errors.AddRange (errors);

			var writer = new MonoDevelop.DesignerSupport.CodeBehindWriter ();
			writer.WriteFile (defaultOutputName, code);
			writer.WriteOpenFiles ();

			result.GeneratedFilePath = defaultOutputName;

			foreach (var err in result.Errors) {
				monitor.Log.WriteLine (err.ToString ());
			}
		}
開發者ID:RainsSoft,項目名稱:playscript-monodevelop,代碼行數:31,代碼來源:RazorTemplatePreprocessor.cs

示例12: Generate

		public IAsyncOperation Generate (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
		{
			return new ThreadAsyncOperation (delegate {
				var dnp = file.Project as DotNetProject;
				if (dnp == null) {
					var err = "ResXFileCodeGenerator can only be used with .NET projects";
					result.Errors.Add (new CompilerError (null, 0, 0, null, err));
					return;
				}

				var provider = dnp.LanguageBinding.GetCodeDomProvider ();
				if (provider == null) {
					var err = "ResXFileCodeGenerator can only be used with languages that support CodeDOM";
					result.Errors.Add (new CompilerError (null, 0, 0, null, err));
					return;
				}

				var outputfile = file.FilePath.ChangeExtension (".Designer." + provider.FileExtension);
				var ns = CustomToolService.GetFileNamespace (file, outputfile);
				var cn = provider.CreateValidIdentifier (file.FilePath.FileNameWithoutExtension);

				string[] unmatchable;
				var ccu = StronglyTypedResourceBuilder.Create (file.FilePath, cn, ns, provider, true, out unmatchable);

				foreach (var p in unmatchable) {
					var msg = string.Format ("Could not generate property for resource ID '{0}'", p);
					result.Errors.Add (new CompilerError (file.FilePath, 0, 0, null, msg));
				}

				using (var w = new StreamWriter (outputfile, false, Encoding.UTF8))
					provider.GenerateCodeFromCompileUnit (ccu, w, new CodeGeneratorOptions ());

				result.GeneratedFilePath = outputfile;
			}, result);
		}
開發者ID:telebovich,項目名稱:monodevelop,代碼行數:35,代碼來源:ResXFileCodeGenerator.cs

示例13: BuildModuleName

        public static string BuildModuleName(ProjectFile pf)
        {
            // When handling an external link, keep it rooted though it might occur in a project's subfolder
            if (pf.IsLink || pf.IsExternalToProject)
                return pf.FilePath.FileNameWithoutExtension;

            return pf.ProjectVirtualPath.ChangeExtension(null).ToString().Replace(Path.DirectorySeparatorChar, '.');
        }
開發者ID:gavin-norman,項目名稱:Mono-D,代碼行數:8,代碼來源:DParserWrapper.cs

示例14: ProjectFileDescriptor

		public ProjectFileDescriptor (ProjectFile file)
		{
			this.file = file;
			project = file.Project;
			if (project != null) {
				project.FilePropertyChangedInProject += OnFilePropertyChangedInProject;
			}
		}
開發者ID:pabloescribanoloza,項目名稱:monodevelop,代碼行數:8,代碼來源:ProjectFileDescriptor.cs

示例15: SetUp

		public void SetUp ()
		{
			queue = new AnalysisJobQueue ();
			file1 = new ProjectFile ("file1.cs");
			file2 = new ProjectFile ("file2.cs");
			file3 = new ProjectFile ("file3.cs");
			job = new SimpleAnalysisJob (new [] { file1, file2 });
		}
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:8,代碼來源:AnalysisJobQueueTests.cs


注:本文中的MonoDevelop.Projects.ProjectFile類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。