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


C# DotNetProject.CopySupportFiles方法代码示例

本文整理汇总了C#中MonoDevelop.Projects.DotNetProject.CopySupportFiles方法的典型用法代码示例。如果您正苦于以下问题:C# DotNetProject.CopySupportFiles方法的具体用法?C# DotNetProject.CopySupportFiles怎么用?C# DotNetProject.CopySupportFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoDevelop.Projects.DotNetProject的用法示例。


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

示例1: GenerateSteticCode

		public static Stetic.CodeGenerationResult GenerateSteticCode (IProgressMonitor monitor, DotNetProject project, ConfigurationSelector configuration)
		{
			if (generating || !GtkDesignInfo.HasDesignedObjects (project))
				return null;
			
			using (var timer = Counters.SteticFileGeneratedTimer.BeginTiming ()) {
				
				timer.Trace ("Checking references");
				GtkDesignInfo info = GtkDesignInfo.FromProject (project);
	
				DateTime last_gen_time = File.Exists (info.SteticGeneratedFile) ? File.GetLastWriteTime (info.SteticGeneratedFile) : DateTime.MinValue;
				
				bool ref_changed = false;
				foreach (ProjectReference pref in project.References) {
					if (!pref.IsValid)
						continue;
					foreach (string filename in pref.GetReferencedFileNames (configuration)) {
						if (File.GetLastWriteTime (filename) > last_gen_time) {
							ref_changed = true;
							break;
						}
					}
					if (ref_changed)
						break;
				}
	
				// Check if generated code is already up to date.
				if (!ref_changed && last_gen_time >= File.GetLastWriteTime (info.SteticFile))
					return null;
				
				if (info.GuiBuilderProject.HasError) {
					monitor.ReportError (GettextCatalog.GetString ("GUI code generation failed for project '{0}'. The file '{1}' could not be loaded.", project.Name, info.SteticFile), null);
					monitor.AsyncOperation.Cancel ();
					return null;
				}
				
				if (info.GuiBuilderProject.IsEmpty) 
					return null;
	
				monitor.Log.WriteLine (GettextCatalog.GetString ("Generating GUI code for project '{0}'...", project.Name));
				
				timer.Trace ("Copy support files");
				
				// Make sure the referenced assemblies are up to date. It is necessary to do
				// it now since they may contain widget libraries.
				project.CopySupportFiles (monitor, configuration);
				
				timer.Trace ("Update libraries");
				
				info.GuiBuilderProject.UpdateLibraries ();
				
				ArrayList projects = new ArrayList ();
				projects.Add (info.GuiBuilderProject.File);
				
				generating = true;
				Stetic.CodeGenerationResult generationResult = null;
				Exception generatedException = null;
				
				bool canGenerateInProcess = IsolationMode != Stetic.IsolationMode.None || info.GuiBuilderProject.SteticProject.CanGenerateCode;
				
				if (!canGenerateInProcess) {
					timer.Trace ("Generating out of process");
				
					// Run the generation in another thread to avoid freezing the GUI
					System.Threading.ThreadPool.QueueUserWorkItem (delegate {
						try {
							// Generate the code in another process if stetic is not isolated
							CodeGeneratorProcess cob = (CodeGeneratorProcess)Runtime.ProcessService.CreateExternalProcessObject (typeof(CodeGeneratorProcess), false);
							using (cob) {
								generationResult = cob.GenerateCode (projects, info.GenerateGettext, info.GettextClass, project.UsePartialTypes);
							}
						} catch (Exception ex) {
							generatedException = ex;
						} finally {
							generating = false;
						}
					});
				
					while (generating) {
						DispatchService.RunPendingEvents ();
						System.Threading.Thread.Sleep (100);
					}
				} else {
					timer.Trace ("Generating in-process");
					// No need to create another process, since stetic has its own backend process
					// or the widget libraries have no custom wrappers
					try {
						Stetic.GenerationOptions options = new Stetic.GenerationOptions ();
						options.UseGettext = info.GenerateGettext;
						options.GettextClass = info.GettextClass;
						options.UsePartialClasses = project.UsePartialTypes;
						options.GenerateSingleFile = false;
						generationResult = SteticApp.GenerateProjectCode (options, info.GuiBuilderProject.SteticProject);
					} catch (Exception ex) {
						generatedException = ex;
					}
					generating = false;
				}
				timer.Trace ("Writing code units");
				
//.........这里部分代码省略.........
开发者ID:Poiros,项目名称:monodevelop,代码行数:101,代码来源:GuiBuilderService.cs


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