本文整理汇总了C#中MonoDevelop.Projects.ProjectReference类的典型用法代码示例。如果您正苦于以下问题:C# ProjectReference类的具体用法?C# ProjectReference怎么用?C# ProjectReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectReference类属于MonoDevelop.Projects命名空间,在下文中一共展示了ProjectReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReferenceName
public static string GetReferenceName(ProjectReference pref)
{
string stored = pref.StoredReference;
int idx =stored.IndexOf (",");
if (idx == -1)
return stored.Trim ();
return stored.Substring (0, idx).Trim ();
}
示例2: IsQyotoReference
public static bool IsQyotoReference(ProjectReference pref)
{
if (pref.ReferenceType != ReferenceType.Gac)
return false;
int idx = pref.StoredReference.IndexOf(",");
if (idx == -1)
return false;
string name = pref.StoredReference.Substring(0, idx).Trim();
return name == "qt-dotnet";
}
示例3: AddReference
public ProjectReference AddReference (string filename)
{
foreach (ProjectReference rInfo in References) {
if (rInfo.Reference == filename) {
return rInfo;
}
}
ProjectReference newReferenceInformation = new ProjectReference (ReferenceType.Assembly, filename);
References.Add (newReferenceInformation);
return newReferenceInformation;
}
示例4: CreateProjectDescriptor
public static ProjectDescriptor CreateProjectDescriptor (XmlElement xmlElement, FilePath baseDirectory)
{
ProjectDescriptor projectDescriptor = new ProjectDescriptor ();
projectDescriptor.name = xmlElement.GetAttribute ("name");
projectDescriptor.type = xmlElement.GetAttribute ("type");
if (String.IsNullOrEmpty (projectDescriptor.type))
projectDescriptor.type = "DotNet";
if (xmlElement["Files"] != null) {
foreach (XmlNode xmlNode in xmlElement["Files"].ChildNodes)
if (xmlNode is XmlElement)
projectDescriptor.files.Add (
FileDescriptionTemplate.CreateTemplate ((XmlElement)xmlNode, baseDirectory));
}
if (xmlElement["Resources"] != null) {
foreach (XmlNode xmlNode in xmlElement["Resources"].ChildNodes) {
if (xmlNode is XmlElement) {
var fileTemplate = FileDescriptionTemplate.CreateTemplate ((XmlElement)xmlNode, baseDirectory);
if (fileTemplate is SingleFileDescriptionTemplate)
projectDescriptor.resources.Add ((SingleFileDescriptionTemplate)fileTemplate);
else
MessageService.ShowError (GettextCatalog.GetString ("Only single-file templates allowed to generate resource files"));
}
}
}
if (xmlElement["References"] != null) {
foreach (XmlNode xmlNode in xmlElement["References"].ChildNodes) {
XmlElement elem = (XmlElement)xmlNode;
var refType = elem.GetAttribute ("type");
ProjectReference projectReference = new ProjectReference ((ReferenceType)Enum.Parse (typeof(ReferenceType), refType), elem.GetAttribute ("refto"));
string specificVersion = elem.GetAttribute ("SpecificVersion");
if (!string.IsNullOrEmpty (specificVersion))
projectReference.SpecificVersion = bool.Parse (specificVersion);
projectDescriptor.references.Add (projectReference);
}
}
projectDescriptor.projectOptions = xmlElement["Options"];
if (projectDescriptor.projectOptions == null)
projectDescriptor.projectOptions = xmlElement.OwnerDocument.CreateElement ("Options");
return projectDescriptor;
}
示例5: OnProjectReferenceAdded
internal virtual void OnProjectReferenceAdded (ProjectReference pref)
{
ProjectDom dom = ProjectDomService.GetDom (pref.Reference, true);
if (dom != null && references != null)
this.references.Add (dom);
}
示例6: PossibleNamespace
public PossibleNamespace (string @namespace, bool isAccessibleWithGlobalUsing, MonoDevelop.Projects.ProjectReference reference = null)
{
this.Namespace = @namespace;
this.IsAccessibleWithGlobalUsing = isAccessibleWithGlobalUsing;
this.Reference = reference;
}
示例7: Reference
public Reference (Project project, MD.ProjectReference referenceProjectItem)
{
this.project = project;
this.referenceProjectItem = referenceProjectItem;
}
示例8: Execute_ReferenceHasLocalCopyFalseWhenUninstalled_ReferenceHasLocalCopyFalseAfterBeingReinstalled
public void Execute_ReferenceHasLocalCopyFalseWhenUninstalled_ReferenceHasLocalCopyFalseAfterBeingReinstalled ()
{
CreateAction ("MyPackage", "1.2.3.4");
FakePackage package = AddPackageToSourceRepository ("MyPackage", "1.2.3.4");
var firstReferenceBeingAdded = new ProjectReference (ReferenceType.Assembly, "NewAssembly");
var secondReferenceBeingAdded = new ProjectReference (ReferenceType.Assembly, "NUnit.Framework");
project.FakeUninstallPackageAction.ExecuteAction = () => {
var referenceBeingRemoved = new ProjectReference (ReferenceType.Assembly, "NUnit.Framework") {
LocalCopy = false
};
packageManagementEvents.OnReferenceRemoving (referenceBeingRemoved);
};
bool installActionMaintainsLocalCopyReferences = false;
project.InstallPackageExecuteAction = () => {
installActionMaintainsLocalCopyReferences = project.LastInstallPackageCreated.PreserveLocalCopyReferences;
packageManagementEvents.OnReferenceAdding (firstReferenceBeingAdded);
packageManagementEvents.OnReferenceAdding (secondReferenceBeingAdded);
};
action.Execute ();
Assert.IsTrue (firstReferenceBeingAdded.LocalCopy);
Assert.IsFalse (secondReferenceBeingAdded.LocalCopy);
Assert.IsFalse (installActionMaintainsLocalCopyReferences, "Should be false since the reinstall action will maintain the local copies");
}
示例9: OnNodeDrop
public override void OnNodeDrop (object dataObject, DragOperation operation)
{
// It allows dropping either project references or projects.
// Dropping a project creates a new project reference to that project
DotNetProject project = dataObject as DotNetProject;
if (project != null) {
ProjectReference pr = new ProjectReference (project);
DotNetProject p = CurrentNode.GetParentDataItem (typeof(DotNetProject), false) as DotNetProject;
// Circular dependencies are not allowed.
if (HasCircularReference (project, p.Name))
return;
// If the reference already exists, bail out
if (ProjectReferencesProject (p, project.Name))
return;
p.References.Add (pr);
IdeApp.ProjectOperations.Save (p);
return;
}
// It's dropping a ProjectReference object.
ProjectReference pref = dataObject as ProjectReference;
ITreeNavigator nav = CurrentNode;
if (operation == DragOperation.Move) {
NodePosition pos = nav.CurrentPosition;
nav.MoveToObject (dataObject);
DotNetProject p = nav.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject;
nav.MoveToPosition (pos);
DotNetProject p2 = nav.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject;
p.References.Remove (pref);
// Check if there is a cyclic reference after removing from the source project
if (pref.ReferenceType == ReferenceType.Project) {
DotNetProject pdest = p.ParentSolution.FindProjectByName (pref.Reference) as DotNetProject;
if (pdest == null || ProjectReferencesProject (pdest, p2.Name)) {
// Restore the dep
p.References.Add (pref);
return;
}
}
p2.References.Add (pref);
IdeApp.ProjectOperations.Save (p);
IdeApp.ProjectOperations.Save (p2);
} else {
nav.MoveToParent (typeof(DotNetProject));
DotNetProject p = nav.DataItem as DotNetProject;
// Check for cyclic referencies
if (pref.ReferenceType == ReferenceType.Project) {
DotNetProject pdest = p.ParentSolution.FindProjectByName (pref.Reference) as DotNetProject;
if (pdest == null)
return;
if (HasCircularReference (pdest, p.Name))
return;
// The reference is already there
if (ProjectReferencesProject (p, pdest.Name))
return;
}
p.References.Add ((ProjectReference) pref.Clone ());
IdeApp.ProjectOperations.Save (p);
}
}
示例10: AddReference
public void AddReference (ProjectReference pref)
{
TreeIter iter = FindReference (pref.ReferenceType, pref.Reference);
if (!iter.Equals (TreeIter.Zero))
return;
TreeIter ni = AppendReference (pref);
if (!ni.Equals (TreeIter.Zero))
ReferencesTreeView.ScrollToCell (refTreeStore.GetPath (ni), null, false, 0, 0);
}
示例11: GetTypeText
string GetTypeText (ProjectReference pref)
{
switch (pref.ReferenceType) {
case ReferenceType.Package: return GettextCatalog.GetString ("Package");
case ReferenceType.Assembly: return GettextCatalog.GetString ("Assembly");
case ReferenceType.Project: return GettextCatalog.GetString ("Project");
default: return "";
}
}
示例12: AddPackageReference
TreeIter AddPackageReference (ProjectReference refInfo)
{
string txt = GLib.Markup.EscapeText (System.IO.Path.GetFileNameWithoutExtension (refInfo.Reference));
int i = refInfo.Reference.IndexOf (',');
if (i != -1)
txt = GLib.Markup.EscapeText (txt.Substring (0, i)) + "\n<span color='darkgrey'><small>" + GLib.Markup.EscapeText (refInfo.Reference.Substring (i+1).Trim()) + "</small></span>";
return refTreeStore.AppendValues (txt, GetTypeText (refInfo), refInfo.Reference, refInfo, ImageService.GetIcon ("md-package", IconSize.Dnd));
}
示例13: AddProjectReference
TreeIter AddProjectReference (ProjectReference refInfo)
{
Solution c = configureProject.ParentSolution;
if (c == null) return TreeIter.Zero;
Project p = c.FindProjectByName (refInfo.Reference);
if (p == null) return TreeIter.Zero;
string txt = GLib.Markup.EscapeText (System.IO.Path.GetFileName (refInfo.Reference)) + "\n";
txt += "<span color='darkgrey'><small>" + GLib.Markup.EscapeText (p.BaseDirectory.ToString ()) + "</small></span>";
return refTreeStore.AppendValues (txt, GetTypeText (refInfo), p.BaseDirectory.ToString (), refInfo, ImageService.GetIcon ("md-project", IconSize.Dnd));
}
示例14: AddAssemplyReference
TreeIter AddAssemplyReference (ProjectReference refInfo)
{
string txt = GLib.Markup.EscapeText (System.IO.Path.GetFileName (refInfo.Reference)) + "\n";
txt += "<span color='darkgrey'><small>" + GLib.Markup.EscapeText (System.IO.Path.GetFullPath (refInfo.Reference)) + "</small></span>";
return refTreeStore.AppendValues (txt, GetTypeText (refInfo), System.IO.Path.GetFullPath (refInfo.Reference), refInfo, ImageService.GetIcon ("md-empty-file-icon", IconSize.Dnd));
}
示例15: AppendReference
TreeIter AppendReference (ProjectReference refInfo)
{
foreach (var p in panels)
p.SignalRefChange (refInfo, true);
switch (refInfo.ReferenceType) {
case ReferenceType.Assembly:
return AddAssemplyReference (refInfo);
case ReferenceType.Project:
return AddProjectReference (refInfo);
case ReferenceType.Package:
return AddPackageReference (refInfo);
default:
return TreeIter.Zero;
}
}