public void Update() { uint pitemid; IVsMultiItemSelect ppMIS; IntPtr ppHier, ppSC; object directory = ""; if (ErrorHandler.Succeeded(SelectionService.GetCurrentSelection(out ppHier, out pitemid, out ppMIS, out ppSC))) { try { hierarchy = (IVsHierarchy)Marshal.GetObjectForIUnknown(ppHier); hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectDir, out directory); projectDir = directory.ToString(); } finally { Marshal.Release(ppHier); } } if (parser == null) { parser = InitializeParser(); } if (templatesDir == null) { templatesDir = new TemplateDirectory(); templatesDir.selectionTracker = SelectionService; } }
/// <summary> /// Updates module settings. /// </summary> public void Update() { var controller = new ModuleController(); { controller.UpdateModuleSetting(_moduleId, "PortalId", PortalId.ToString()); int mode = (int)LeaderboardMode; { controller.UpdateModuleSetting(_moduleId, "LeaderboardMode", mode.ToString()); } string showPaging = ShowPaging.ToString(); { controller.UpdateModuleSetting(_moduleId, "ShowPaging", showPaging); } if (!String.IsNullOrEmpty(TemplateDirectory)) { controller.UpdateModuleSetting(_moduleId, "TemplateDirectory", TemplateDirectory.ToString()); } string pageSize = PageSize.ToString(); { controller.UpdateModuleSetting(_moduleId, "PageSize", pageSize); } } }
private void GenerateTemplateDescriptionSection(TemplateDirectory templatesDir, StringBuilder stringBuilder, int depth, string lang) { stringBuilder.AppendLine(string.Format("{0}{{{1}}}", SectionFromDepth(depth), Helper.EscapeLaTeX(templatesDir.GetName(lang)))); foreach (var templateDocumentationPage in templatesDir.ContainingTemplateDocPages) { var locTemplate = templateDocumentationPage.CurrentLocalization; var description = _objectConverter.Convert(locTemplate.Description, templateDocumentationPage); description = Regex.Replace(description, "[\r\n]+", "\n"); var templateName = Helper.EscapeLaTeX(templateDocumentationPage.CurrentLocalization.Name); stringBuilder.AppendLine(string.Format("{0}{{{1}}}", SectionFromDepth(depth + 1), templateName)); stringBuilder.AppendLine(description); if (_showAuthors) { var author = _objectConverter.Convert(locTemplate.AuthorName, templateDocumentationPage); stringBuilder.AppendLine(""); stringBuilder.AppendLine("Author: " + author); stringBuilder.AppendLine(""); } if (!_noIcons && locTemplate.Icon != null) { var icon = _objectConverter.Convert(locTemplate.Icon, templateDocumentationPage); stringBuilder.AppendLine(icon); } } foreach (var dir in templatesDir.SubDirectories) { GenerateTemplateDescriptionSection(dir, stringBuilder, depth + 1, lang); } }
// // Generate a list of the functions implemented in CT2 for // https://www.cryptool.org/de/ctp-dokumentation-de/ctp-functions-de // public override void Generate(TemplateDirectory templatesDir) { foreach (var lang in AvailableLanguages) { var cultureInfo = new CultureInfo(lang); Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; // create list of functions itemlist.Clear(); GetComponents(lang); GetWizard(lang); //GetTemplates(templatesDir, lang, ""); // create CSV file var CSVDesc = GenerateCSVDescription(); StoreFunctionList(CSVDesc, "FunctionList-" + lang + ".csv"); // create text file var TextDesc = Properties.Resources.FunctionListTemplate .Replace("\r", "") .Replace("$VERSION$", GetVersion()) .Replace("$DATE$", DateTime.Now.ToString(CultureInfo.CurrentUICulture.DateTimeFormat)) + GenerateDescription(); StoreFunctionList(TextDesc, "FunctionList-" + lang + ".txt"); } }
private void WalkTemplateDirectory(TemplateDirectory templatesDir, StringBuilder stringBuilder, int depth, string lang) { var spacesStringBuilder = new StringBuilder(); for (int i = 0; i < depth * 2; i++) { spacesStringBuilder.Append(" "); } _uid++; var id = "ID_" + _uid; var spaces = spacesStringBuilder.ToString(); stringBuilder.AppendLine("<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\" >"); stringBuilder.AppendLine(string.Format("<tr><td colspan=\"4\">{0}<a href=\"#\" onclick=\"ShowHideDiv('{1}'); return false;\">{2}</a></td></tr>", spaces, id, templatesDir.GetName())); stringBuilder.AppendLine("</table>"); stringBuilder.AppendLine(string.Format("<div style=\"display:none;\" id=\"{0}\">", id)); stringBuilder.AppendLine("<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">"); foreach (var templateDocumentationPage in templatesDir.ContainingTemplateDocPages) { var locTemplate = templateDocumentationPage.CurrentLocalization; var description = _objectConverter.Convert(locTemplate.SummaryOrDescription, templateDocumentationPage); description = description.Replace("../", ""); //correct relative paths in images stringBuilder.AppendLine(string.Format("<tr><td>{0} </td><td><div class=\"boximage\"><img src=\"{1}\"></div></td><td><a href=\"{2}\">{3}</a></td><td>{4}</td></tr>", spaces, templateDocumentationPage.Icon, locTemplate.FilePath, locTemplate.Name, description)); } foreach (var dir in templatesDir.SubDirectories) { stringBuilder.AppendLine("<tr><td colspan=\"4\">"); WalkTemplateDirectory(dir, stringBuilder, depth + 1, lang); stringBuilder.AppendLine("</td></tr>"); } stringBuilder.AppendLine("</table>"); stringBuilder.AppendLine("</div>"); }
public override void Generate(TemplateDirectory templatesDir) { _templatesDir = templatesDir; _objectConverter = new ObjectConverter(DocPages, OutputDir); GenerateDocPages(); GenerateComponentIndexPages(); GenerateTemplateIndexPages(); GenerateEditorIndexPages(); GenerateCommonIndexPages(); CopyAdditionalResources(); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (TemplateDirectory.Substring(TemplateDirectory.Length - 1) != "/" || TemplateDirectory.Substring(TemplateDirectory.Length - 1) != "\\") { TemplateDirectory += "\\"; } string fileName = TemplateDirectory + TemplateName + ".template"; InformationCardTemplate ict = ManagedCardHelper.LoadCardTemplate(fileName); Result = ict; return(base.Execute(executionContext)); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (TemplateDirectory.Substring(TemplateDirectory.Length - 1) == "/" || TemplateDirectory.Substring(TemplateDirectory.Length - 1) == "\\") { TemplateDirectory += "\\"; } string fileName = TemplateDirectory + TemplateName; ManagedCardHelper.SaveCardTemplate(Template, fileName); return(base.Execute(executionContext)); }
private void GetTemplates(TemplateDirectory templatesDir, string lang, string path) { foreach (var template in templatesDir.ContainingTemplateDocPages) { var p = template.CurrentLocalization.CategoryPath() + "\\ " + template.CurrentLocalization.Name; itemlist.Add(template.CurrentLocalization.Name, ItemType.Template, p); } foreach (var dir in templatesDir.SubDirectories) { GetTemplates(dir, lang, path + dir.LocalizedInfos[lang].Name + "\\ "); } }
public TemplateStorage GetStorage(TemplateDefinition definition) { var storage = new TemplateStorage(); var list = new List <TemplateFile>(); var pub = new TemplateDirectory("public"); foreach (var f in Directory.GetFiles(Path.Combine(WorkDir, "public"), "*.tt")) { pub.Files.Add(new TemplateFile(new FileInfo(f).Name, f, "C#")); } storage.Directories.Add(pub); storage.FromDefinition(definition); return(storage); }
/// <summary> /// Updates module settings. /// </summary> public void Update() { var controller = new ModuleController(); { controller.UpdateModuleSetting(_moduleId, "PortalId", PortalId.ToString()); string showPaging = ShowPaging.ToString(); { controller.UpdateModuleSetting(_moduleId, "ShowPaging", showPaging); } if (!String.IsNullOrEmpty(TemplateDirectory)) { controller.UpdateModuleSetting(_moduleId, "TemplateDirectory", TemplateDirectory.ToString()); } string pageSize = PageSize.ToString(); { controller.UpdateModuleSetting(_moduleId, "PageSize", pageSize); } string showDateFilter = ShowDateFilter.ToString(); { controller.UpdateModuleSetting(_moduleId, "ShowDateFilter", showDateFilter); } string learnerModuleId = LearnerModuleId.ToString(); { controller.UpdateModuleSetting(_moduleId, "LearnerModuleId", learnerModuleId); } string beginDate = BeginDate.ToString(); { controller.UpdateModuleSetting(_moduleId, "BeginDate", beginDate); } string endDate = EndDate.ToString(); { controller.UpdateModuleSetting(_moduleId, "EndDate", endDate); } string dateRange = DateRange; { controller.UpdateModuleSetting(_moduleId, "DateRange", dateRange); } } }
/// <summary> /// Updates module settings. /// </summary> public void Update() { var controller = new ModuleController(); { controller.UpdateModuleSetting(_moduleId, "PortalId", PortalId.ToString()); if (!String.IsNullOrEmpty(TemplateDirectory)) { controller.UpdateModuleSetting(_moduleId, "TemplateDirectory", TemplateDirectory.ToString()); } string showChart = ShowChart.ToString(); { controller.UpdateModuleSetting(_moduleId, "ShowChart", showChart); } } }
private void GenerateTemplateOverviewTableSection(TemplateDirectory templatesDir, StringBuilder stringBuilder, int depth, string lang) { const string hspace = "\\hspace{2mm} "; var spaces = (depth > 0) ? String.Format("\\hspace{{{0}mm}} ", depth * 4) : ""; stringBuilder.AppendLine("\\multicolumn{2}{l}{" + spaces + " \\textbf{" + Helper.EscapeLaTeX(templatesDir.GetName(lang)) + "}} \\\\"); Boolean itemadded = false; foreach (var templateDocumentationPage in templatesDir.ContainingTemplateDocPages) { var locTemplate = templateDocumentationPage.CurrentLocalization; // get icon String includeIcon = (locTemplate.Icon != null) ? "\\includegraphics[width=16pt, height=16pt]{" + _objectConverter.GetImagePath(locTemplate.Icon, templateDocumentationPage.Name) + "}" : "\\hspace{16pt}"; includeIcon = "\\begin{minipage}[c]{16pt}" + includeIcon + "\\end{minipage}"; // get templateName String templateName = Helper.EscapeLaTeX(templateDocumentationPage.CurrentLocalization.Name); templateName = "\\begin{flushleft}" + templateName + "\\end{flushleft}"; templateName = "\\begin{minipage}[t]{0.4\\textwidth}" + templateName + "\\end{minipage}"; // get summary String summary = _objectConverter.Convert(locTemplate.Summary, templateDocumentationPage); summary = "\\begin{flushleft}" + summary + "\\end{flushleft}"; summary = "\\begin{minipage}[t]{0.6\\textwidth}" + summary + "\\end{minipage}"; stringBuilder.AppendLine(String.Format("{0} {1} {2} & {3} \\\\", spaces + hspace, includeIcon, templateName, summary)); itemadded = true; } if (itemadded) { stringBuilder.AppendLine("\\\\"); } foreach (var dir in templatesDir.SubDirectories) { GenerateTemplateOverviewTableSection(dir, stringBuilder, depth + 1, lang); } }
public TemplateStorage GetStorage(TemplateDefinition definition) { var storage = new TemplateStorage(); var list = new List <TemplateFile>(); var pub = new TemplateDirectory("public"); foreach (var f in Directory.GetFiles(Path.Combine(WorkDir, "public"), "*.vm")) { pub.Files.Add(new TemplateFile(new FileInfo(f).Name, f, "C#")); } storage.Directories.Add(pub); foreach (var p in definition.Partitions) { storage.Files.Add(new TemplateFile(string.Format("{1} ({0})", p.Name, p.FileName), p.FilePath, "C#")); } return(storage); }
public List <string> CategoryPathList() { List <string> categories = new List <string>(); TemplateDirectory tdir = ((TemplateDocumentationPage)DocumentationPage).TemplateDir; while (tdir != null) { string name; try { name = tdir.LocalizedInfos[Lang].Name; name = name.Trim(); } catch (System.Exception ex) { name = "???"; } categories.Insert(0, name); tdir = tdir.Parent; } return(categories); }
public override void Generate(TemplateDirectory templatesDir) { foreach (var lang in AvailableLanguages) { var cultureInfo = new CultureInfo(lang); Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; _templatesDir = templatesDir; _objectConverter = new ObjectConverter(DocPages, OutputDir); // // create LaTeX description of templates // var tableCode = GenerateTemplateOverviewTableCode(lang); var descriptionCode = GenerateTemplateDescriptionCode(lang); var versionString = GetVersion(); // write template description file var latexCode = Properties.Resources.LaTeXTmpl_Templates.Replace("$CONTENT$", tableCode + "\n" + descriptionCode); latexCode = latexCode.Replace("$VERSION$", versionString); StoreLaTeX(latexCode, "templates-" + lang + ".tex"); // write appendix for CT2 script latexCode = Properties.Resources.LaTeXTmpl_Appendix.Replace("$CONTENT$", tableCode); StoreLaTeX(latexCode, "appendix-" + lang + ".tex"); // // create LaTeX description of components // var componentDoc = GenerateComponentIndexPages(lang); latexCode = Properties.Resources.LaTeXTmpl_Components.Replace("$CONTENT$", componentDoc); latexCode = latexCode.Replace("$VERSION$", versionString); StoreLaTeX(latexCode, "components-" + lang + ".tex"); } }
public TemplateDocumentationPage(string templateFile, string relativeTemplateDirectory, TemplateDirectory templateDir) { _relativeTemplateDirectory = relativeTemplateDirectory; TemplateFile = templateFile; TemplateDir = templateDir; string templateXMLFile = Path.Combine(Path.GetDirectoryName(templateFile), Path.GetFileNameWithoutExtension(templateFile) + ".xml"); if (!File.Exists(templateXMLFile)) { throw new Exception(string.Format("Missing meta infos for template {0}!", templateFile)); } TemplateXML = XElement.Load(templateXMLFile); BitmapFrame icon = null; if (TemplateXML.Element("icon") != null && TemplateXML.Element("icon").Attribute("file") != null) { var iconFile = Path.Combine(Path.GetDirectoryName(templateFile), TemplateXML.Element("icon").Attribute("file").Value); if (iconFile == null || !File.Exists(iconFile)) { iconFile = Path.Combine(Path.GetDirectoryName(templateFile), Path.GetFileNameWithoutExtension(templateFile) + ".png"); } if (File.Exists(iconFile)) { try { icon = BitmapFrame.Create(new BitmapImage(new Uri(iconFile))); Icon = iconFile; } catch (Exception) { icon = null; Icon = ""; } } } var authorElement = XMLHelper.FindLocalizedChildElement(TemplateXML, "author"); if (authorElement != null) { AuthorName = authorElement.Value; } var relevantPlugins = TemplateXML.Element("relevantPlugins"); if (relevantPlugins != null) { RelevantPlugins = new List <string>(); foreach (var plugin in relevantPlugins.Elements("plugin")) { var name = plugin.Attribute("name"); if (name != null) { RelevantPlugins.Add(name.Value); } } } foreach (var title in TemplateXML.Elements("title")) { var langAtt = title.Attribute("lang"); if (langAtt != null && !AvailableLanguages.Contains(langAtt.Value)) { Localizations.Add(langAtt.Value, new LocalizedTemplateDocumentationPage(this, langAtt.Value, icon)); } } if (!Localizations.ContainsKey("en")) { throw new Exception("Documentation should at least support english language!"); } }
public WixEditData(WixEditData oldVersion, XmlDocument rawData) { BinDirectory = oldVersion.BinDirectory; DarkLocation = oldVersion.DarkLocation; CandleLocation = oldVersion.CandleLocation; LightLocation = oldVersion.LightLocation; if (oldVersion.XsdsLocation == null) { XmlNode node = rawData.SelectSingleNode("/WixEdit/XsdLocation"); if (node != null && node.InnerText.Length > 0) { XsdsLocation = Path.GetDirectoryName(node.InnerText); } } else { XsdsLocation = oldVersion.XsdsLocation; } // Some magic to deal with a new WixEdit installation including a newer WiX version... if (!String.IsNullOrEmpty(BinDirectory) && (String.IsNullOrEmpty(DarkLocation) && String.IsNullOrEmpty(CandleLocation) && String.IsNullOrEmpty(LightLocation) && String.IsNullOrEmpty(XsdsLocation))) { if (!Directory.Exists(BinDirectory)) { DirectoryInfo oldBinDirectory = new DirectoryInfo(BinDirectory); if (oldBinDirectory.Parent != null) { FileInfo[] files = oldBinDirectory.Parent.GetFiles("candle.exe", SearchOption.AllDirectories); if (files.Length == 0 && oldBinDirectory.Parent.Parent != null) { files = oldBinDirectory.Parent.Parent.GetFiles("candle.exe", SearchOption.AllDirectories); } if (files.Length == 1) { BinDirectory = files[0].Directory.FullName; } else if (files.Length > 1) { ArrayList directoryList = new ArrayList(); foreach (FileInfo file in files) { directoryList.Add(file.Directory.FullName); } directoryList.Sort(); BinDirectory = (string)directoryList[directoryList.Count - 1]; } } } } TemplateDirectory = oldVersion.TemplateDirectory; if (!String.IsNullOrEmpty(TemplateDirectory)) { TemplateDirectory = TemplateDirectory.Replace("templates", "wizard"); } UseRelativeOrAbsolutePaths = oldVersion.UseRelativeOrAbsolutePaths; if (oldVersion.ExternalXmlEditor == null || oldVersion.ExternalXmlEditor.Length == 0) { ExternalXmlEditor = Path.Combine(Environment.SystemDirectory, "notepad.exe"); } else { ExternalXmlEditor = oldVersion.ExternalXmlEditor; } UseInstanceOnly = oldVersion.UseInstanceOnly; WordWrapInResultsPanel = oldVersion.WordWrapInResultsPanel; if (oldVersion.IgnoreFilesAndDirectories != null && oldVersion.IgnoreFilesAndDirectories.Count > 0) { IgnoreFilesAndDirectories = oldVersion.IgnoreFilesAndDirectories; } else { ArrayList oldValues = new ArrayList(); XmlNodeList nodes = rawData.SelectNodes("/WixEdit/IgnoreFilesAndDirectories/string"); foreach (XmlNode node in nodes) { oldValues.Add(node.InnerText); } if (oldValues.Count > 0) { IgnoreFilesAndDirectories = oldValues; } } RecentOpenedFiles = oldVersion.RecentOpenedFiles; DisplayFullPathInTitlebar = oldVersion.DisplayFullPathInTitlebar; XmlIndentation = oldVersion.XmlIndentation; AllowIncludeChanges = oldVersion.AllowIncludeChanges; BackupChangedIncludes = oldVersion.BackupChangedIncludes; if (oldVersion.EditDialog == null) { EditDialog = new EditDialogData(); } else { EditDialog = oldVersion.EditDialog; } Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
/// <summary> /// Generates all specified pages and an index page. /// </summary> public abstract void Generate(TemplateDirectory templatesDir);
public List <TemplateRow> GetTemplates( string groupName, string instanceName, string connectionType ) { string sqlQuery = string.Format( @"SELECT DISTINCT {0}.[{20}] ,{0}.{6} ,{0}.{7} ,{0}.{8} FROM {2} INNER JOIN {1} ON {2}.[{21}] = {1}.{9} INNER JOIN {3} ON {1}.[{22}] = {3}.{10} INNER JOIN {4} ON {4}.[{23}] = {3}.{11} INNER JOIN {5} ON {5}.[{24}] = {4}.{12} INNER JOIN {0} ON {0}.[{20}] = {5}.{13} WHERE {2}.{14} = '{17}' AND {1}.{15} = '{18}' AND {1}.{16} = '{19}'" , TemplateDirectory.TableName, ServerInstanceDirectory.TableName, ConnectionGroupDirectory.TableName, QueryDirectory.TableName, TemplateNodeQueryDirectory.TableName, TemplateNodeDirectory.TableName, TemplateDirectory.NameFieldName, TemplateDirectory.IdFieldName, TemplateDirectory.DirFieldName, ConnectionGroupDirectory.TableName.AsFk(), ServerInstanceDirectory.TableName.AsFk(), TemplateNodeQueryDirectory.TableName.AsFk(), TemplateNodeDirectory.TableName.AsFk(), TemplateDirectory.TableName.AsFk(), ConnectionGroupDirectory.NameFn, ServerInstanceDirectory.ConnectionNameFn, ServerInstanceDirectory.DbTypeFn, groupName, instanceName, connectionType, TemplateDirectory.TableIdentityField, ConnectionGroupDirectory.TableIdentityField, ServerInstanceDirectory.TableIdentityField, TemplateNodeQueryDirectory.TableIdentityField, TemplateNodeDirectory.TableIdentityField ); List <TemplateRow> result = new List <TemplateRow>(); TableDefinition definition = TemplateDirectory.CreateTableDefinition(); new SqlSelectCommand( this._storage.Connection, sqlQuery, reader => { ITableRow row = TableRow.Read(definition, reader); result.Add(RowConverter.Convert <TemplateRow>(row)); } ).Execute(100); return(result); }