/// <summary> /// Display the object in Tree View /// </summary> /// <param name="obj">The object to display</param> /// <param name="RopNameforBinaryStructure">The string value used to as the name of tree node for object which is bianry value</param> public void DisplayObject(object obj, string RopNameforBinaryStructure) { if (obj == null) { return; } else if (obj.GetType().Name == "String") { this.FSSHTTPandWOPIViewControl.BeginUpdate(); this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.Visible = true; this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.Text = obj.ToString(); this.FSSHTTPandWOPIViewControl.EndUpdate(); } else { this.FSSHTTPandWOPIViewControl.BeginUpdate(); TreeNode topNode = BaseStructure.ObjectToTreeNode(obj, RopNameforBinaryStructure); topNode = BaseStructure.RemoveAnySpecifiedTreeNode(topNode); int index = 1; topNode = BaseStructure.AddserialNumForFSSHTTPBTreeNode(topNode, ref index); this.FSSHTTPandWOPIViewControl.Nodes.Add(topNode); this.FSSHTTPandWOPIViewControl.Nodes[this.FSSHTTPandWOPIViewControl.Nodes.Count - 1].EnsureVisible(); topNode.ExpandAll(); this.FSSHTTPandWOPIViewControl.EndUpdate(); } }
/// <summary> /// Display the object in Tree View /// </summary> /// <param name="obj">The object to display</param> /// <param name="RopNameforBinaryStructure">The string value used to as the name of tree node for object which is bianry value</param> public void DisplayObject(object obj, string RopNameforBinaryStructure) { try { if (obj == null) { return; } else if (obj.GetType().Name == "String") { this.FSSHTTPandWOPIViewControl.BeginUpdate(); this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.Visible = true; if (isErrorCodeDuplicate) { string[] xmlFragments = obj.ToString().Split(new[] { '>' }, StringSplitOptions.RemoveEmptyEntries); int startNum = 0; int endNum = 0; for (int i = 0; i < xmlFragments.Length; i++) { xmlFragments[i] += ">"; if (xmlFragments[i].Contains("</")) { endNum += 1; } int n = startNum - endNum; while (n > 0) { this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.AppendText(" "); n--; } this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.AppendText(xmlFragments[i]); this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.AppendText("\n"); if (!xmlFragments[i].Contains("</")) { startNum += 1; } if (xmlFragments[i].Contains("/>")) { endNum += 1; } } } else { this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.Text = obj.ToString(); } this.FSSHTTPandWOPIViewControl.EndUpdate(); } else { this.FSSHTTPandWOPIViewControl.BeginUpdate(); TreeAndHexViewAdjust(false); TreeNode topNode = BaseStructure.ObjectToTreeNode(obj, RopNameforBinaryStructure); topNode = BaseStructure.RemoveAnySpecifiedTreeNode(topNode); int index = 1; topNode = BaseStructure.AddserialNumForFSSHTTPBTreeNode(topNode, ref index); this.FSSHTTPandWOPIViewControl.Nodes.Add(topNode); this.FSSHTTPandWOPIViewControl.Nodes[this.FSSHTTPandWOPIViewControl.Nodes.Count - 1].EnsureVisible(); topNode.ExpandAll(); this.FSSHTTPandWOPIViewControl.EndUpdate(); } } catch (Exception e) { this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.Visible = true; this.FSSHTTPandWOPIControl.FSSHTTPandWOPIRichTextBox.Text = e.Message; this.FSSHTTPandWOPIViewControl.EndUpdate(); } }