in Common/Product/SharedProject/HierarchyNode.cs [584:787]
public virtual object GetProperty(int propId) {
object result = null;
switch ((__VSHPROPID)propId) {
case __VSHPROPID.VSHPROPID_Expandable:
result = (this.firstChild != null);
break;
case __VSHPROPID.VSHPROPID_Caption:
result = this.Caption;
break;
case __VSHPROPID.VSHPROPID_Name:
result = Name;
break;
case __VSHPROPID.VSHPROPID_ExpandByDefault:
result = false;
break;
#if !DEV14_OR_LATER
case __VSHPROPID.VSHPROPID_IconImgList:
result = this.ProjectMgr.ImageHandler.ImageList.Handle;
break;
case __VSHPROPID.VSHPROPID_OpenFolderIconIndex:
case __VSHPROPID.VSHPROPID_IconIndex:
int index = ImageIndex;
if (index != NoImage) {
result = index;
}
break;
case __VSHPROPID.VSHPROPID_IconHandle:
result = GetIconHandle(false);
break;
case __VSHPROPID.VSHPROPID_OpenFolderIconHandle:
result = GetIconHandle(true);
break;
#endif
case __VSHPROPID.VSHPROPID_StateIconIndex:
result = (int)this.StateIconIndex;
break;
case __VSHPROPID.VSHPROPID_OverlayIconIndex:
result = (int)this.OverlayIconIndex;
break;
case __VSHPROPID.VSHPROPID_NextVisibleSibling:
var nextVisible = NextVisibleSibling;
result = (int)((nextVisible != null) ? nextVisible.ID : VSConstants.VSITEMID_NIL);
break;
case __VSHPROPID.VSHPROPID_NextSibling:
result = (int)((this.nextSibling != null) ? this.nextSibling.hierarchyId : VSConstants.VSITEMID_NIL);
break;
case __VSHPROPID.VSHPROPID_IsNonMemberItem:
result = IsNonMemberItem;
break;
case __VSHPROPID.VSHPROPID_IsHiddenItem:
result = !IsVisible;
break;
case __VSHPROPID.VSHPROPID_IsNonSearchable:
result = !IsSearchable;
break;
case __VSHPROPID.VSHPROPID_FirstChild:
result = (int)((this.firstChild != null) ? this.firstChild.hierarchyId : VSConstants.VSITEMID_NIL);
break;
case __VSHPROPID.VSHPROPID_FirstVisibleChild:
var firstVisible = FirstVisibleChild;
result = (int)((firstVisible != null) ? firstVisible.hierarchyId : VSConstants.VSITEMID_NIL);
break;
case __VSHPROPID.VSHPROPID_Parent:
if (null == this.parentNode) {
unchecked { result = new IntPtr((int)VSConstants.VSITEMID_NIL); }
} else {
result = new IntPtr((int)this.parentNode.hierarchyId); // see bug 176470
}
break;
case __VSHPROPID.VSHPROPID_Root:
result = Marshal.GetIUnknownForObject(this.projectMgr);
break;
case __VSHPROPID.VSHPROPID_Expanded:
result = this.IsExpanded;
break;
case __VSHPROPID.VSHPROPID_BrowseObject:
result = this.NodeProperties;
if (result != null)
result = new DispatchWrapper(result);
break;
case __VSHPROPID.VSHPROPID_EditLabel:
if (this.ProjectMgr != null && !this.ProjectMgr.IsClosed && !this.ProjectMgr.IsCurrentStateASuppressCommandsMode()) {
result = GetEditLabel();
}
break;
case __VSHPROPID.VSHPROPID_SaveName:
//SaveName is the name shown in the Save and the Save Changes dialog boxes.
result = this.Caption;
break;
case __VSHPROPID.VSHPROPID_ExtObject:
#if DEBUG
try {
#endif
result = GetAutomationObject();
#if DEBUG
} catch (Exception e) {
Debug.WriteLine(String.Format("Failed to get automation object for node {1}: {0}", e, this));
throw;
}
#endif
break;
}
__VSHPROPID2 id2 = (__VSHPROPID2)propId;
switch (id2) {
case __VSHPROPID2.VSHPROPID_IsLinkFile:
result = IsLinkFile;
break;
case __VSHPROPID2.VSHPROPID_NoDefaultNestedHierSorting:
return true; // We are doing the sorting ourselves through VSHPROPID_FirstChild and VSHPROPID_NextSibling
case __VSHPROPID2.VSHPROPID_CfgBrowseObjectCATID:
case __VSHPROPID2.VSHPROPID_BrowseObjectCATID: {
// If there is a browse object and it is a NodeProperties, then get it's CATID
object browseObject = this.GetProperty((int)__VSHPROPID.VSHPROPID_BrowseObject);
if (browseObject != null) {
if (browseObject is DispatchWrapper)
browseObject = ((DispatchWrapper)browseObject).WrappedObject;
result = this.ProjectMgr.GetCATIDForType(browseObject.GetType()).ToString("B");
if (String.Equals(result as string, Guid.Empty.ToString("B"), StringComparison.Ordinal))
result = null;
}
break;
}
case __VSHPROPID2.VSHPROPID_ExtObjectCATID: {
// If there is a extensibility object and it is a NodeProperties, then get it's CATID
object extObject = this.GetProperty((int)__VSHPROPID.VSHPROPID_ExtObject);
if (extObject != null) {
if (extObject is DispatchWrapper)
extObject = ((DispatchWrapper)extObject).WrappedObject;
result = this.ProjectMgr.GetCATIDForType(extObject.GetType()).ToString("B");
if (String.Equals(result as string, Guid.Empty.ToString("B"), StringComparison.Ordinal))
result = null;
}
break;
}
}
#if DEV11_OR_LATER
__VSHPROPID5 id5 = (__VSHPROPID5)propId;
switch (id5) {
case __VSHPROPID5.VSHPROPID_ProvisionalViewingStatus:
result = ProvisionalViewingStatus;
break;
}
#endif
#if DEV14_OR_LATER
__VSHPROPID8 id8 = (__VSHPROPID8)propId;
switch (id8) {
case __VSHPROPID8.VSHPROPID_SupportsIconMonikers:
result = SupportsIconMonikers;
break;
case __VSHPROPID8.VSHPROPID_IconMonikerGuid:
result = GetIconMoniker(false).Guid;
break;
case __VSHPROPID8.VSHPROPID_IconMonikerId:
result = GetIconMoniker(false).Id;
break;
case __VSHPROPID8.VSHPROPID_OpenFolderIconMonikerGuid:
result = GetIconMoniker(true).Guid;
break;
case __VSHPROPID8.VSHPROPID_OpenFolderIconMonikerId:
result = GetIconMoniker(true).Id;
break;
}
#endif
#if DEBUG
if (propId != LastTracedProperty) {
string trailer = (result == null) ? "null" : result.ToString();
LastTracedProperty = propId; // some basic filtering here...
}
#endif
return result;
}