コード例 #1
0
        /// <summary>
        /// Converts any fields of the specified type found in the descendants of the node into static text.
        /// </summary>
        /// <param name="compositeNode">The node in which all descendants of the specified FieldType will be converted to static text.</param>
        /// <param name="targetFieldType">The FieldType of the field to convert to static text.</param>
        public static void ConvertFieldsToStaticText(CompositeNode compositeNode, FieldType targetFieldType)
        {
            string originalNodeText = compositeNode.ToString(SaveFormat.Text); //ExSkip
            FieldsHelper helper = new FieldsHelper(targetFieldType);
            compositeNode.Accept(helper);

            Debug.Assert(originalNodeText.Equals(compositeNode.ToString(SaveFormat.Text)), "Error: Text of the node converted differs from the original"); //ExSkip
            foreach (Node node in compositeNode.GetChildNodes(NodeType.Any, true)) //ExSkip
                Debug.Assert(!(node is FieldChar && ((FieldChar)node).FieldType.Equals(targetFieldType)), "Error: A field node that should be removed still remains."); //ExSkip         
        }
コード例 #2
0
        /// <summary>
        /// Converts any fields of the specified type found in the descendants of the node into static text.
        /// </summary>
        /// <param name="compositeNode">The node in which all descendants of the specified FieldType will be converted to static text.</param>
        /// <param name="targetFieldType">The FieldType of the field to convert to static text.</param>
        public static void ConvertFieldsToStaticText(CompositeNode compositeNode, FieldType targetFieldType)
        {
            string originalNodeText = compositeNode.ToString(SaveFormat.Text); //ExSkip
            FieldsHelper helper = new FieldsHelper(targetFieldType);
            compositeNode.Accept(helper);

            Debug.Assert(originalNodeText.Equals(compositeNode.ToString(SaveFormat.Text)), "Error: Text of the node converted differs from the original"); //ExSkip
            foreach (Node node in compositeNode.GetChildNodes(NodeType.Any, true)) //ExSkip
                Debug.Assert(!(node is FieldChar && ((FieldChar)node).FieldType.Equals(targetFieldType)), "Error: A field node that should be removed still remains."); //ExSkip
        }