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


C# FileProjectItem.GetEvaluatedMetadata方法代码示例

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


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

示例1: GenerateCode

		public void GenerateCode(FileProjectItem item, CustomToolContext context)
		{
			XmlDocument doc = new XmlDocument();
			doc.Load(item.FileName);
			SettingsDocument setDoc = new SettingsDocument(doc.DocumentElement, DummySettingsEntryHost.Instance);
			string customToolNamespace = item.GetEvaluatedMetadata("CustomToolNamespace");
			if (!string.IsNullOrEmpty(customToolNamespace)) {
				setDoc.GeneratedClassNamespace = customToolNamespace;
			}
			
			CodeCompileUnit ccu = new CodeCompileUnit();
			ccu.AddNamespace(setDoc.GeneratedClassNamespace).Types.Add(CreateClass(setDoc));
			context.WriteCodeDomToFile(item, context.GetOutputFileName(item, ".Designer"), ccu);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:14,代码来源:SettingsCodeGeneratorTool.cs

示例2: RunCustomTool

		/// <summary>
		/// Runs the specified custom tool on the base item.
		/// </summary>
		public static void RunCustomTool(FileProjectItem baseItem, ICustomTool customTool, bool showMessageBoxOnErrors)
		{
			if (baseItem == null)
				throw new ArgumentNullException("baseItem");
			if (customTool == null)
				throw new ArgumentNullException("customTool");
			WorkbenchSingleton.AssertMainThread();
			
			string fileName = baseItem.FileName;
			if (toolRuns.Any(run => FileUtility.IsEqualFileName(run.file, fileName)))
			{
				// file already in queue, do not enqueue it again
				return;
			}
			CustomToolContext context = new CustomToolContext(baseItem.Project);
			context.OutputNamespace = baseItem.GetEvaluatedMetadata("CustomToolNamespace");
			if (string.IsNullOrEmpty(context.OutputNamespace)) {
				context.OutputNamespace = GetDefaultNamespace(baseItem.Project, baseItem.FileName);
			}
			RunCustomTool(new CustomToolRun(context, fileName, baseItem, customTool, showMessageBoxOnErrors));
		}
开发者ID:siegfriedpammer,项目名称:SharpDevelop,代码行数:24,代码来源:CustomTool.cs

示例3: EnsureOutputFileIsInProject

		public FileProjectItem EnsureOutputFileIsInProject(FileProjectItem baseItem, string outputFileName, bool isPrimaryOutput)
		{
			if (baseItem == null)
				throw new ArgumentNullException("baseItem");
			if (baseItem.Project != project)
				throw new ArgumentException("baseItem is not from project this CustomToolContext belongs to");
			
			WorkbenchSingleton.AssertMainThread();
			bool saveProject = false;
			if (isPrimaryOutput) {
				if (baseItem.GetEvaluatedMetadata("LastGenOutput") != Path.GetFileName(outputFileName)) {
					saveProject = true;
					baseItem.SetEvaluatedMetadata("LastGenOutput", Path.GetFileName(outputFileName));
				}
			}
			FileProjectItem outputItem = project.FindFile(outputFileName);
			if (outputItem == null) {
				outputItem = new FileProjectItem(project, ItemType.Compile);
				outputItem.FileName = outputFileName;
				outputItem.DependentUpon = Path.GetFileName(baseItem.FileName);
				outputItem.SetEvaluatedMetadata("AutoGen", "True");
				ProjectService.AddProjectItem(project, outputItem);
				FileService.FireFileCreated(outputFileName, false);
				saveProject = true;
				ProjectBrowserPad.RefreshViewAsync();
			}
			if (saveProject)
				project.Save();
			return outputItem;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:30,代码来源:CustomTool.cs

示例4: GetOutputFileName

		public string GetOutputFileName(FileProjectItem baseItem, string additionalExtension, bool isPrimaryOutput)
		{
			if (baseItem == null)
				throw new ArgumentNullException("baseItem");
			if (baseItem.Project != project)
				throw new ArgumentException("baseItem is not from project this CustomToolContext belongs to");
			
			if (isPrimaryOutput) {
				string lastGenOutput = baseItem.GetEvaluatedMetadata("LastGenOutput");
				if (!string.IsNullOrEmpty(lastGenOutput)) {
					return Path.Combine(Path.GetDirectoryName(baseItem.FileName), lastGenOutput);
				}
			}
			
			string newExtension = null;
			if (project.LanguageProperties.CodeDomProvider != null) {
				newExtension = project.LanguageProperties.CodeDomProvider.FileExtension;
			}
			if (string.IsNullOrEmpty(newExtension)) {
				if (string.IsNullOrEmpty(additionalExtension)) {
					newExtension = ".unknown";
				} else {
					newExtension = additionalExtension;
					additionalExtension = "";
				}
			}
			if (!newExtension.StartsWith(".")) {
				newExtension = "." + newExtension;
			}
			
			string newFileName = Path.ChangeExtension(baseItem.FileName, additionalExtension + newExtension);
			int retryIndex = 0;
			while (true) {
				FileProjectItem item = project.FindFile(newFileName);
				// If the file does not exist in the project, we can use that name.
				if (item == null)
					return newFileName;
				// If the file already exists in the project, use it only if it belongs to our base item
				if (string.Equals(item.DependentUpon, Path.GetFileName(baseItem.FileName), StringComparison.OrdinalIgnoreCase))
					return newFileName;
				// Otherwise, find another free file name
				retryIndex++;
				newFileName = Path.ChangeExtension(baseItem.FileName, additionalExtension + retryIndex + newExtension);
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:45,代码来源:CustomTool.cs


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