/// <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"); } SD.MainThread.VerifyAccess(); 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)); }
/// <summary> /// Runs the custom tool specified by the base items' CustomTool property on the base item. /// </summary> public static void RunCustomTool(FileProjectItem baseItem, bool showMessageBoxOnErrors) { if (baseItem == null) { throw new ArgumentNullException("baseItem"); } if (string.IsNullOrEmpty(baseItem.CustomTool)) { return; } ICustomTool customTool = GetCustomTool(baseItem.CustomTool); if (customTool == null) { string message = "Cannot find custom tool '" + baseItem.CustomTool + "'."; if (!baseItem.CustomTool.StartsWith("MSBuild:")) { CustomToolContext.StaticMessageView.AppendLine(message); } if (showMessageBoxOnErrors) { MessageService.ShowError(message); } } else { RunCustomTool(baseItem, customTool, showMessageBoxOnErrors); } }
/// <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.Exists(delegate(CustomToolRun run) { return(FileUtility.IsEqualFileName(run.file, fileName)); })) { // file already in queue, do not enqueue it again return; } CustomToolContext context = new CustomToolContext(baseItem.Project); if (string.IsNullOrEmpty(baseItem.CustomToolNamespace)) { context.OutputNamespace = GetDefaultNamespace(baseItem.Project, baseItem.FileName); } else { context.OutputNamespace = baseItem.CustomToolNamespace; } RunCustomTool(new CustomToolRun(context, fileName, baseItem, customTool, showMessageBoxOnErrors)); }
public CustomToolRun(CustomToolContext context, string file, FileProjectItem baseItem, ICustomTool customTool, bool showMessageBoxOnErrors) { this.context = context; this.file = file; this.baseItem = baseItem; this.customTool = customTool; this.showMessageBoxOnErrors = showMessageBoxOnErrors; }
/// <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)); }