public ComPropertyInfoTreeNode(ComPropertyInfo comFunctionInfo) : base() { _comPropertyInfo = comFunctionInfo; Text = _comPropertyInfo.Name; FullText = String.Format("{0}.{1}", _comPropertyInfo.ComTypeInfo.FullName, _comPropertyInfo.Name); }
private void UpdateRichTextBox(ComTreeNode node) { try { typeInfoRichTextBox.Clear(); if (node == null) { return; } ComTypeInfo comTypeInfo = null; ComPropertyInfo comPropertyInfo = null; ComFunctionInfo comFunctionInfo = null; if (node is ComPtrItemTreeNode) { comFunctionInfo = ((ComPtrItemTreeNode)node).ComFunctionInfo; } else if (node is ComMethodTreeNode) { comFunctionInfo = ((ComMethodTreeNode)node).ComFunctionInfo; } else if (node is ComPropertyTreeNode) { comPropertyInfo = ((ComPropertyTreeNode)node).ComPropertyInfo; } else if (node is ComPtrTreeNode) { ComPtrTreeNode comObjectPropertyTreeNode = (ComPtrTreeNode)node; if (comObjectPropertyTreeNode.ComPropertyInfo != null) { comPropertyInfo = comObjectPropertyTreeNode.ComPropertyInfo; } else { comTypeInfo = comObjectPropertyTreeNode.ComPtr.TryGetComTypeInfo(); } } if (comTypeInfo != null) { typeInfoRichTextBox.DescribeComTypeInfo(comTypeInfo); } else if (comPropertyInfo != null) { typeInfoRichTextBox.DescribeComPropertyInfo(comPropertyInfo); } else if (comFunctionInfo != null) { typeInfoRichTextBox.DescribeComFunctionInfo(comFunctionInfo); } } catch { GlobalExceptionHandler.HandleException(); } }
public ComPtrTreeNode(ComPropertyInfo comPropertyInfo, ComPtr comPtr) : this(comPropertyInfo.Name, comPtr) { _comPropertyInfo = comPropertyInfo; if ((_comPropertyInfo != null) && (_comPropertyInfo.GetFunction != null)) { _comFunctionInfo = _comPropertyInfo.GetFunction; _getFunctionHasParameters = _comPropertyInfo.GetFunctionHasParameters; } }
public ComPropertyTreeNode(ComPropertyInfo comPropertyInfo, object value) : base(comPropertyInfo.Name) { _comPropertyInfo = comPropertyInfo; if (value != null) { Value = value.ToString(); TypeFullName = value.GetType().Name; } }
public void DescribeComPropertyInfo(ComPropertyInfo comPropertyInfo) { try { Clear(); if (comPropertyInfo == null) { return; } ComFunctionInfo comFunctionInfo = comPropertyInfo.GetFunction; WriteReturnParameter(comFunctionInfo.ReturnParameter); AppendText(String.Format(" {0}", comFunctionInfo.Name), ForeColor, FontStyle.Bold); if (comFunctionInfo.Parameters.Length > 0) { AppendText("("); for (int i = 0; i < comFunctionInfo.Parameters.Length; i++) { ComParameterInfo parameter = comFunctionInfo.Parameters[i]; WriteParameter(parameter); if (i < comFunctionInfo.Parameters.Length - 1) { AppendText(", "); } } AppendText(")"); } //string Caption { set; get; } AppendText(" { "); if (comPropertyInfo.GetFunction != null) { AppendText("get; "); } if (comPropertyInfo.SetFunction != null) { AppendText("set; "); } AppendText("}"); AppendText(Environment.NewLine); AppendText(" Member of "); InsertLink(comFunctionInfo.ComTypeInfo.FullName); AppendText(Environment.NewLine); WriteSummary(comFunctionInfo.Description); WriteDispatchid(comFunctionInfo.DispId); } catch { } }
private ComTreeNode GetChild(ComPtr comPtr, ComPropertyInfo comPropertyInfo) { if (comPtr == null) { return(null); } if (comPropertyInfo == null) { return(null); } if (comPtr.IsInvalid) { return(null); } ComFunctionInfo getFunctionInfo = comPropertyInfo.GetFunction; if (getFunctionInfo == null) { return(null); } if (getFunctionInfo.IsRestricted) { return(null); } ComTreeNode comTreeNode = null; object propertyValue = null; if (getFunctionInfo.Parameters.Length == 0) { try { comPtr.TryInvokePropertyGet(getFunctionInfo.DispId, out propertyValue); } catch { GlobalExceptionHandler.HandleException(); } if (propertyValue == null) { switch (getFunctionInfo.ReturnParameter.VariantType) { case VarEnum.VT_DISPATCH: case VarEnum.VT_PTR: case VarEnum.VT_ARRAY: case VarEnum.VT_UNKNOWN: propertyValue = new ComPtr(IntPtr.Zero); break; } } if (propertyValue is ComPtr) { comTreeNode = new ComPtrTreeNode(comPropertyInfo, (ComPtr)propertyValue); if (((ComPtr)propertyValue).IsInvalid == false) { comTreeNode.Nodes.Add(String.Empty); } } else { comTreeNode = new ComPropertyTreeNode(comPropertyInfo, propertyValue); } } else { switch (getFunctionInfo.ReturnParameter.VariantType) { case VarEnum.VT_DISPATCH: case VarEnum.VT_PTR: case VarEnum.VT_ARRAY: case VarEnum.VT_UNKNOWN: comTreeNode = new ComPtrTreeNode(comPropertyInfo, new ComPtr()); break; default: comTreeNode = new ComPropertyTreeNode(comPropertyInfo, null); break; } } return(comTreeNode); }