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


C# SolutionItem.GetExecutionTargets方法代码示例

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


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

示例1: Load

		/// <summary>
		/// Load configuration information for a solution
		/// </summary>
		public void Load (Solution sol, SolutionItem project, SolutionItemRunConfiguration runConfig)
		{
			currentSolutionConfigurations.Clear ();
			currentTargetPartitions.Clear ();
			reducedConfigurations.Clear ();

			if (sol == null)
				return;

			// Create a set of configuration partitions. Each partition will contain configurations
			// which are implicitly selected when selecting an execution target. For example, in
			// an iOS project we would have two partitions: 
			//   1) Debug|IPhoneSimulator, Release|IPhoneSimulator
			//      targets: iPhone, iPad
			//   2) Debug|IPhone, Release|IPhone
			//      targets: device

			List<TargetPartition> partitions = new List<TargetPartition> ();
			if (project != null) {
				foreach (var conf in project.Configurations) {
					var targets = project.GetExecutionTargets (conf.Selector, runConfig);
					if (!targets.Any ()) {
						targets = new ExecutionTarget[] { dummyExecutionTarget };
					}
					var parts = partitions.Where (p => targets.Any (p.Targets.Contains)).ToArray();
					if (parts.Length == 0) {
						// Create a new partition for this configuration
						var p = new TargetPartition ();
						p.Configurations.Add (conf.Id);
						p.Targets.UnionWith (targets);
						partitions.Add (p);
					}
					else if (parts.Length == 1) {
						// Register the configuration into an existing partition
						parts[0].Configurations.Add (conf.Id);
						parts[0].Targets.UnionWith (targets);
					}
					else {
						// The partitions have to be merged into a single one
						for (int n=1; n<parts.Length; n++) {
							parts[0].Configurations.UnionWith (parts[n].Configurations);
							parts[0].Targets.UnionWith (parts[n].Targets);
							partitions.Remove (parts[n]);
						}
					}
				}

				// The startup project configuration partitions are used to create solution configuration partitions

				foreach (var solConf in sol.Configurations) {
					var pconf = solConf.GetEntryForItem (project);
					if (pconf != null && pconf.Build) {
						var part = partitions.FirstOrDefault (p => p.Configurations.Contains (pconf.ItemConfiguration));
						if (part != null) {
							part.SolutionConfigurations.Add (solConf.Id);
							continue;
						}
					}
					// The solution configuration is not bound to the startup project
					// Add it to all partitions so that it can still take part of
					// the solution configuration simplification process
					foreach (var p in partitions)
						p.SolutionConfigurations.Add (solConf.Id);
				}
			}

			if (partitions.Count == 0) {
				// There is no startup project, just use all solution configurations in this case
				var p = new TargetPartition ();
				p.SolutionConfigurations.AddRange (sol.GetConfigurations ());
				partitions.Add (p);
			}

			// There can be several configurations with the same prefix and different platform but which build the same projects.
			// If all configurations with the same prefix are identical, all of them can be reduced into a single configuration
			// with no platform name. This loop detects such configurations

			var notReducibleConfigurations = new HashSet<string> ();

			foreach (var p in partitions) {
				var groupedConfigs = p.SolutionConfigurations.GroupBy (sc => {
					string name, plat;
					ItemConfiguration.ParseConfigurationId (sc, out name, out plat);
					return name;
				}).ToArray ();
				foreach (var confGroup in groupedConfigs) {
					var configs = confGroup.ToArray ();
					var baseConf = sol.Configurations[configs[0]];
					if (configs.Skip (1).All (c => ConfigurationEquals (sol, baseConf, sol.Configurations[c])))
						p.ReducedConfigurations.Add (confGroup.Key);
					else
						notReducibleConfigurations.Add (confGroup.Key);
				}
			}

			// To really be able to use reduced configuration names, all partitions must have that reduced configuration
			// Find the configurations that have been reduced in all partitions
//.........这里部分代码省略.........
开发者ID:kdubau,项目名称:monodevelop,代码行数:101,代码来源:ConfigurationMerger.cs

示例2: GenerateExecutionModeCommands

		public static void GenerateExecutionModeCommands (SolutionItem project, CanExecuteDelegate runCheckDelegate, CommandArrayInfo info)
		{
			CommandExecutionContext ctx = new CommandExecutionContext (project, runCheckDelegate);
			bool supportsParameterization = false;
			
			foreach (List<IExecutionMode> modes in GetExecutionModeCommands (ctx, false, true)) {
				foreach (IExecutionMode mode in modes) {
					CommandInfo ci = info.Add (mode.Name, new CommandItem (ctx, mode));
					if ((mode.ExecutionHandler is ParameterizedExecutionHandler) || ((mode is CustomExecutionMode) && ((CustomExecutionMode)mode).PromptForParameters)) {
						// It will prompt parameters, so we need command to end with '..'.
						// However, some commands may end with '...' already and we don't want to break 
						// already-translated strings by altering them
						if (!ci.Text.EndsWith ("...")) 
							ci.Text += "...";
						supportsParameterization = true;
					} else {
						// The parameters window will be shown if ctrl is pressed
						ci.Description = GettextCatalog.GetString ("Run With: {0}", ci.Text);
						if (SupportsParameterization (mode, ctx)) {
							ci.Description += " - " + GettextCatalog.GetString ("Hold Control key to display the execution parameters dialog.");
							supportsParameterization = true;
						}
					}
				}
				if (info.Count > 0)
					info.AddSeparator ();
			}

			var targets = new List<ExecutionTarget> ();
			if (project != null)
				FlattenExecutionTargets (targets, project.GetExecutionTargets (IdeApp.Workspace.ActiveConfiguration));

			if (targets.Count > 1) {
				foreach (var t in targets) {
					var h = new TargetedExecutionHandler (Runtime.ProcessService.DefaultExecutionHandler, t);
					CommandInfo ci = info.Add (t.FullName, new CommandItem (ctx, new ExecutionMode (t.Id, t.FullName, h)));
					ci.Description = GettextCatalog.GetString ("Run With: {0}", ci.Text);
				}
				info.AddSeparator ();
			}

			if (supportsParameterization) {
				info.AddSeparator ();
				info.Add (GettextCatalog.GetString ("Edit Custom Modes..."), new CommandItem (ctx, null));
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:46,代码来源:ExecutionModeCommandService.cs


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