protected override string SubstitutePlaceholders(string s) { return(StringParserService.Parse(s, tags)); }
public override async Task <bool> AddToProjectAsync(SolutionFolderItem policyParent, Project project, string language, string directory, string name) { if (!GtkDesignInfo.SupportsDesigner(project)) { ReferenceManager mgr = new ReferenceManager(project as DotNetProject); mgr.GtkPackageVersion = mgr.DefaultGtkVersion; mgr.Dispose(); } GtkDesignInfo info = GtkDesignInfo.FromProject((DotNetProject)project); GuiBuilderProject gproject = info.GuiBuilderProject; string fileName = fileTemplate.GetFileName(policyParent, project, language, directory, name); await fileTemplate.AddToProjectAsync(policyParent, project, language, directory, name); DotNetProject netProject = project as DotNetProject; string ns = netProject != null?netProject.GetDefaultNamespace(fileName) : ""; string cname = Path.GetFileNameWithoutExtension(fileName); string fullName = ns.Length > 0 ? ns + "." + cname : cname; string[,] tags = { { "Name", cname }, { "Namespace", ns }, { "FullName", fullName } }; XmlElement widgetElem = steticTemplate ["widget"]; if (widgetElem != null) { string content = widgetElem.OuterXml; content = StringParserService.Parse(content, tags); XmlDocument doc = new XmlDocument(); doc.LoadXml(content); gproject.AddNewComponent(doc.DocumentElement); gproject.SaveAll(false); IdeApp.ProjectOperations.SaveAsync(project).Ignore(); return(true); } widgetElem = steticTemplate ["action-group"]; if (widgetElem != null) { string content = widgetElem.OuterXml; content = StringParserService.Parse(content, tags); XmlDocument doc = new XmlDocument(); doc.LoadXml(content); gproject.SteticProject.AddNewActionGroup(doc.DocumentElement); gproject.SaveAll(false); IdeApp.ProjectOperations.SaveAsync(project).Ignore(); return(true); } throw new InvalidOperationException("<widget> or <action-group> element not found in widget template."); }
protected override string GenerateCommandLineCommands() { var args = new CommandLineArgumentBuilder(); List <string> unescapedArgs = new List <string> (); TargetArchitecture architectures; bool msym; if (string.IsNullOrEmpty(Architectures) || !Enum.TryParse(Architectures, out architectures)) { architectures = TargetArchitecture.Default; } if (architectures == TargetArchitecture.ARMv6) { Log.LogError("Target architecture ARMv6 is no longer supported in Xamarin.iOS. Please select a supported architecture."); return(null); } if (!string.IsNullOrEmpty(IntermediateOutputPath)) { Directory.CreateDirectory(IntermediateOutputPath); args.AddQuotedLine($"--cache={Path.GetFullPath (IntermediateOutputPath)}"); } args.AddQuotedLine((SdkIsSimulator ? "--sim=" : "--dev=") + Path.GetFullPath(AppBundleDir)); if (AppleSdkSettings.XcodeVersion.Major >= 5 && IPhoneSdks.MonoTouch.Version.CompareTo(new IPhoneSdkVersion(6, 3, 7)) < 0) { args.AddLine("--compiler=clang"); } args.AddQuotedLine($"--executable={ExecutableName}"); if (IsAppExtension) { args.AddLine("--extension"); } if (Debug) { if (FastDev && !SdkIsSimulator) { args.AddLine("--fastdev"); } args.AddLine("--debug"); } if (Profiling) { args.AddLine("--profiling"); } if (LinkerDumpDependencies) { args.AddLine("--linkerdumpdependencies"); } if (EnableSGenConc) { args.AddLine("--sgen-conc"); } if (!string.IsNullOrEmpty(Interpreter)) { args.AddLine($"--interpreter={Interpreter}"); } switch (LinkMode.ToLowerInvariant()) { case "sdkonly": args.AddLine("--linksdkonly"); break; case "none": args.AddLine("--nolink"); break; } if (!string.IsNullOrEmpty(I18n)) { args.AddQuotedLine($"--i18n={I18n}"); } args.AddQuotedLine($"--sdkroot={SdkRoot}"); args.AddQuotedLine($"--sdk={SdkVersion}"); if (!minimumOSVersion.IsUseDefault) { args.AddQuotedLine($"--targetver={minimumOSVersion.ToString ()}"); } if (UseFloat32 /* We want to compile 32-bit floating point code to use 32-bit floating point operations */) { args.AddLine("--aot-options=-O=float32"); } else { args.AddLine("--aot-options=-O=-float32"); } if (!EnableGenericValueTypeSharing) { args.AddLine("--gsharedvt=false"); } if (LinkDescriptions != null) { foreach (var desc in LinkDescriptions) { args.AddQuotedLine($"--xml={desc.ItemSpec}"); } } if (EnableBitcode) { switch (Framework) { case PlatformFramework.WatchOS: args.AddLine("--bitcode=full"); break; case PlatformFramework.TVOS: args.AddLine("--bitcode=asmonly"); break; default: throw new InvalidOperationException(string.Format("Bitcode is currently not supported on {0}.", Framework)); } } if (!string.IsNullOrEmpty(HttpClientHandler)) { args.AddLine($"--http-message-handler={HttpClientHandler}"); } string thumb = UseThumb && UseLlvm ? "+thumb2" : ""; string llvm = UseLlvm ? "+llvm" : ""; string abi = ""; if (SdkIsSimulator) { if (architectures.HasFlag(TargetArchitecture.i386)) { abi += (abi.Length > 0 ? "," : "") + "i386"; } if (architectures.HasFlag(TargetArchitecture.x86_64)) { abi += (abi.Length > 0 ? "," : "") + "x86_64"; } if (string.IsNullOrEmpty(abi)) { architectures = TargetArchitecture.i386; abi = "i386"; } } else { if (architectures == TargetArchitecture.Default) { architectures = TargetArchitecture.ARMv7; } if (architectures.HasFlag(TargetArchitecture.ARMv7)) { abi += (abi.Length > 0 ? "," : "") + "armv7" + llvm + thumb; } if (architectures.HasFlag(TargetArchitecture.ARMv7s)) { abi += (abi.Length > 0 ? "," : "") + "armv7s" + llvm + thumb; } if (architectures.HasFlag(TargetArchitecture.ARM64)) { // Note: ARM64 does not have thumb. abi += (abi.Length > 0 ? "," : "") + "arm64" + llvm; } if (architectures.HasFlag(TargetArchitecture.ARMv7k)) { abi += (abi.Length > 0 ? "," : "") + "armv7k" + llvm; } if (string.IsNullOrEmpty(abi)) { abi = "armv7" + llvm + thumb; } } // Output the CompiledArchitectures CompiledArchitectures = architectures.ToString(); args.AddLine($"--abi={abi}"); // output symbols to preserve when stripping args.AddQuotedLine($"--symbollist={Path.GetFullPath (SymbolsList)}"); // don't have mtouch generate the dsyms... args.AddLine("--dsym=no"); if (!string.IsNullOrEmpty(ArchiveSymbols) && bool.TryParse(ArchiveSymbols.Trim(), out msym)) { args.AddLine($"--msym={(msym ? "yes" : "no")}"); } var gcc = new GccOptions(); if (!string.IsNullOrEmpty(ExtraArgs)) { var extraArgs = CommandLineArgumentBuilder.Parse(ExtraArgs); var target = MainAssembly.ItemSpec; string projectDir; if (ProjectDir.StartsWith("~/", StringComparison.Ordinal)) { // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host, // it simply uses paths relative to "~/". Expand these paths to their full path equivalents. var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); projectDir = Path.Combine(home, ProjectDir.Substring(2)); } else { projectDir = ProjectDir; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "projectdir", projectDir }, // Apparently msbuild doesn't propagate the solution path, so we can't get it. // { "solutiondir", proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory }, { "appbundledir", AppBundleDir }, { "targetpath", Path.Combine(Path.GetDirectoryName(target), Path.GetFileName(target)) }, { "targetdir", Path.GetDirectoryName(target) }, { "targetname", Path.GetFileName(target) }, { "targetext", Path.GetExtension(target) }, }; for (int i = 0; i < extraArgs.Length; i++) { var argument = extraArgs[i]; int startIndex = 0; while (argument.Length > startIndex && argument[startIndex] == '-') { startIndex++; } int endIndex = startIndex; while (endIndex < argument.Length && argument[endIndex] != '=') { endIndex++; } int length = endIndex - startIndex; if (length == 9 && string.CompareOrdinal(argument, startIndex, "gcc_flags", 0, 9) == 0) { // user-defined -gcc_flags argument string flags = null; if (endIndex < extraArgs[i].Length) { flags = Unquote(argument, endIndex + 1); } else if (i + 1 < extraArgs.Length) { flags = extraArgs[++i]; } if (!string.IsNullOrEmpty(flags)) { var gccArgs = CommandLineArgumentBuilder.Parse(flags); for (int j = 0; j < gccArgs.Length; j++) { gcc.Arguments.Add(StringParserService.Parse(gccArgs[j], customTags)); } } } else { // other user-defined mtouch arguments unescapedArgs.Add(StringParserService.Parse(argument, customTags)); } } } BuildNativeReferenceFlags(gcc); BuildEntitlementFlags(gcc); foreach (var framework in gcc.Frameworks) { args.AddQuotedLine($"--framework={framework}"); } foreach (var framework in gcc.WeakFrameworks) { args.AddQuotedLine($"--weak-framework={framework}"); } if (gcc.Cxx) { args.AddLine("--cxx"); } if (gcc.Arguments.Length > 0) { unescapedArgs.Add($"--gcc_flags={gcc.Arguments.ToString ()}"); } foreach (var asm in References) { if (IsFrameworkItem(asm)) { args.AddQuotedLine($"-r={ResolveFrameworkFile (asm.ItemSpec)}"); } else { args.AddQuotedLine($"-r={Path.GetFullPath (asm.ItemSpec)}"); } } foreach (var ext in AppExtensionReferences) { args.AddQuotedLine($"--app-extension={Path.GetFullPath (ext.ItemSpec)}"); } args.AddLine($"--target-framework={TargetFrameworkIdentifier},{TargetFrameworkVersion}"); args.AddQuotedLine($"--root-assembly={Path.GetFullPath (MainAssembly.ItemSpec)}"); // We give the priority to the ExtraArgs to set the mtouch verbosity. if (string.IsNullOrEmpty(ExtraArgs) || (!string.IsNullOrEmpty(ExtraArgs) && !ExtraArgs.Contains("-q") && !ExtraArgs.Contains("-v"))) { args.AddLine(GetVerbosityLevel(Verbosity)); } if (!string.IsNullOrWhiteSpace(License)) { args.AddLine($"--license={License}"); } // Generate a response file var responseFile = Path.GetFullPath(ResponseFilePath); if (File.Exists(responseFile)) { File.Delete(responseFile); } try { using (var fs = File.Create(responseFile)) { using (var writer = new StreamWriter(fs)) writer.Write(args); } } catch (Exception ex) { Log.LogWarning("Failed to create response file '{0}': {1}", responseFile, ex); } // Some arguments can not safely go in the response file and are // added separately. They must go _after_ the response file // as they may override options passed in the response file var actualArgs = new CommandLineArgumentBuilder(); actualArgs.AddQuoted($"@{responseFile}"); foreach (var arg in unescapedArgs) { actualArgs.AddQuoted(arg); } return(actualArgs.ToString()); }
protected virtual string SubstitutePlaceholders(string value) { return(StringParserService.Parse(value)); }
// icon view event handlers void SelectedIndexChange(object sender, EventArgs e) { try { btn_new.Sensitive = true; txt_name.Sensitive = true; txt_subdirectory.Sensitive = true; chk_combine_directory.Sensitive = true; entry_location.Sensitive = true; if (templateView.CurrentlySelected != null) { ProjectTemplate ptemplate = (ProjectTemplate)templateView.CurrentlySelected; lbl_template_descr.Text = StringParserService.Parse(ptemplate.Description); labelTemplateTitle.Markup = "<b>" + GLib.Markup.EscapeText(ptemplate.Name) + "</b>"; if (ptemplate.SolutionDescriptor.EntryDescriptors.Length == 0) { txt_subdirectory.Sensitive = false; chk_combine_directory.Sensitive = false; lbl_subdirectory.Sensitive = false; btn_new.Label = Gtk.Stock.Ok; } else { lbl_subdirectory.Sensitive = true; txt_subdirectory.Text = txt_name.Text; ProjectCreateInformation cinfo = CreateProjectCreateInformation(); if (ptemplate.HasItemFeatures(parentFolder, cinfo)) { btn_new.Label = Gtk.Stock.GoForward; } else { btn_new.Label = Gtk.Stock.Ok; } } } else { lbl_template_descr.Text = String.Empty; labelTemplateTitle.Text = ""; } PathChanged(null, null); } catch (Exception ex) { txt_name.Sensitive = false; btn_new.Sensitive = false; txt_subdirectory.Sensitive = false; chk_combine_directory.Sensitive = false; entry_location.Sensitive = false; while (ex is TargetInvocationException) { ex = ((TargetInvocationException)ex).InnerException; } if (ex is UserException) { var user = (UserException)ex; MessageService.ShowError(user.Message, user.Details); } else { MessageService.ShowException(ex); }; } }
public override object CreateInstance() { ActionType ct = ActionType.Normal; bool isArray = false; bool custom = false; bool isAction = false; foreach (string p in type.Split('|')) { switch (p) { case "check": ct = ActionType.Check; if (isAction) { throw new InvalidOperationException("Action type specified twice."); } isAction = true; break; case "radio": ct = ActionType.Radio; if (isAction) { throw new InvalidOperationException("Action type specified twice."); } isAction = true; break; case "normal": ct = ActionType.Normal; if (isAction) { throw new InvalidOperationException("Action type specified twice."); } isAction = true; break; case "custom": if (widget == null) { throw new InvalidOperationException("Widget type not specified in custom command."); } custom = true; break; case "array": isArray = true; break; default: throw new InvalidOperationException("Unknown command type: " + p); } } if (isAction && custom) { throw new InvalidOperationException("Invalid command type combination: " + type); } Command cmd; if (custom) { if (isArray) { throw new InvalidOperationException("Array custom commands are not allowed."); } CustomCommand ccmd = new CustomCommand(); ccmd.Text = label; ccmd.WidgetType = Addin.GetType(widget); if (ccmd.WidgetType == null) { throw new InvalidOperationException("Could not find command type '" + widget + "'."); } cmd = ccmd; } else { if (widget != null) { throw new InvalidOperationException("Widget type can only be specified for custom commands."); } ActionCommand acmd = new ActionCommand(); acmd.ActionType = ct; acmd.CommandArray = isArray; if (defaultHandler != null) { acmd.SetDefaultHandlerTypeInfo(Addin, defaultHandler); } cmd = acmd; } cmd.Id = ParseCommandId(this); cmd.Text = StringParserService.Parse(BrandingService.BrandApplicationName(label)); if (!String.IsNullOrWhiteSpace(_displayName)) { cmd.DisplayName = StringParserService.Parse(BrandingService.BrandApplicationName(_displayName)); } if ((_description != null) && (_description.Length > 0)) { cmd.Description = BrandingService.BrandApplicationName(_description); } cmd.Description = cmd.Description; if (icon != null) { cmd.Icon = GetStockId(Addin, icon); } var keyBinding = Platform.IsMac ? macShortcut : shortcut; if (Platform.IsWindows && !string.IsNullOrEmpty(winShortcut)) { keyBinding = winShortcut; } string[] splittedKeys = (keyBinding ?? "").Split(' '); cmd.AccelKey = KeyBindingManager.FixChordSeparators(KeyBindingManager.CanonicalizeBinding(splittedKeys[0])); if (splittedKeys.Length > 1) { cmd.AlternateAccelKeys = splittedKeys.Skip(1).Select(key => KeyBindingManager.FixChordSeparators(key)).ToArray(); } cmd.DisabledVisible = disabledVisible; // Assign the category of the command CommandCategoryCodon cat = Parent as CommandCategoryCodon; if (cat != null) { cmd.Category = cat.Name; } return(cmd); }
protected override string ResolveAssemblyReference(string assemblyReference) { assemblyReference = StringParserService.Parse(assemblyReference, IdeApp.Workbench.GetStringTagModel()); return(base.ResolveAssemblyReference(assemblyReference)); }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { SdMenuCommand newItem = null; StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); object o = null; if (Class != null) { o = AddIn.CreateObject(Class); //说明当前菜单项是没有子菜单项�?即它有自己的功能,其功能由Class类具体实�?这种菜单项也是最常见�? } if (o != null) { if (o is ISubmenuBuilder) { return(((ISubmenuBuilder)o).BuildSubmenu(owner)); } if (o is IMenuCommand) { newItem = new SdMenuCommand(stringParserService.Parse(Label), new EventHandler(new MenuEventHandler(owner, (IMenuCommand)o).Execute)); if (beginGroup == "true") { newItem.BeginGroup = true; } } } if (newItem == null) { //说明当前菜单项既不是Link类型�?也没有指出其Class属�?所以有可能是一个包含子菜单的菜单项. newItem = new SdMenuCommand(stringParserService.Parse(Label)); if (subItems != null && subItems.Count > 0) { //判断是否有子菜单�? foreach (object item in subItems) { if (item is ButtonItem) { //添加一个子菜单�? newItem.SubItems.Add((ButtonItem)item); } else { //添加一组子菜单�? newItem.SubItems.AddRange((ButtonItem[])item); } } } } Debug.Assert(newItem != null); //到这里为�?newItem即当前菜单项不应该为空了. if (Icon != null) { //为菜单设置Icon. ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService)); newItem.Image = ResourceService.GetBitmap(Icon); } newItem.Description = description; newItem.MouseEnter += new EventHandler(newItem_MouseEnter); newItem.MouseLeave += new EventHandler(newItem_MouseLeave); if (Shortcut != null) { //为菜单设置Shortcut. try { newItem.Shortcuts.Add((eShortcut)Enum.Parse(eShortcut.F1.GetType(), Shortcut)); } catch (Exception) { } } return(newItem); //最后返回当前菜单项. }
public virtual void ReLoad() { this.DropDownItems.Clear(); switch (_recentType) { case "file": { RecentFileInfo[] recentFiles = Service.RecentFiles.GetFiles(Service.RecentFiles.RecentOpenFiles); if (recentFiles.Length == 0) { ToolStripMenuItem item = new ToolStripMenuItem( StringParserService.Parse("${res:SimplusD.mainMenu.hasNotRecentFile}")); item.Enabled = false; this.DropDownItems.Add(item); } else { foreach (RecentFileInfo recent in recentFiles) { ToolStripMenuItem item = new ToolStripMenuItem(recent.FilePath); this.DropDownItems.Add(item); } } break; } case "project": { RecentFileInfo[] recentFiles = Service.RecentFiles.GetFiles(Service.RecentFiles.RecentOpenProjects); EventHandler clickHandler = delegate(object sender, EventArgs e) { ///打开项目 string filePath = (string)((ToolStripMenuItem)sender).Tag; if (File.Exists(filePath)) { Service.Project.OpenProject(filePath); } else { if (MessageService.Show("${res:SimplusD.mainMenu.deleteNotExistsFileTip}", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Service.RecentFiles.DeleteFilePath(Service.RecentFiles.RecentOpenProjects, filePath); } } }; if (recentFiles.Length == 0) { ///没有最近的记录,则显示为:空 ToolStripMenuItem item = new ToolStripMenuItem( StringParserService.Parse("${res:SimplusD.mainMenu.hasNotRecentProject}")); item.Enabled = false; this.DropDownItems.Add(item); } else { foreach (RecentFileInfo recent in recentFiles) { ToolStripMenuItem item = new ToolStripMenuItem(recent.FilePath); item.Tag = recent.FilePath; item.Click += clickHandler; this.DropDownItems.Add(item); } ///添加间隔符 ToolStripSeparator separator = new ToolStripSeparator(); this.DropDownItems.Add(separator); ///清空记录的选项 ToolStripMenuItem itemClear = new ToolStripMenuItem( StringParserService.Parse("${res:SimplusD.mainMenu.clearRecentProject}")); itemClear.Click += delegate { if (MessageService.Show("${res:SimplusD.mainMenu.clearTip}", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Service.RecentFiles.ClearFilePath(Service.RecentFiles.RecentOpenProjects); } }; this.DropDownItems.Add(itemClear); } break; } default: throw new Exception(); } }
//设置属性面板的名称,图标 by lisuye on 2008年5月27日 public PropertyPad() { this.Text = StringParserService.Parse("${res:Pad.Property.text}"); this.Icon = Icon.FromHandle(ResourceService.GetResourceImage("MainMenu.view.property").GetHicon()); }
protected override string GenerateCommandLineCommands() { var args = GenerateCommandLineArguments(); List <string> unescapedArgs = new List <string> (); TargetArchitecture architectures; if (string.IsNullOrEmpty(Architectures) || !Enum.TryParse(Architectures, out architectures)) { architectures = TargetArchitecture.Default; } if (architectures == TargetArchitecture.ARMv6) { Log.LogError(MSBStrings.E0053); return(null); } args.AddQuotedLine((SdkIsSimulator ? "--sim=" : "--dev=") + Path.GetFullPath(AppBundleDir)); args.AddQuotedLine($"--executable={ExecutableName}"); if (IsAppExtension) { args.AddLine("--extension"); } if (Debug) { if (FastDev && !SdkIsSimulator) { args.AddLine("--fastdev"); } } if (LinkerDumpDependencies) { args.AddLine("--linkerdumpdependencies"); } if (!string.IsNullOrEmpty(Interpreter)) { args.AddLine($"--interpreter={Interpreter}"); } switch (LinkMode.ToLowerInvariant()) { case "sdkonly": args.AddLine("--linksdkonly"); break; case "none": args.AddLine("--nolink"); break; } args.AddQuotedLine($"--sdk={SdkVersion}"); if (UseFloat32 /* We want to compile 32-bit floating point code to use 32-bit floating point operations */) { args.AddLine("--aot-options=-O=float32"); } else { args.AddLine("--aot-options=-O=-float32"); } if (LinkDescriptions != null) { foreach (var desc in LinkDescriptions) { args.AddQuotedLine($"--xml={desc.ItemSpec}"); } } if (EnableBitcode) { switch (Platform) { case ApplePlatform.WatchOS: args.AddLine("--bitcode=full"); break; case ApplePlatform.TVOS: args.AddLine("--bitcode=asmonly"); break; default: throw new InvalidOperationException(string.Format("Bitcode is currently not supported on {0}.", Platform)); } } string thumb = UseThumb && UseLlvm ? "+thumb2" : ""; string llvm = UseLlvm ? "+llvm" : ""; string abi = ""; if (SdkIsSimulator) { if (architectures.HasFlag(TargetArchitecture.i386)) { abi += (abi.Length > 0 ? "," : "") + "i386"; } if (architectures.HasFlag(TargetArchitecture.x86_64)) { abi += (abi.Length > 0 ? "," : "") + "x86_64"; } if (string.IsNullOrEmpty(abi)) { architectures = TargetArchitecture.i386; abi = "i386"; } } else { if (architectures == TargetArchitecture.Default) { architectures = TargetArchitecture.ARMv7; } if (architectures.HasFlag(TargetArchitecture.ARMv7)) { abi += (abi.Length > 0 ? "," : "") + "armv7" + llvm + thumb; } if (architectures.HasFlag(TargetArchitecture.ARMv7s)) { abi += (abi.Length > 0 ? "," : "") + "armv7s" + llvm + thumb; } if (architectures.HasFlag(TargetArchitecture.ARM64)) { // Note: ARM64 does not have thumb. abi += (abi.Length > 0 ? "," : "") + "arm64" + llvm; } if (architectures.HasFlag(TargetArchitecture.ARMv7k)) { abi += (abi.Length > 0 ? "," : "") + "armv7k" + llvm; } if (architectures.HasFlag(TargetArchitecture.ARM64_32)) { abi += (abi.Length > 0 ? "," : "") + "arm64_32" + llvm; } if (string.IsNullOrEmpty(abi)) { abi = "armv7" + llvm + thumb; } } // Output the CompiledArchitectures CompiledArchitectures = architectures.ToString(); args.AddLine($"--abi={abi}"); // output symbols to preserve when stripping args.AddQuotedLine($"--symbollist={Path.GetFullPath (SymbolsList)}"); // don't have mtouch generate the dsyms... args.AddLine("--dsym=no"); var gcc = new GccOptions(); if (!string.IsNullOrEmpty(ExtraArgs)) { var extraArgs = CommandLineArgumentBuilder.Parse(ExtraArgs); var target = MainAssembly.ItemSpec; string projectDir; if (ProjectDir.StartsWith("~/", StringComparison.Ordinal)) { // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host, // it simply uses paths relative to "~/". Expand these paths to their full path equivalents. var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); projectDir = Path.Combine(home, ProjectDir.Substring(2)); } else { projectDir = ProjectDir; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "projectdir", projectDir }, // Apparently msbuild doesn't propagate the solution path, so we can't get it. // { "solutiondir", proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory }, { "appbundledir", AppBundleDir }, { "targetpath", Path.Combine(Path.GetDirectoryName(target), Path.GetFileName(target)) }, { "targetdir", Path.GetDirectoryName(target) }, { "targetname", Path.GetFileName(target) }, { "targetext", Path.GetExtension(target) }, }; for (int i = 0; i < extraArgs.Length; i++) { var argument = extraArgs[i]; int startIndex = 0; while (argument.Length > startIndex && argument[startIndex] == '-') { startIndex++; } int endIndex = startIndex; while (endIndex < argument.Length && argument[endIndex] != '=') { endIndex++; } int length = endIndex - startIndex; if (length == 9 && string.CompareOrdinal(argument, startIndex, "gcc_flags", 0, 9) == 0) { // user-defined -gcc_flags argument string flags = null; if (endIndex < extraArgs[i].Length) { flags = Unquote(argument, endIndex + 1); } else if (i + 1 < extraArgs.Length) { flags = extraArgs[++i]; } if (!string.IsNullOrEmpty(flags)) { var gccArgs = CommandLineArgumentBuilder.Parse(flags); for (int j = 0; j < gccArgs.Length; j++) { gcc.Arguments.Add(StringParserService.Parse(gccArgs[j], customTags)); } } } else { // other user-defined mtouch arguments unescapedArgs.Add(StringParserService.Parse(argument, customTags)); } } } BuildNativeReferenceFlags(gcc); gcc.Arguments.AddQuoted(LinkNativeCodeTaskBase.GetEmbedEntitlementsInExecutableLinkerFlags(CompiledEntitlements)); foreach (var framework in gcc.Frameworks) { args.AddQuotedLine($"--framework={framework}"); } foreach (var framework in gcc.WeakFrameworks) { args.AddQuotedLine($"--weak-framework={framework}"); } if (gcc.Cxx) { args.AddLine("--cxx"); } if (gcc.Arguments.Length > 0) { unescapedArgs.Add($"--gcc_flags={gcc.Arguments.ToString ()}"); } foreach (var asm in References) { if (IsFrameworkItem(asm)) { args.AddQuotedLine($"--reference={ResolveFrameworkFile (asm.ItemSpec)}"); } else { args.AddQuotedLine($"--reference={Path.GetFullPath (asm.ItemSpec)}"); } } foreach (var ext in AppExtensionReferences) { args.AddQuotedLine($"--app-extension={Path.GetFullPath (ext.ItemSpec)}"); } if (!string.IsNullOrWhiteSpace(License)) { args.AddLine($"--license={License}"); } return(CreateResponseFile(args, unescapedArgs)); }
public string[] GetCompilerFlagsAsArray(Project project, CProjectConfiguration configuration) { List <string> args = new List <string> (); if (configuration.DebugSymbols) { args.Add("-g"); } if (configuration.CompileTarget == CompileTarget.Module) { args.Add("-fPIC"); } switch (configuration.WarningLevel) { case WarningLevel.None: args.Add("-w"); break; case WarningLevel.Normal: break; case WarningLevel.All: args.Add("-Wall"); break; } switch (configuration.CVersion) { case CVersion.ISOC: args.Add("-std=c90"); break; case CVersion.C99: args.Add("-std=c99"); break; case CVersion.C11: args.Add("-std=c11"); break; case CVersion.ISOCPP: args.Add("-std=c++99"); break; case CVersion.CPP03: args.Add("-std=c++03"); break; case CVersion.CPP11: args.Add("-std=c++11"); break; case CVersion.CustomVersionString: args.Add(configuration.CustomVersionString); break; } if (configuration.WarningsAsErrors) { args.Add("-Werror"); } args.Add("-O" + configuration.OptimizationLevel); if (configuration.ExtraCompilerArguments != null && configuration.ExtraCompilerArguments.Length > 0) { string extraCompilerArgs = ExpandBacktickedParameters(configuration.ExtraCompilerArguments.Replace('\n', ' ')); args.Add(extraCompilerArgs); } if (configuration.DefineSymbols != null && configuration.DefineSymbols.Length > 0) { args.Add(ProcessDefineSymbols(configuration.DefineSymbols)); } if (configuration.Includes != null) { foreach (string inc in configuration.Includes) { args.Add("-I\"" + StringParserService.Parse(inc, GetStringTags(project)) + "\""); } } if (configuration.PrecompileHeaders) { string precdir = Path.Combine(configuration.IntermediateOutputDirectory, "prec"); precdir = Path.Combine(precdir, configuration.Id); args.Add("-I\"" + precdir + "\""); } return(args.ToArray()); }
public WorkspaceItemCreatedInformation CreateEntry(ProjectCreateInformation projectCreateInformation, string defaultLanguage) { WorkspaceItem workspaceItem = null; if (string.IsNullOrEmpty(type)) { workspaceItem = new Solution(); } else { Type workspaceItemType = addin.GetType(type, false); if (workspaceItemType != null) { workspaceItem = Activator.CreateInstance(workspaceItemType) as WorkspaceItem; } if (workspaceItem == null) { MessageService.ShowError(GettextCatalog.GetString("Can't create solution with type: {0}", type)); return(null); } } workspaceItem.Name = StringParserService.Parse(name, new string[, ] { { "ProjectName", projectCreateInformation.SolutionName } }); workspaceItem.SetLocation(projectCreateInformation.SolutionPath, workspaceItem.Name); ProjectCreateInformation localProjectCI; if (!string.IsNullOrEmpty(directory) && directory != ".") { localProjectCI = new ProjectCreateInformation(projectCreateInformation); localProjectCI.SolutionPath = Path.Combine(localProjectCI.SolutionPath, directory); localProjectCI.ProjectBasePath = Path.Combine(localProjectCI.ProjectBasePath, directory); if (!Directory.Exists(localProjectCI.SolutionPath)) { Directory.CreateDirectory(localProjectCI.SolutionPath); } if (!Directory.Exists(localProjectCI.ProjectBasePath)) { Directory.CreateDirectory(localProjectCI.ProjectBasePath); } } else { localProjectCI = projectCreateInformation; } var workspaceItemCreatedInfo = new WorkspaceItemCreatedInformation(workspaceItem); Solution solution = workspaceItem as Solution; if (solution != null) { for (int i = 0; i < entryDescriptors.Count; i++) { ProjectCreateInformation entryProjectCI; var entry = entryDescriptors[i] as ICustomProjectCIEntry; if (entry != null) { entryProjectCI = entry.CreateProjectCI(localProjectCI); } else { entryProjectCI = localProjectCI; } var solutionItemDesc = entryDescriptors[i]; SolutionEntityItem info = solutionItemDesc.CreateItem(entryProjectCI, defaultLanguage); if (info == null) { continue; } solutionItemDesc.InitializeItem(solution.RootFolder, entryProjectCI, defaultLanguage, info); IConfigurationTarget configurationTarget = info as IConfigurationTarget; if (configurationTarget != null) { foreach (ItemConfiguration configuration in configurationTarget.Configurations) { bool flag = false; foreach (SolutionConfiguration solutionCollection in solution.Configurations) { if (solutionCollection.Id == configuration.Id) { flag = true; } } if (!flag) { solution.AddConfiguration(configuration.Id, true); } } } if ((info is Project) && (solutionItemDesc is ProjectDescriptor)) { workspaceItemCreatedInfo.AddPackageReferenceForCreatedProject((Project)info, (ProjectDescriptor)solutionItemDesc); } solution.RootFolder.Items.Add(info); if (startupProject == info.Name) { solution.StartupItem = info; } } } if (!workspaceItem.FileFormat.CanWrite(workspaceItem)) { // The default format can't write solutions of this type. Find a compatible format. FileFormat f = IdeApp.Services.ProjectService.FileFormats.GetFileFormatsForObject(workspaceItem).First(); workspaceItem.ConvertToFormat(f, true); } return(workspaceItemCreatedInfo); }
void ParseCommand(StringTagModel tagSource, out string cmd, out string args) { ParseCommand(out cmd, out args); cmd = StringParserService.Parse(cmd, tagSource); args = StringParserService.Parse(args, tagSource); }
PString MergeEntitlementString(PString pstr, MobileProvision profile, bool expandWildcards) { string TeamIdentifierPrefix; string AppIdentifierPrefix; if (string.IsNullOrEmpty(pstr.Value)) { return((PString)pstr.Clone()); } if (profile == null) { if (!warnedTeamIdentifierPrefix && pstr.Value.Contains("$(TeamIdentifierPrefix)")) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, "Cannot expand $(TeamIdentifierPrefix) in Entitlements.plist without a provisioning profile."); warnedTeamIdentifierPrefix = true; } if (!warnedAppIdentifierPrefix && pstr.Value.Contains("$(AppIdentifierPrefix)")) { Log.LogWarning(null, null, null, Entitlements, 0, 0, 0, 0, "Cannot expand $(AppIdentifierPrefix) in Entitlements.plist without a provisioning profile."); warnedAppIdentifierPrefix = true; } } if (profile != null && profile.ApplicationIdentifierPrefix.Count > 0) { AppIdentifierPrefix = profile.ApplicationIdentifierPrefix[0] + "."; } else { AppIdentifierPrefix = string.Empty; } if (profile != null && profile.TeamIdentifierPrefix.Count > 0) { TeamIdentifierPrefix = profile.TeamIdentifierPrefix[0] + "."; } else { TeamIdentifierPrefix = AppIdentifierPrefix; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "TeamIdentifierPrefix", TeamIdentifierPrefix }, { "AppIdentifierPrefix", AppIdentifierPrefix }, { "CFBundleIdentifier", BundleIdentifier }, }; var expanded = StringParserService.Parse(pstr.Value, customTags); if (expandWildcards && expanded.IndexOf('*') != -1) { int asterisk = expanded.IndexOf('*'); string prefix; if (expanded.StartsWith(TeamIdentifierPrefix, StringComparison.Ordinal)) { prefix = TeamIdentifierPrefix; } else if (expanded.StartsWith(AppIdentifierPrefix, StringComparison.Ordinal)) { prefix = AppIdentifierPrefix; } else { prefix = string.Empty; } var baseBundleIdentifier = expanded.Substring(prefix.Length, asterisk - prefix.Length); if (!BundleIdentifier.StartsWith(baseBundleIdentifier, StringComparison.Ordinal)) { expanded = expanded.Replace("*", BundleIdentifier); } else { expanded = prefix + BundleIdentifier; } } return(new PString(expanded)); }
public override string GetCompilerFlags(Project project, CProjectConfiguration configuration) { StringBuilder args = new StringBuilder(); if (configuration.DebugSymbols) { args.Append("-g "); } if (configuration.CompileTarget == CBinding.CompileTarget.SharedLibrary) { args.Append("-fPIC "); } switch (configuration.WarningLevel) { case WarningLevel.None: args.Append("-w "); break; case WarningLevel.Normal: // nothing break; case WarningLevel.All: args.Append("-Wall "); break; } if (configuration.WarningsAsErrors) { args.Append("-Werror "); } args.Append("-O" + configuration.OptimizationLevel + " "); if (configuration.ExtraCompilerArguments != null && configuration.ExtraCompilerArguments.Length > 0) { string extraCompilerArgs = ExpandBacktickedParameters(configuration.ExtraCompilerArguments.Replace('\n', ' ')); args.Append(extraCompilerArgs + " "); } if (configuration.DefineSymbols != null && configuration.DefineSymbols.Length > 0) { args.Append(ProcessDefineSymbols(configuration.DefineSymbols) + " "); } if (configuration.Includes != null) { foreach (string inc in configuration.Includes) { args.Append("-I\"" + StringParserService.Parse(inc, GetStringTags(project)) + "\" "); } } if (configuration.PrecompileHeaders) { string precdir = Path.Combine(configuration.IntermediateOutputDirectory, "prec"); precdir = Path.Combine(precdir, configuration.Id); args.Append("-I\"" + precdir + "\""); } return(args.ToString()); }
static string ReplaceParameters(string input, string[,] substitution, ProjectCreateInformation projectCreateInformation) { string updatedText = StringParserService.Parse(input, substitution); return(StringParserService.Parse(updatedText, projectCreateInformation.Parameters)); }
private void MakeSharedLibrary(Project project, ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProjectPackageCollection packages, CompilerResults cr, ProgressMonitor monitor, string outputName) { if (!NeedsUpdate(projectFiles, configuration, outputName)) { return; } string objectFiles = string.Join(" ", ObjectFiles(projectFiles, configuration, true)); string pkgargs = GeneratePkgLinkerArgs(packages); StringBuilder args = new StringBuilder(); if (configuration.ExtraLinkerArguments != null && configuration.ExtraLinkerArguments.Length > 0) { string extraLinkerArgs = ExpandBacktickedParameters(configuration.ExtraLinkerArguments.Replace('\n', ' ')); args.Append(extraLinkerArgs + " "); } if (configuration.LibPaths != null) { foreach (string libpath in configuration.LibPaths) { args.Append("-L\"" + StringParserService.Parse(libpath, GetStringTags(project)) + "\" "); } } if (configuration.Libs != null) { foreach (string lib in configuration.Libs) { string directory = Path.GetDirectoryName(lib); string library = Path.GetFileName(lib); // Is this a 'standard' (as in, uses an orthodox naming convention) library..? string link_lib = String.Empty; if (IsStandardLibrary(configuration, directory, library, ref link_lib)) { args.Append("-l\"" + link_lib + "\" "); } // If not, reference the library by it's full pathname. else { args.Append("\"" + lib + "\" "); } } } string linker_args = string.Format("-shared -o \"{0}\" {1} {2} {3}", outputName, objectFiles, pkgargs, args.ToString()); monitor.BeginTask(GettextCatalog.GetString("Generating shared object \"{0}\" from object files", Path.GetFileName(outputName)), 1); string errorOutput; int exitCode = ExecuteCommand(linkerCommand, linker_args, Path.GetDirectoryName(outputName), monitor, out errorOutput); if (exitCode == 0) { monitor.Step(1); } monitor.EndTask(); ParseCompilerOutput(errorOutput, cr); ParseLinkerOutput(errorOutput, cr); CheckReturnCode(exitCode, cr); }
protected override string SubstitutePlaceholders(string s) { var model = file.Project.GetStringTagModel(activeConfiguration); return(StringParserService.Parse(s, model)); }
private void InitControls() { _tabControl = new TabControl(); _tabControl.Dock = DockStyle.Fill; string outStr = ""; #region 边界 _tabPage1 = new TabPage(); _tabPage1.Name = "MarginTabPage"; _tabPage1.Text = "边界"; _checkBox1 = new CheckBox(); _checkBox1.Name = "_checkBox1"; _checkBox1.Text = StringParserService.Parse("${res:cssDesign.cssForm.modelPanelAllSame}"); _checkBox1.AutoSize = true; _checkBox1.Dock = DockStyle.Top; _page1_1 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("bottom", out outStr)) { _page1_1.LabelName = outStr; } _page1_2 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("top", out outStr)) { _page1_2.LabelName = outStr; } _page1_3 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("right", out outStr)) { _page1_3.LabelName = outStr; } _page1_4 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("left", out outStr)) { _page1_4.LabelName = outStr; } _page1_5 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("all", out outStr)) { _page1_5.LabelName = outStr; } if (_imageList1.Images.Count >= 5) { _page1_1.Image = _imageList1.Images[4]; _page1_2.Image = _imageList1.Images[3]; _page1_3.Image = _imageList1.Images[2]; _page1_4.Image = _imageList1.Images[1]; _page1_5.Image = _imageList1.Images[0]; } _tabPage1.Controls.Add(_page1_1); _tabPage1.Controls.Add(_page1_2); _tabPage1.Controls.Add(_page1_3); _tabPage1.Controls.Add(_page1_4); _tabPage1.Controls.Add(_page1_5); _tabPage1.Controls.Add(_checkBox1); #endregion #region 边框 _tabPage2 = new TabPage(); _tabPage2.Name = "BorderTabPage"; _tabPage2.Text = "边框"; _checkBox2 = new CheckBox(); _checkBox2.Name = "_checkBox2"; _checkBox2.Text = StringParserService.Parse("${res:cssDesign.cssForm.modelPanelAllSame}"); _checkBox2.AutoSize = true; _checkBox2.Dock = DockStyle.Top; _page2_1 = new SingerBoxItemControl(true); if (_dic.Properties.TryGetValue("bottom", out outStr)) { _page2_1.LabelName = outStr; } _page2_2 = new SingerBoxItemControl(true); if (_dic.Properties.TryGetValue("top", out outStr)) { _page2_2.LabelName = outStr; } _page2_3 = new SingerBoxItemControl(true); if (_dic.Properties.TryGetValue("right", out outStr)) { _page2_3.LabelName = outStr; } _page2_4 = new SingerBoxItemControl(true); if (_dic.Properties.TryGetValue("left", out outStr)) { _page2_4.LabelName = outStr; } _page2_5 = new SingerBoxItemControl(true); if (_dic.Properties.TryGetValue("all", out outStr)) { _page2_5.LabelName = outStr; } if (_imageList2.Images.Count >= 5) { _page2_1.Image = _imageList2.Images[4]; _page2_2.Image = _imageList2.Images[3]; _page2_3.Image = _imageList2.Images[2]; _page2_4.Image = _imageList2.Images[1]; _page2_5.Image = _imageList2.Images[0]; } _tabPage2.Controls.Add(_page2_1); _tabPage2.Controls.Add(_page2_2); _tabPage2.Controls.Add(_page2_3); _tabPage2.Controls.Add(_page2_4); _tabPage2.Controls.Add(_page2_5); _tabPage2.Controls.Add(_checkBox2); #endregion #region 填充 _tabPage3 = new TabPage(); _tabPage3.Name = "PaddingTabPage"; _tabPage3.Text = "填充"; _checkBox3 = new CheckBox(); _checkBox3.Name = "_checkBox3"; _checkBox3.Text = StringParserService.Parse("${res:cssDesign.cssForm.modelPanelAllSame}"); _checkBox3.AutoSize = true; _checkBox3.Dock = DockStyle.Top; _page3_1 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("bottom", out outStr)) { _page3_1.LabelName = outStr; } _page3_2 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("top", out outStr)) { _page3_2.LabelName = outStr; } _page3_3 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("right", out outStr)) { _page3_3.LabelName = outStr; } _page3_4 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("left", out outStr)) { _page3_4.LabelName = outStr; } _page3_5 = new SingerBoxItemControl(false); if (_dic.Properties.TryGetValue("all", out outStr)) { _page3_5.LabelName = outStr; } if (_imageList3.Images.Count >= 5) { _page3_1.Image = _imageList3.Images[4]; _page3_2.Image = _imageList3.Images[3]; _page3_3.Image = _imageList3.Images[2]; _page3_4.Image = _imageList3.Images[1]; _page3_5.Image = _imageList3.Images[0]; } _tabPage3.Controls.Add(_page3_1); _tabPage3.Controls.Add(_page3_2); _tabPage3.Controls.Add(_page3_3); _tabPage3.Controls.Add(_page3_4); _tabPage3.Controls.Add(_page3_5); _tabPage3.Controls.Add(_checkBox3); _tabControl.TabPages.Add(_tabPage1); _tabControl.TabPages.Add(_tabPage2); _tabControl.TabPages.Add(_tabPage3); _tabControl.Appearance = TabAppearance.Buttons; #endregion _page1_1.CssChanged += new EventHandler(_page1_CssChanged); _page1_2.CssChanged += new EventHandler(_page1_2_CssChanged); _page1_3.CssChanged += new EventHandler(_page1_3_CssChanged); _page1_4.CssChanged += new EventHandler(_page1_4_CssChanged); _page1_5.CssChanged += new EventHandler(_page1_5_CssChanged); _checkBox1.CheckedChanged += new EventHandler(_checkBox1_CheckedChanged); _checkBox1.Checked = true; _page2_1.CssChanged += new EventHandler(_page2_CssChanged); _page2_2.CssChanged += new EventHandler(_page2_2_CssChanged); _page2_3.CssChanged += new EventHandler(_page2_3_CssChanged); _page2_4.CssChanged += new EventHandler(_page2_4_CssChanged); _page2_5.CssChanged += new EventHandler(_page2_5_CssChanged); _checkBox2.CheckedChanged += new EventHandler(_checkBox2_CheckedChanged); _checkBox2.Checked = true; _page3_1.CssChanged += new EventHandler(_page3_CssChanged); _page3_2.CssChanged += new EventHandler(_page3_2_CssChanged); _page3_3.CssChanged += new EventHandler(_page3_3_CssChanged); _page3_4.CssChanged += new EventHandler(_page3_4_CssChanged); _page3_5.CssChanged += new EventHandler(_page3_5_CssChanged); _checkBox3.CheckedChanged += new EventHandler(_checkBox3_CheckedChanged); _checkBox3.Checked = true; this.Controls.Add(_tabControl); }
static void UpdateCache() { if (dontUpdateCache) //Avoid updating cache while scan paths are added during registration { return; } // Prevent a TypeInitializationException in when calling SettingsLoader.Save when no templates // are available, which throws an exception, by returning here. This prevents the MonoDevelop.Ide addin // from loading. In practice this should not happen unless the .NET Core addin is disabled. var projectTemplateNodes = AddinManager.GetExtensionNodes <TemplateExtensionNode> ("/MonoDevelop/Ide/Templates"); var itemTemplateNodes = AddinManager.GetExtensionNodes <ItemTemplateExtensionNode> ("/MonoDevelop/Ide/ItemTemplates"); if (!projectTemplateNodes.Any() && !itemTemplateNodes.Any()) { return; } var paths = new Paths(environmentSettings); //TODO: Uncomment this IF, but also add logic to invalidate/check if new templates were added from newly installed AddOns... //if (!paths.Exists (paths.User.BaseDir) || !paths.Exists (paths.User.FirstRunCookie)) { paths.DeleteDirectory(paths.User.BaseDir); //Delete cache var settingsLoader = (SettingsLoader)environmentSettings.SettingsLoader; foreach (var path in projectTemplateNodes.Select(t => t.ScanPath).Distinct()) { string scanPath = StringParserService.Parse(path); if (!string.IsNullOrEmpty(scanPath)) { settingsLoader.UserTemplateCache.Scan(scanPath); } } foreach (var path in itemTemplateNodes.Select(t => t.ScanPath).Distinct()) { string scanPath = StringParserService.Parse(path); if (!string.IsNullOrEmpty(scanPath)) { settingsLoader.UserTemplateCache.Scan(scanPath); } } settingsLoader.Save(); paths.WriteAllText(paths.User.FirstRunCookie, ""); //} var templateInfos = settingsLoader.UserTemplateCache.List(false, t => new MatchInfo()).ToDictionary(m => m.Info.Identity, m => m.Info); var newProjectTemplates = new List <MicrosoftTemplateEngineSolutionTemplate> (); foreach (var template in projectTemplateNodes) { ITemplateInfo templateInfo; if (!templateInfos.TryGetValue(template.TemplateId, out templateInfo)) { LoggingService.LogWarning("Template {0} not found.", template.TemplateId); continue; } newProjectTemplates.Add(new MicrosoftTemplateEngineSolutionTemplate(template, templateInfo)); } projectTemplates = newProjectTemplates; var newItemTemplates = new List <MicrosoftTemplateEngineItemTemplate> (); foreach (var template in itemTemplateNodes) { ITemplateInfo templateInfo; if (!templateInfos.TryGetValue(template.TemplateId, out templateInfo)) { LoggingService.LogWarning("Template {0} not found.", template.TemplateId); continue; } newItemTemplates.Add(new MicrosoftTemplateEngineItemTemplate(template, templateInfo)); } itemTemplates = newItemTemplates; }
/// <summary> /// Sets all properties in the object <code>o</code> to the xml element <code>el</code> defined properties. /// </summary> void SetAttributes(object o, XmlElement el) { StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); if (el.Name == "AcceptButton") { mainForm = (Form)o; acceptButtonName = el.Attributes["value"].InnerText.Split(' ')[0]; return; } if (el.Name == "CancelButton") { mainForm = (Form)o; cancelButtonName = el.Attributes["value"].InnerText.Split(' ')[0]; return; } if (el.Name == "ToolTip") { string val = el.Attributes["value"].InnerText; tooltips[o] = stringParserService.Parse(val); return; } if (el.Attributes["value"] != null) { string val = el.Attributes["value"].InnerText; try { SetValue(o, el.Name, stringParserService.Parse(val)); } catch (Exception) {} } else if (el.Attributes["event"] != null) { try { EventInfo eventInfo = o.GetType().GetEvent(el.Name); eventInfo.AddEventHandler(o, Delegate.CreateDelegate(eventInfo.EventHandlerType, customizationObject, el.Attributes["event"].InnerText)); } catch (Exception) {} } else { PropertyInfo propertyInfo = o.GetType().GetProperty(el.Name); object pv = propertyInfo.GetValue(o, null); if (pv is IList) { foreach (XmlNode subNode in el.ChildNodes) { if (subNode is XmlElement) { XmlElement subElement = (XmlElement)subNode; object collectionObject = objectCreator.CreateObject(subElement.Name); if (collectionObject == null) { continue; } if (collectionObject is IComponent) { string name = null; if (subElement["Name"] != null && subElement["Name"].Attributes["value"] != null) { name = subElement["Name"].Attributes["value"].InnerText; } if (name == null || name.Length == 0) { name = "CreatedObject" + num++; } // collectionObject = host.CreateComponent(collectionObject.GetType(), name); } SetUpObject(collectionObject, subElement); if (collectionObject is Control) { string name = ((Control)collectionObject).Name; if (name != null && name.Length > 0) { controlDictionary[name] = (Control)collectionObject; } } if (collectionObject != null) { ((IList)pv).Add(collectionObject); } } } } else { object propertyObject = objectCreator.CreateObject(o.GetType().GetProperty(el.Name).PropertyType.Name); if (propertyObject is IComponent) { PropertyInfo pInfo = propertyObject.GetType().GetProperty("Name"); string name = null; if (el["Name"] != null && el["Name"].Attributes["value"] != null) { name = el["Name"].Attributes["value"].InnerText; } if (name == null || name.Length == 0) { name = "CreatedObject" + num++; } propertyObject = objectCreator.CreateObject(name); } SetUpObject(propertyObject, el); propertyInfo.SetValue(o, propertyObject, null); } } }
protected override string GenerateCommandLineCommands() { var cmd = new CommandLineBuilder(); #if DEBUG cmd.AppendSwitch("/v"); #endif cmd.AppendSwitch("/nostdlib"); cmd.AppendSwitchIfNotNull("/baselib:", BaseLibDll); cmd.AppendSwitchIfNotNull("/out:", OutputAssembly); cmd.AppendSwitchIfNotNull("/attributelib:", AttributeAssembly); string dir; if (!string.IsNullOrEmpty(BaseLibDll)) { dir = Path.GetDirectoryName(BaseLibDll); cmd.AppendSwitchIfNotNull("/lib:", dir); } if (ProcessEnums) { cmd.AppendSwitch("/process-enums"); } if (EmitDebugInformation) { cmd.AppendSwitch("/debug"); } if (AllowUnsafeBlocks) { cmd.AppendSwitch("/unsafe"); } cmd.AppendSwitchIfNotNull("/ns:", Namespace); if (!string.IsNullOrEmpty(DefineConstants)) { var strv = DefineConstants.Split(new [] { ';' }); var sanitized = new List <string> (); foreach (var str in strv) { if (str != string.Empty) { sanitized.Add(str); } } if (sanitized.Count > 0) { cmd.AppendSwitchIfNotNull("/d:", string.Join(";", sanitized.ToArray())); } } //cmd.AppendSwitch ("/e"); foreach (var item in ApiDefinitions) { cmd.AppendFileNameIfNotNull(Path.GetFullPath(item.ItemSpec)); } if (CoreSources != null) { foreach (var item in CoreSources) { cmd.AppendSwitchIfNotNull("/s:", Path.GetFullPath(item.ItemSpec)); } } if (Sources != null) { foreach (var item in Sources) { cmd.AppendSwitchIfNotNull("/x:", Path.GetFullPath(item.ItemSpec)); } } if (AdditionalLibPaths != null) { foreach (var item in AdditionalLibPaths) { cmd.AppendSwitchIfNotNull("/lib:", Path.GetFullPath(item.ItemSpec)); } } HandleReferences(cmd); if (Resources != null) { foreach (var item in Resources) { var args = new List <string> (); string id; args.Add(item.ToString()); id = item.GetMetadata("LogicalName"); if (!string.IsNullOrEmpty(id)) { args.Add(id); } cmd.AppendSwitchIfNotNull("/res:", args.ToArray(), ","); } } if (NativeLibraries != null) { foreach (var item in NativeLibraries) { var args = new List <string> (); string id; args.Add(item.ToString()); id = item.GetMetadata("LogicalName"); if (string.IsNullOrEmpty(id)) { id = Path.GetFileName(args[0]); } args.Add(id); cmd.AppendSwitchIfNotNull("/link-with:", args.ToArray(), ","); } } if (GeneratedSourcesDir != null) { cmd.AppendSwitchIfNotNull("/tmpdir:", Path.GetFullPath(GeneratedSourcesDir)); } if (GeneratedSourcesFileList != null) { cmd.AppendSwitchIfNotNull("/sourceonly:", Path.GetFullPath(GeneratedSourcesFileList)); } cmd.AppendSwitch($"/target-framework={TargetFrameworkMoniker}"); if (!string.IsNullOrEmpty(ExtraArgs)) { var extraArgs = CommandLineArgumentBuilder.Parse(ExtraArgs); var target = OutputAssembly; string projectDir; if (ProjectDir.StartsWith("~/", StringComparison.Ordinal)) { // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host, // it simply uses paths relative to "~/". Expand these paths to their full path equivalents. var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); projectDir = Path.Combine(home, ProjectDir.Substring(2)); } else { projectDir = ProjectDir; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "projectdir", projectDir }, // Apparently msbuild doesn't propagate the solution path, so we can't get it. // { "solutiondir", proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory }, }; // OutputAssembly is optional so it can be null if (target != null) { var d = Path.GetDirectoryName(target); var n = Path.GetFileName(target); customTags.Add("targetpath", Path.Combine(d, n)); customTags.Add("targetdir", d); customTags.Add("targetname", n); customTags.Add("targetext", Path.GetExtension(target)); } for (int i = 0; i < extraArgs.Length; i++) { var argument = extraArgs[i]; cmd.AppendTextUnquoted(" "); cmd.AppendTextUnquoted(StringParserService.Parse(argument, customTags)); } } var v = VerbosityUtils.Merge(ExtraArgs, (LoggerVerbosity)Verbosity); if (v.Length > 0) { foreach (var arg in v) { cmd.AppendTextUnquoted(" "); cmd.AppendTextUnquoted(arg); } } return(cmd.ToString()); }
protected override string GenerateCommandLineCommands() { var args = new ProcessArgumentBuilder(); TargetArchitecture architectures; if (string.IsNullOrEmpty(Architectures) || !Enum.TryParse(Architectures, out architectures)) { architectures = TargetArchitecture.Default; } if (architectures == TargetArchitecture.ARMv6) { Log.LogError("Target architecture ARMv6 is no longer supported in Xamarin.iOS. Please select a supported architecture."); return(null); } if (IsClassic && minimumOSVersion < IPhoneSdkVersion.V3_1 && architectures.HasFlag(TargetArchitecture.ARMv7)) { Log.LogWarning(null, null, null, AppManifest.ItemSpec, 0, 0, 0, 0, "Deployment Target changed from iOS {0} to iOS 3.1 (minimum requirement for ARMv7)", minimumOSVersion); minimumOSVersion = IPhoneSdkVersion.V3_1; } if (!string.IsNullOrEmpty(IntermediateOutputPath)) { Directory.CreateDirectory(IntermediateOutputPath); args.Add("--cache"); args.AddQuoted(Path.GetFullPath(IntermediateOutputPath)); } if (IsClassic || IPhoneSdks.MonoTouch.Version < new IPhoneSdkVersion(8, 5, 0)) { args.Add("--nomanifest"); args.Add("--nosign"); } args.Add(SdkIsSimulator ? "--sim" : "--dev"); args.AddQuoted(Path.GetFullPath(AppBundleDir)); if (AppleSdkSettings.XcodeVersion.Major >= 5 && IPhoneSdks.MonoTouch.Version.CompareTo(new IPhoneSdkVersion(6, 3, 7)) < 0) { args.Add("--compiler", "clang"); } args.Add("--executable"); args.AddQuoted(ExecutableName); if (IsAppExtension) { args.Add("--extension"); } if (Debug) { if (FastDev && IPhoneSdks.MonoTouch.SupportsFastDev) { args.Add("--fastdev"); } args.Add("--debug"); } if (Profiling) { args.Add("--profiling"); } if (LinkerDumpDependencies) { args.Add("--linkerdumpdependencies"); } switch (LinkMode.ToLowerInvariant()) { case "sdkonly": args.Add("--linksdkonly"); break; case "none": args.Add("--nolink"); break; } if (!string.IsNullOrEmpty(I18n)) { args.Add("--i18n"); args.AddQuotedFormat(I18n); } args.Add("--sdkroot"); args.AddQuoted(SdkRoot); args.Add("--sdk"); args.AddQuoted(SdkVersion); if (!minimumOSVersion.IsUseDefault) { args.Add("--targetver"); args.AddQuoted(minimumOSVersion.ToString()); } if (UseFloat32 /* We want to compile 32-bit floating point code to use 32-bit floating point operations */) { args.Add("--aot-options=-O=float32"); } if (IPhoneSdks.MonoTouch.SupportsGenericValueTypeSharing) { if (!EnableGenericValueTypeSharing) { args.Add("--gsharedvt=false"); } } if (LinkDescriptions != null) { foreach (var desc in LinkDescriptions) { args.AddQuoted(string.Format("--xml={0}", desc.ItemSpec)); } } if (EnableBitcode) { switch (Framework) { case PlatformFramework.WatchOS: args.Add("--bitcode=full"); break; case PlatformFramework.TVOS: args.Add("--bitcode=asmonly"); break; default: throw new InvalidOperationException(string.Format("Bitcode is currently not supported on {0}.", Framework)); } } if (!string.IsNullOrEmpty(HttpClientHandler)) { args.Add(string.Format("--http-message-handler={0}", HttpClientHandler)); } if (!string.IsNullOrEmpty(TLSProvider)) { args.Add(string.Format("--tls-provider={0}", TLSProvider.ToLowerInvariant())); } string thumb = UseThumb && UseLlvm ? "+thumb2" : ""; string llvm = UseLlvm ? "+llvm" : ""; string abi = ""; if (SdkIsSimulator) { if (architectures.HasFlag(TargetArchitecture.i386)) { abi += (abi.Length > 0 ? "," : "") + "i386"; } if (architectures.HasFlag(TargetArchitecture.x86_64)) { abi += (abi.Length > 0 ? "," : "") + "x86_64"; } if (string.IsNullOrEmpty(abi)) { architectures = TargetArchitecture.i386; abi = "i386"; } } else { if (architectures == TargetArchitecture.Default) { architectures = TargetArchitecture.ARMv7; } if (architectures.HasFlag(TargetArchitecture.ARMv7)) { abi += (abi.Length > 0 ? "," : "") + "armv7" + llvm + thumb; } if (architectures.HasFlag(TargetArchitecture.ARMv7s)) { abi += (abi.Length > 0 ? "," : "") + "armv7s" + llvm + thumb; } if (architectures.HasFlag(TargetArchitecture.ARM64)) { // Note: ARM64 does not have thumb. abi += (abi.Length > 0 ? "," : "") + "arm64" + llvm; } if (architectures.HasFlag(TargetArchitecture.ARMv7k)) { abi += (abi.Length > 0 ? "," : "") + "armv7k"; } if (string.IsNullOrEmpty(abi)) { abi = "armv7" + llvm + thumb; } } // Output the CompiledArchitectures CompiledArchitectures = architectures.ToString(); args.Add("--abi=" + abi); // output symbols to preserve when stripping args.Add("--symbollist"); args.AddQuoted(Path.GetFullPath(SymbolsList)); // don't have mtouch generate the dsyms... args.Add("--dsym=no"); var gcc = new GccOptions(); if (!string.IsNullOrEmpty(ExtraArgs)) { var extraArgs = ProcessArgumentBuilder.Parse(ExtraArgs); var target = MainAssembly.ItemSpec; string projectDir; if (ProjectDir.StartsWith("~/", StringComparison.Ordinal)) { // Note: Since the Visual Studio plugin doesn't know the user's home directory on the Mac build host, // it simply uses paths relative to "~/". Expand these paths to their full path equivalents. var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); projectDir = Path.Combine(home, ProjectDir.Substring(2)); } else { projectDir = ProjectDir; } var customTags = new Dictionary <string, string> (StringComparer.OrdinalIgnoreCase) { { "projectdir", projectDir }, // Apparently msbuild doesn't propagate the solution path, so we can't get it. // { "solutiondir", proj.ParentSolution != null ? proj.ParentSolution.BaseDirectory : proj.BaseDirectory }, { "appbundledir", AppBundleDir }, { "targetpath", Path.Combine(Path.GetDirectoryName(target), Path.GetFileName(target)) }, { "targetdir", Path.GetDirectoryName(target) }, { "targetname", Path.GetFileName(target) }, { "targetext", Path.GetExtension(target) }, }; for (int i = 0; i < extraArgs.Length; i++) { if (extraArgs[i] == "-gcc_flags" || extraArgs[i] == "--gcc_flags") { // user-defined -gcc_flags argument if (i + 1 < extraArgs.Length && !string.IsNullOrEmpty(extraArgs[i + 1])) { var gccArgs = ProcessArgumentBuilder.Parse(extraArgs[i + 1]); for (int j = 0; j < gccArgs.Length; j++) { gcc.Arguments.Add(StringParserService.Parse(gccArgs[j], customTags)); } } i++; } else { // other user-defined mtouch arguments args.AddQuoted(StringParserService.Parse(extraArgs[i], customTags)); } } } BuildNativeReferenceFlags(gcc); BuildEntitlementFlags(gcc); foreach (var framework in gcc.Frameworks) { args.Add("-framework"); args.AddQuoted(framework); } foreach (var framework in gcc.WeakFrameworks) { args.Add("-weak-framework"); args.AddQuoted(framework); } if (gcc.Cxx) { args.Add("--cxx"); } if (gcc.Arguments.Length > 0) { args.Add("--gcc_flags"); args.AddQuoted(gcc.Arguments.ToString()); } foreach (var asm in References) { args.Add("-r"); if (IsFrameworkItem(asm)) { args.AddQuoted(ResolveFrameworkFile(asm.ItemSpec)); } else { args.AddQuoted(Path.GetFullPath(asm.ItemSpec)); } } foreach (var ext in AppExtensionReferences) { args.Add("--app-extension"); args.AddQuoted(Path.GetFullPath(ext.ItemSpec)); } args.Add("--target-framework"); args.Add(TargetFrameworkIdentifier + "," + TargetFrameworkVersion); args.AddQuoted(MainAssembly.ItemSpec); // We give the priority to the ExtraArgs to set the mtouch verbosity. if (string.IsNullOrEmpty(ExtraArgs) || (!string.IsNullOrEmpty(ExtraArgs) && !ExtraArgs.Contains("-q") && !ExtraArgs.Contains("-v"))) { args.Add(GetVerbosityLevel(Verbosity)); } if (!string.IsNullOrWhiteSpace(License)) { args.Add(string.Format("--license={0}", License)); } return(args.ToString()); }
public TemplateItem(ProjectTemplate template) { name = StringParserService.Parse(template.Name); this.template = template; }
public ResultsPad() { this.Text = StringParserService.Parse("${res:Pad.Results.text}"); this.Icon = Icon.FromHandle(ResourceService.GetResourceImage("main.newproject.smallicon").GetHicon()); this.Load += new EventHandler(ResultsPadLoad); _markButton.Click += new EventHandler(MarkButtonClick); _moveDownButton.Click += new EventHandler(MoveDownButtonClick); _moveUpButton.Click += new EventHandler(MoveUpButtonClick); _deleteAllButton.Click += new EventHandler(DeleteAllButtonClick); _resultsListView.SelectedIndexChanged += new EventHandler(ResultsListViewSelectedIndexChanged); _resultsListView.MouseDoubleClick += new MouseEventHandler(_resultsListView_MouseDoubleClick); // _toolStrip _toolStrip.Dock = DockStyle.Top; _toolStrip.Items.AddRange(new ToolStripItem[] { _markButton, _seParator1, _moveUpButton, _moveDownButton, _seParator2, _deleteAllButton }); _toolStrip.Visible = true; _toolStrip.Enabled = false; // _markButton _markButton.Text = "转到当前行的位置"; _markButton.DisplayStyle = ToolStripItemDisplayStyle.Image; //_markButton.Image = Image.FromFile(Path.Combine(PathService.SoftwarePath, "")); _markButton.Image = null; _markButton.AutoSize = true; _markButton.Visible = true; _markButton.Enabled = true; // _seParator1 & _seParator2 //_seParator1.AutoSize = true; _seParator1.Visible = true; // _seParator2.AutoSize = true; _seParator2.Visible = true; // _moveUpButton _moveUpButton.Text = "转到列表中的上一个位置"; _moveUpButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _moveUpButton.AutoSize = true; _moveUpButton.Visible = true; _moveUpButton.Enabled = true; // _moveDownButton _moveDownButton.Text = "转到列表中的下一个位置"; _moveDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _moveDownButton.AutoSize = true; _moveDownButton.Visible = true; _moveDownButton.Enabled = true; // _deleteAllButton _deleteAllButton.Text = "全部清除"; _deleteAllButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _deleteAllButton.AutoSize = true; _deleteAllButton.Visible = true; _deleteAllButton.Enabled = true; // _header _header.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); // _resultsListView _resultsListView.Visible = true; _resultsListView.MultiSelect = false; _resultsListView.View = View.Details; _resultsListView.Dock = DockStyle.Fill; _resultsListView.BorderStyle = BorderStyle.Fixed3D; _resultsListView.HeaderStyle = ColumnHeaderStyle.None; _resultsListView.Columns.Add(_header); _header.Width = 700; _resultsListView.Groups.Clear(); this.Controls.Add(_resultsListView); this.Controls.Add(_toolStrip); }
protected virtual string ProcessContent(string content, IStringTagModel tags) { return(StringParserService.Parse(content, tags)); }
public override string ToString() { if (messages.Count == 0) { return(string.Empty); } CommitMessageStyle message_style = MessageFormat.Style; TextFormatter formatter = new TextFormatter(); formatter.MaxColumns = MessageFormat.MaxColumns; formatter.TabWidth = MessageFormat.TabWidth; formatter.TabsAsSpaces = MessageFormat.TabsAsSpaces; formatter.KeepLines = true; if (message_style.Header.Length > 0) { string [,] tags = new string[, ] { { "AuthorName", uinfo.Name }, { "AuthorEmail", uinfo.Email } }; formatter.Append(StringParserService.Parse(message_style.Header, tags)); } formatter.IndentString = message_style.Indent; int m_i = 0; string fileSeparator1 = message_style.FileSeparator; string fileSeparator2 = string.Empty; int si = message_style.FileSeparator.IndexOf('\n'); if (si != -1 && si < message_style.FileSeparator.Length - 1) { fileSeparator1 = message_style.FileSeparator.Substring(0, si + 1); fileSeparator2 = message_style.FileSeparator.Substring(si + 1); } formatter.Wrap = message_style.Wrap ? WrappingType.Word : WrappingType.None; formatter.LeftMargin = message_style.LineAlign; formatter.ParagraphStartMargin = 0; if (!MessageFormat.ShowFilesForSingleComment && messages.Count == 1) { string msg = messages.Keys.First(); formatter.LeftMargin = formatter.ParagraphStartMargin; formatter.Append(msg); } else { foreach (KeyValuePair <string, List <string> > message in messages) { List <string> paths = message.Value; paths.Sort((a, b) => a.Length.CompareTo(b.Length)); formatter.BeginWord(); formatter.Append(message_style.FirstFilePrefix); for (int i = 0, n = paths.Count; i < n; i++) { if (i > 0) { formatter.Append(fileSeparator1); formatter.EndWord(); formatter.BeginWord(); formatter.Append(fileSeparator2); } string path = paths [i]; if (!MessageFormat.Style.IncludeDirectoryPaths) { path = Path.GetFileName(path); } formatter.Append(path); } formatter.Append(message_style.LastFilePostfix); formatter.EndWord(); formatter.Append(message.Key); if (m_i++ < messages.Count - 1) { formatter.AppendLine(); for (int n = 0; n < message_style.InterMessageLines; n++) { formatter.AppendLine(); } } } } for (int i = 0; i < MessageFormat.AppendNewlines; i++) { formatter.AppendLine(); } return(formatter.ToString()); }
static string FilterPath(string path) { return(StringParserService.Parse(path)); }
public void InitializeItem(SolutionItem policyParent, ProjectCreateInformation projectCreateInformation, string defaultLanguage, SolutionEntityItem item) { MonoDevelop.Projects.Project project = item as MonoDevelop.Projects.Project; if (project == null) { MessageService.ShowError(GettextCatalog.GetString("Can't create project with type: {0}", type)); return; } // Set the file before setting the name, to make sure the file extension is kept project.FileName = Path.Combine(projectCreateInformation.ProjectBasePath, projectCreateInformation.ProjectName); project.Name = projectCreateInformation.ProjectName; var dnp = project as DotNetProject; if (dnp != null) { if (policyParent.ParentSolution != null && !policyParent.ParentSolution.FileFormat.SupportsFramework(dnp.TargetFramework)) { SetClosestSupportedTargetFramework(policyParent.ParentSolution.FileFormat, dnp); } var substitution = new string[, ] { { "ProjectName", projectCreateInformation.SolutionName } }; foreach (ProjectReference projectReference in references) { if (projectReference.ReferenceType == ReferenceType.Project) { string referencedProjectName = StringParserService.Parse(projectReference.Reference, substitution); var parsedReference = ProjectReference.RenameReference(projectReference, referencedProjectName); dnp.References.Add(parsedReference); } else { dnp.References.Add(projectReference); } } } foreach (SingleFileDescriptionTemplate resourceTemplate in resources) { try { ProjectFile projectFile = new ProjectFile(resourceTemplate.SaveFile(policyParent, project, defaultLanguage, project.BaseDirectory, null)); projectFile.BuildAction = BuildAction.EmbeddedResource; project.Files.Add(projectFile); } catch (Exception ex) { MessageService.ShowException(ex, GettextCatalog.GetString("File {0} could not be written.", resourceTemplate.Name)); LoggingService.LogError(GettextCatalog.GetString("File {0} could not be written.", resourceTemplate.Name), ex); } } foreach (FileDescriptionTemplate fileTemplate in files) { try { fileTemplate.AddToProject(policyParent, project, defaultLanguage, project.BaseDirectory, null); } catch (Exception ex) { MessageService.ShowException(ex, GettextCatalog.GetString("File {0} could not be written.", fileTemplate.Name)); LoggingService.LogError(GettextCatalog.GetString("File {0} could not be written.", fileTemplate.Name), ex); } } }