Example #1
0
		public virtual void AddInfo(NodeInfo info)
        {
            if (info == null)
                return;

            m_additionalInfo.Add(info);
        }
Example #2
0
 private void AddInfo(string name, string value)
 {
     NodeInfo ni = new NodeInfo();
     ni.name = name;
     ni.value = value;
     ni.type = DataType.String;
     m_textNode.AddInfo(ni);
 }
        public override Stream ProcessPart(Stream partData, DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action)
        {
            //this is for the discovery on open documents - the copy loses all other macro information except this items
            //specifying macro content - there is a single vbaproject.bin file containing all macros
            //so far this appears to be valid

            if (DocumentProcessor.ActionIncludesCleaning(action))
                return null;

            if (action == DocumentProcessingActions.PassThrough)
                return partData;

            if (m_bInterestedInMacros)
            {
                List<IAbstractTextType> ttypes = discoveryText.GetTextTypes(ContentType.Macro);
                TextType macro = null;
                if (ttypes.Count > 0)
                {
                    macro = (TextType)ttypes[0];
                }
                else
                {
                    macro = new TextType(ContentType.Macro);
                    discoveryText.AddTextType(macro);
                }

                TextNode macroNode = new TextNode();
                NodeInfo ni = new NodeInfo();
                ni.name = "Id";
                ni.value = m_id;
                ni.type = DataType.String;
                macroNode.AddInfo(ni);

                ni = new NodeInfo();
                ni.name = "Target";
                ni.value = m_target;
                ni.type = DataType.String;
                macroNode.AddInfo(ni);

                ni = new NodeInfo();
                ni.name = "Type";
                ni.value = m_type;
                ni.type = DataType.String;
                macroNode.AddInfo(ni);

                macro.AddChild(macroNode);
            }

            Initialize();
            ConstructFilter(partData, discoveryText, action);
            ExecuteFilter();
            return m_outStream;
        }
        private void PostProcessReviewerNames()
        {
            IAbstractTextType ttTrackChanges = GetTextType(ContentType.TrackChange, false);
            if (ttTrackChanges == null)
                return;

            List<string> authors = new List<string>();

            for (int i = 0; i < ttTrackChanges.GetChildCount(); i++)
            {
                IAbstractTextNode tnode = ttTrackChanges.GetChild(i);
                NodeInfo ni = tnode.GetInfo("Author")[0];
                //We do not wish to include blank authors.
                //This means they must have been removed!!
                if (!(authors.Contains(ni.value) || string.IsNullOrEmpty(ni.value)))
                    authors.Add(ni.value);
            }

            if (authors.Count == 0)
                return;

            TextType ttReviewers = GetTextType(ContentType.Reviewer, true);

            foreach (string author in authors)
            {
                TextNode tn = new TextNode();
                NodeInfo ni = new NodeInfo();
                ni.name = "Content";
                ni.value = author;
                ni.type = DataType.String;
                tn.AddInfo(ni);
                ttReviewers.AddChild(tn);
            }

        }
Example #5
0
 private static string DumpInfo(NodeInfo nodeInfo)
 {
     return (nodeInfo.name + "=" + nodeInfo.value + ";");
 }
 private NodeInfo BuildNodeInfo(string name, string rawValue)
 {
     NodeInfo ni = new NodeInfo();
     ni.name = name;
     ni.value = ProcessValue(rawValue);
     ni.type = DataType.String;
     return ni;
 }