本文整理汇总了C#中ICSharpCode.SharpDevelop.Project.ReferenceProjectItem.SetMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# ReferenceProjectItem.SetMetadata方法的具体用法?C# ReferenceProjectItem.SetMetadata怎么用?C# ReferenceProjectItem.SetMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpDevelop.Project.ReferenceProjectItem
的用法示例。
在下文中一共展示了ReferenceProjectItem.SetMetadata方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIronPythonReference
ReferenceProjectItem CreateIronPythonReference(IProject project)
{
ReferenceProjectItem reference = new ReferenceProjectItem(project, "IronPython");
reference.SetMetadata("HintPath", @"$(PythonBinPath)\IronPython.dll");
return reference;
}
示例2: FileTemplateImpl
public FileTemplateImpl(XmlDocument doc, IReadOnlyFileSystem fileSystem)
{
author = doc.DocumentElement.GetAttribute("author");
XmlElement config = doc.DocumentElement["Config"];
name = config.GetAttribute("name");
icon = SD.ResourceService.GetImage(config.GetAttribute("icon"));
category = config.GetAttribute("category");
defaultName = config.GetAttribute("defaultname");
languagename = config.GetAttribute("language");
if (config.HasAttribute("subcategory")) {
subcategory = config.GetAttribute("subcategory");
}
string newFileDialogVisibleAttr = config.GetAttribute("newfiledialogvisible");
if (newFileDialogVisibleAttr != null && newFileDialogVisibleAttr.Length != 0) {
if (newFileDialogVisibleAttr.Equals("false", StringComparison.OrdinalIgnoreCase))
newFileDialogVisible = false;
}
if (doc.DocumentElement["Description"] != null) {
description = doc.DocumentElement["Description"].InnerText;
}
if (config["Wizard"] != null) {
wizardpath = config["Wizard"].Attributes["path"].InnerText;
}
if (doc.DocumentElement["Properties"] != null) {
XmlNodeList propertyList = doc.DocumentElement["Properties"].SelectNodes("Property");
foreach (XmlElement propertyElement in propertyList) {
properties.Add(new TemplateProperty(propertyElement));
}
}
if (doc.DocumentElement["Types"] != null) {
XmlNodeList typeList = doc.DocumentElement["Types"].SelectNodes("Type");
foreach (XmlElement typeElement in typeList) {
customTypes.Add(new TemplateType(typeElement));
}
}
if (doc.DocumentElement["References"] != null) {
XmlNodeList references = doc.DocumentElement["References"].SelectNodes("Reference");
foreach (XmlElement reference in references) {
if (!reference.HasAttribute("include"))
throw new InvalidDataException("Reference without 'include' attribute!");
ReferenceProjectItem item = new ReferenceProjectItem(null, reference.GetAttribute("include"));
item.SetMetadata("HintPath", reference.GetAttribute("hintPath"));
var requiredTargetFramework = reference.GetElementsByTagName("RequiredTargetFramework").OfType<XmlElement>().FirstOrDefault();
if (requiredTargetFramework != null) {
item.SetMetadata("RequiredTargetFramework", requiredTargetFramework.Value);
}
requiredAssemblyReferences.Add(item);
}
}
if (doc.DocumentElement["Actions"] != null) {
foreach (XmlElement el in doc.DocumentElement["Actions"]) {
Action<FileTemplateResult> action = ReadAction(el);
if (action != null)
actions += action;
}
}
fileoptions = doc.DocumentElement["AdditionalOptions"];
// load the files
XmlElement files = doc.DocumentElement["Files"];
XmlNodeList nodes = files.ChildNodes;
foreach (XmlNode filenode in nodes) {
if (filenode is XmlElement) {
this.files.Add(new FileDescriptionTemplate((XmlElement)filenode, fileSystem));
}
}
}
示例3: AddReference
public void AddReference()
{
foreach (ListViewItem item in listView.SelectedItems) {
string include = chooseSpecificVersionCheckBox.Checked ? item.Tag.ToString() : item.Text;
ReferenceProjectItem rpi = new ReferenceProjectItem(selectDialog.ConfigureProject, include);
string requiredFrameworkVersion;
if (chooseSpecificVersionCheckBox.Checked) {
if (KnownFrameworkAssemblies.TryGetRequiredFrameworkVersion(item.Tag.ToString(), out requiredFrameworkVersion)) {
rpi.SetMetadata("RequiredTargetFramework", requiredFrameworkVersion);
}
} else {
// find the lowest version of the assembly and use its RequiredTargetFramework
ListViewItem lowestVersion = item;
foreach (ListViewItem item2 in fullItemList) {
if (item2.Text == item.Text) {
if (new Version(item2.SubItems[1].Text) < ((DomAssemblyName)lowestVersion.Tag).Version) {
lowestVersion = item2;
}
}
}
if (KnownFrameworkAssemblies.TryGetRequiredFrameworkVersion(lowestVersion.Tag.ToString(), out requiredFrameworkVersion)) {
rpi.SetMetadata("RequiredTargetFramework", requiredFrameworkVersion);
}
}
selectDialog.AddReference(
item.Text, "Gac", rpi.Include,
rpi
);
}
}
示例4: AddReferenceIfNotExists
void AddReferenceIfNotExists(string name, string requiredTargetFramework)
{
if (!(Project.GetItemsOfType(ItemType.Reference).Any(r => string.Equals(r.Include, name, StringComparison.OrdinalIgnoreCase)))) {
ReferenceProjectItem rpi = new ReferenceProjectItem(Project, name);
if (requiredTargetFramework != null)
rpi.SetMetadata("RequiredTargetFramework", requiredTargetFramework);
ProjectService.AddProjectItem(Project, rpi);
}
}
示例5: AddDotnet35References
protected internal virtual void AddDotnet35References()
{
ReferenceProjectItem rpi = new ReferenceProjectItem(this, "System.Core");
rpi.SetMetadata("RequiredTargetFramework", "3.5");
ProjectService.AddProjectItem(this, rpi);
if (GetItemsOfType(ItemType.Reference).Any(r => r.Include == "System.Data")) {
rpi = new ReferenceProjectItem(this, "System.Data.DataSetExtensions");
rpi.SetMetadata("RequiredTargetFramework", "3.5");
ProjectService.AddProjectItem(this, rpi);
}
if (GetItemsOfType(ItemType.Reference).Any(r => r.Include == "System.Xml")) {
rpi = new ReferenceProjectItem(this, "System.Xml.Linq");
rpi.SetMetadata("RequiredTargetFramework", "3.5");
ProjectService.AddProjectItem(this, rpi);
}
}
示例6: FileTemplate
public FileTemplate(string filename)
{
XmlDocument doc = new XmlDocument();
doc.Load(filename);
author = doc.DocumentElement.GetAttribute("author");
XmlElement config = doc.DocumentElement["Config"];
name = config.GetAttribute("name");
icon = config.GetAttribute("icon");
category = config.GetAttribute("category");
defaultName = config.GetAttribute("defaultname");
languagename = config.GetAttribute("language");
if (config.HasAttribute("subcategory")) {
subcategory = config.GetAttribute("subcategory");
}
string newFileDialogVisibleAttr = config.GetAttribute("newfiledialogvisible");
if (newFileDialogVisibleAttr != null && newFileDialogVisibleAttr.Length != 0) {
if (newFileDialogVisibleAttr.Equals("false", StringComparison.OrdinalIgnoreCase))
newFileDialogVisible = false;
}
if (doc.DocumentElement["Description"] != null) {
description = doc.DocumentElement["Description"].InnerText;
}
if (config["Wizard"] != null) {
wizardpath = config["Wizard"].Attributes["path"].InnerText;
}
if (doc.DocumentElement["Properties"] != null) {
XmlNodeList propertyList = doc.DocumentElement["Properties"].SelectNodes("Property");
foreach (XmlElement propertyElement in propertyList) {
properties.Add(new TemplateProperty(propertyElement));
}
}
if (doc.DocumentElement["Types"] != null) {
XmlNodeList typeList = doc.DocumentElement["Types"].SelectNodes("Type");
foreach (XmlElement typeElement in typeList) {
customTypes.Add(new TemplateType(typeElement));
}
}
if (doc.DocumentElement["References"] != null) {
XmlNodeList references = doc.DocumentElement["References"].SelectNodes("Reference");
foreach (XmlElement reference in references) {
if (!reference.HasAttribute("include"))
throw new InvalidDataException("Reference without 'include' attribute!");
ReferenceProjectItem item = new ReferenceProjectItem(null, reference.GetAttribute("include"));
item.SetMetadata("HintPath", reference.GetAttribute("hintPath"));
requiredAssemblyReferences.Add(item);
}
}
fileoptions = doc.DocumentElement["AdditionalOptions"];
doc.DocumentElement.SetAttribute("fileName", filename); // used for template loading warnings
// load the files
XmlElement files = doc.DocumentElement["Files"];
XmlNodeList nodes = files.ChildNodes;
foreach (XmlNode filenode in nodes) {
if (filenode is XmlElement) {
this.files.Add(new FileDescriptionTemplate((XmlElement)filenode, Path.GetDirectoryName(filename)));
}
}
}