当前位置: 首页>>代码示例>>C#>>正文


C# ProjectFileCollection类代码示例

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


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

示例1: Project

		public Project ()
		{
			FileService.FileChanged += OnFileChanged;
			files = new ProjectFileCollection ();
			Items.Bind (files);
			DependencyResolutionEnabled = true;
		}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:7,代码来源:Project.cs

示例2: FakeDotNetProject

		public FakeDotNetProject (string fileName)
			: base (fileName)
		{
			References = new ProjectReferenceCollection ();
			Files = new ProjectFileCollection ();
			CreateEqualsAction ();
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:7,代码来源:FakeDotNetProject.cs

示例3: GetFolderContent

		void GetFolderContent (Project project, string folder, out ProjectFileCollection files, out ArrayList folders)
		{
			files = new ProjectFileCollection ();
			folders = new ArrayList ();
			string folderPrefix = folder + Path.DirectorySeparatorChar;
			
			foreach (ProjectFile file in project.Files)
			{
				string dir;

				if (file.Subtype != Subtype.Directory) {
					if (file.DependsOnFile != null)
						continue;
					
					dir = file.IsLink
						? project.BaseDirectory.Combine (file.ProjectVirtualPath).ParentDirectory
						: file.FilePath.ParentDirectory;
						
					if (dir == folder) {
						files.Add (file);
						continue;
					}
				} else
					dir = file.Name;
				
				// add the directory if it isn't already present
				if (dir.StartsWith (folderPrefix)) {
					int i = dir.IndexOf (Path.DirectorySeparatorChar, folderPrefix.Length);
					if (i != -1) dir = dir.Substring (0,i);
					if (!folders.Contains (dir))
						folders.Add (dir);
				}
			}
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:34,代码来源:FolderNodeBuilder.cs

示例4: Compile

		public override ICompilerResult Compile (
			ProjectFileCollection projectFiles,
		    ProjectPackageCollection packages,
		    CProjectConfiguration configuration,
		    IProgressMonitor monitor)
		{
			CompilerResults cr = new CompilerResults (new TempFileCollection ());
			bool res = true;
			string args = GetCompilerFlags (configuration);
			
			string outputName = Path.Combine (configuration.OutputDirectory,
			                                  configuration.CompiledOutputName);
			
			// Precompile header files and place them in .prec/<config_name>/
			string precdir = Path.Combine (configuration.SourceDirectory, ".prec");
			if (!Directory.Exists (precdir))
				Directory.CreateDirectory (precdir);
			precdir = Path.Combine (precdir, configuration.Name);
			if (!Directory.Exists (precdir))
				Directory.CreateDirectory (precdir);
			
			PrecompileHeaders (projectFiles, configuration, args);
			
			foreach (ProjectFile f in projectFiles) {
				if (f.Subtype == Subtype.Directory) continue;
				
				if (f.BuildAction == BuildAction.Compile) {
					if (configuration.UseCcache || NeedsCompiling (f))
						res = DoCompilation (f, args, packages, monitor, cr, configuration.UseCcache);
				}
				else
					res = true;
				
				if (!res) break;
			}

			if (res) {
				switch (configuration.CompileTarget)
				{
				case CBinding.CompileTarget.Bin:
					MakeBin (
						projectFiles, packages, configuration, cr, monitor, outputName);
					break;
				case CBinding.CompileTarget.StaticLibrary:
					MakeStaticLibrary (
						projectFiles, monitor, outputName);
					break;
				case CBinding.CompileTarget.SharedLibrary:
					MakeSharedLibrary (
						projectFiles, packages, configuration, cr, monitor, outputName);
					break;
				}
			}
			
			return new DefaultCompilerResult (cr, "");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:56,代码来源:GNUCompiler.cs

示例5: PrecompileHeaders

		private bool PrecompileHeaders (ProjectFileCollection projectFiles,
		                                CProjectConfiguration configuration,
		                                string args,
		                                IProgressMonitor monitor,
		                                CompilerResults cr)
		{
			monitor.BeginTask (GettextCatalog.GetString ("Precompiling headers"), 1);
			bool success = true;
			
			foreach (ProjectFile file in projectFiles) {
				if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) {
					string precomp = Path.Combine (configuration.SourceDirectory, ".prec");
					precomp = Path.Combine (precomp, configuration.Id);
					precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc");
					if (file.BuildAction == BuildAction.Compile) {
						if (!File.Exists (precomp) || configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) {
							if (DoPrecompileHeader (file, precomp, args, monitor, cr) == false) {
								success = false;
								break;
							}
						}
					} else {
						//remove old files or they'll interfere with the build
						if (File.Exists (precomp))
							File.Delete (precomp);
					}
				}
				
			}
			if (success)
				monitor.Step (1);
			monitor.EndTask ();
			return success;
		}
开发者ID:thild,项目名称:monodevelop,代码行数:34,代码来源:GNUCompiler.cs

示例6: MakeStaticLibrary

		private void MakeStaticLibrary (Project project,
		                                ProjectFileCollection projectFiles,
		                                CProjectConfiguration configuration,
		                                ProjectPackageCollection packages,
		                                CompilerResults cr,
		                                IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
			
			string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
			string args = string.Format ("rcs \"{0}\" {1}", outputName, objectFiles);
			
			monitor.BeginTask (GettextCatalog.GetString ("Generating static library {0} from object files", Path.GetFileName (outputName)), 1);
			
			string errorOutput;
			int exitCode = ExecuteCommand ("ar", args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
			if (exitCode == 0)
				monitor.Step (1);
			monitor.EndTask ();
			
			ParseCompilerOutput (errorOutput, cr);
			ParseLinkerOutput (errorOutput, cr);
			CheckReturnCode (exitCode, cr);
		}
开发者ID:thild,项目名称:monodevelop,代码行数:24,代码来源:GNUCompiler.cs

示例7: Compile

		public BuildResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
		{
			return compilerServices.Compile (projectFiles, references, configuration, monitor);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:NemerleLanguageBinding.cs

示例8: NeedsUpdate

		/// <summary>
		/// Determines whether the target needs to be updated
		/// </summary>
		/// <param name="projectFiles">
		/// The project's files
		/// <see cref="ProjectFileCollection"/>
		/// </param>
		/// <param name="target">
		/// The target
		/// <see cref="System.String"/>
		/// </param>
		/// <returns>
		/// true if target needs to be updated
		/// <see cref="System.Boolean"/>
		/// </returns>
		private bool NeedsUpdate (ProjectFileCollection projectFiles,
								  string target)
		{
			return true;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:20,代码来源:ValaCompiler.cs

示例9: CreateErrorFromErrorString

		/// <summary>
		/// Creates a compiler error from an output string
		/// </summary>
		/// <param name="errorString">
		/// The error string to be parsed
		/// <see cref="System.String"/>
		/// </param>
		/// <returns>
		/// A newly created CompilerError
		/// <see cref="CompilerError"/>
		/// </returns>
		private CompilerError CreateErrorFromErrorString (string errorString, ProjectFileCollection projectFiles)
		{
			Match errorMatch = null;
			foreach (Regex regex in new Regex[]{errorRegex, gccRegex})
				if ((errorMatch = regex.Match (errorString)).Success)
					break;
			
			if (!errorMatch.Success)
				return null;

			CompilerError error = new CompilerError ();
			
			foreach (ProjectFile pf in projectFiles) {
				if (Path.GetFileName (pf.Name) == errorMatch.Groups["file"].Value) {
					error.FileName = pf.FilePath;
					break;
				}
			}// check for fully pathed file
			if (string.Empty == error.FileName) {
				error.FileName = errorMatch.Groups["file"].Value;
			}// fallback to exact match
			error.Line = int.Parse (errorMatch.Groups["line"].Value);
			if (errorMatch.Groups["column"].Success)
				error.Column = int.Parse (errorMatch.Groups["column"].Value);
			error.IsWarning = !errorMatch.Groups["level"].Value.Equals (GettextCatalog.GetString ("error"), StringComparison.Ordinal);
			error.ErrorText = errorMatch.Groups["message"].Value;
			
			return error;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:40,代码来源:ValaCompiler.cs

示例10: Clean

		/// <summary>
		/// Cleans up intermediate files
		/// </summary>
		/// <param name="projectFiles">
		/// The project's files
		/// <see cref="ProjectFileCollection"/>
		/// </param>
		/// <param name="configuration">
		/// Project configuration
		/// <see cref="ValaProjectConfiguration"/>
		/// </param>
		/// <param name="monitor">
		/// The progress monitor to be used
		/// <see cref="IProgressMonitor"/>
		/// </param>
		public void Clean (ProjectFileCollection projectFiles, ValaProjectConfiguration configuration, IProgressMonitor monitor)
		{
			/// Clean up intermediate files
			/// These should only be generated for libraries, but we'll check for them in all cases
			foreach (ProjectFile file in projectFiles) {
				if (file.BuildAction == BuildAction.Compile) {
					string cFile = Path.Combine (configuration.OutputDirectory, Path.GetFileNameWithoutExtension (file.Name) + ".c");
					if (File.Exists (cFile)){ File.Delete (cFile); }
						
					string hFile = Path.Combine (configuration.OutputDirectory, Path.GetFileNameWithoutExtension (file.Name) + ".h");
					if (File.Exists (hFile)){ File.Delete (hFile); }
				}
			}
			
			string vapiFile = Path.Combine (configuration.OutputDirectory, configuration.Output + ".vapi");
			if (File.Exists (vapiFile)){ File.Delete (vapiFile); }
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:32,代码来源:ValaCompiler.cs

示例11: ObjectFiles

		private string[] ObjectFiles (ProjectFileCollection projectFiles)
		{
			List<string> objectFiles = new List<string> ();
			
			foreach (ProjectFile f in projectFiles) {
				if (f.BuildAction == BuildAction.Compile) {
					objectFiles.Add (Path.ChangeExtension (f.Name, ".o"));
				}
			}
			
			return objectFiles.ToArray ();
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:12,代码来源:GNUCompiler.cs

示例12: ObjectFiles

		/// <summary>
		/// Gets the files that get compiled into object code.
		/// </summary>
		/// <param name="projectFiles">
		/// A <see cref="ProjectFileCollection"/>
		/// The project's files, extracts from here the files that get compiled into object code.
		/// </param>
		/// <param name="configuration">
		/// A <see cref="CProjectConfiguration"/>
		/// The configuration to get the object files for...
		/// </param>
		/// <param name="withQuotes">
		/// A <see cref="System.Boolean"/>
		/// If true, it will surround each object file with quotes 
		/// so that gcc has no problem with paths that contain spaces.
		/// </param>
		/// <returns>
		/// An array of strings, each string is the name of a file
		/// that will get compiled into object code. The file name
		/// will already have the .o extension.
		/// </returns>
		private string[] ObjectFiles (ProjectFileCollection projectFiles, CProjectConfiguration configuration, bool withQuotes)
		{
			if(projectFiles.Count == 0)
				return new string[] {};

			List<string> objectFiles = new List<string> ();
			
			foreach (ProjectFile f in projectFiles) {
				if (f.BuildAction == BuildAction.Compile) {
					string PathName = Path.Combine(configuration.OutputDirectory, Path.GetFileNameWithoutExtension(f.Name) + ".o");

					if(File.Exists(PathName) == false)
						continue;
					
					if (!withQuotes)
						objectFiles.Add (PathName);
					else
						objectFiles.Add ("\"" + PathName + "\"");
				}
			}
			
			return objectFiles.ToArray ();
		}
开发者ID:thild,项目名称:monodevelop,代码行数:44,代码来源:GNUCompiler.cs

示例13: MakeStaticLibrary

		private void MakeStaticLibrary (ProjectFileCollection projectFiles,
		                                IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, outputName)) return;
			
			string objectFiles = StringArrayToSingleString (ObjectFiles (projectFiles));
			
			monitor.Log.WriteLine ("Generating static library...");
			monitor.Log.WriteLine ("using: ar rcs " + outputName + " " + objectFiles);
			
			Process p = Runtime.ProcessService.StartProcess (
				"ar", "rcs " + outputName + " " + objectFiles,
				null, null);
			p.WaitForExit ();
			p.Close ();
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:16,代码来源:GNUCompiler.cs

示例14: MakeSharedLibrary

		private void MakeSharedLibrary(ProjectFileCollection projectFiles,
		                               ProjectPackageCollection packages,
		                               CProjectConfiguration configuration,
		                               CompilerResults cr,
		                               IProgressMonitor monitor, string outputName)
		{
			if (!NeedsUpdate (projectFiles, outputName)) return;
			
			string objectFiles = StringArrayToSingleString (ObjectFiles (projectFiles));
			string pkgargs = GeneratePkgLinkerArgs (packages);
			StringBuilder args = new StringBuilder ();
			CCompilationParameters cp =
				(CCompilationParameters)configuration.CompilationParameters;
			
			if (cp.ExtraLinkerArguments != null && cp.ExtraLinkerArguments.Length > 0) {
				string extraLinkerArgs = cp.ExtraLinkerArguments.Replace ('\n', ' ');
				args.Append (extraLinkerArgs + " ");
			}
			
			if (configuration.LibPaths != null)
				foreach (string libpath in configuration.LibPaths)
					args.Append ("-L" + libpath + " ");
			
			if (configuration.Libs != null)
				foreach (string lib in configuration.Libs)
					args.Append ("-l" + lib + " ");
			
			monitor.Log.WriteLine ("Generating shared object...");
			
			string linker_args = string.Format ("-shared -o {0} {1} {2} {3}",
			    outputName, objectFiles, args.ToString (), pkgargs);
			
			monitor.Log.WriteLine ("using: " + linkerCommand + " " + linker_args);
			
			ProcessWrapper p = Runtime.ProcessService.StartProcess (linkerCommand, linker_args, null, null);

			p.WaitForExit ();
			
			string line;
			StringWriter error = new StringWriter ();
			
			while ((line = p.StandardError.ReadLine ()) != null)
				error.WriteLine (line);
			
			monitor.Log.WriteLine (error.ToString ());
			
			ParseCompilerOutput (error.ToString (), cr);
			
			error.Close ();
			p.Close ();
			
			ParseLinkerOutput (error.ToString (), cr);
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:53,代码来源:GNUCompiler.cs

示例15: PrecompileHeaders

		private void PrecompileHeaders (ProjectFileCollection projectFiles,
		                                CProjectConfiguration configuration,
		                                string args)
		{
			foreach (ProjectFile file in projectFiles) {
				if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) {
					string precomp = Path.Combine (configuration.SourceDirectory, ".prec");
					precomp = Path.Combine (precomp, configuration.Name);
					precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc");
					
					if (!File.Exists (precomp)) {
						DoPrecompileHeader (file, precomp, args);
						continue;
					}
					
					if (configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) {
						DoPrecompileHeader (file, precomp, args);
					}
				}
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:21,代码来源:GNUCompiler.cs


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