示例#1
0
        public override int Execute(Object o, Hashtable inputData)
        {
            int retValue = 0;
            Block block = null;

            if (IfResetOnEachRun)
                ResetOutput();

            PassAlongOutputs(inputData);


            XmlDocument xdoc = null;
            if (InputToProcess.CompareTo(String.Empty) != 0)
                xdoc = (XmlDocument)inputData[InputToProcess];

            //early return
            if (xdoc == null)
                return -1;

            XmlNodeList nl = xdoc.SelectNodes("//p");
            for (int i = 0; i < nl.Count; i++)
            {
                XmlNode node = nl[i];
                string row = CleanRow(node.InnerXml);

                string header = "";
                if (isHeader(row, out header))
                    if (blocks.ContainsKey(header) == false)
                        block = new Block();
                    else
                        block = blocks[header];

                if (block == null)
                    continue;

                if (String.IsNullOrEmpty(row) == false)
                {
                    log.DebugFormat("{0} {1}", header, row);

                    CaptureRow(ref block, row);

                    if (blocks.ContainsKey(header) == false)
                        blocks.Add(header, block);
                    else
                        log.Warn("Skipping block, dupe name");
                }
            }

            return retValue;
        }
示例#2
0
 private void CaptureRow(ref Block block, string row)
 {
     if (row.StartsWith("Deployment Type:"))
         block.DeploymentType = row.Substring(row.IndexOf("Deployment Type:") + "Deployment Type:".Length).Trim();
     else if (row.StartsWith("Component Type(s):"))
         block.ComponentType = row.Substring(row.IndexOf("Component Type(s):") + "Component Type(s):".Length).Trim();
     else if (row.StartsWith("Job Name(s):"))
         block.JobNames = row.Substring(row.IndexOf("Job Name(s):") + "Job Name(s):".Length).Trim();
     else if (row.StartsWith("File Location:"))
         block.FileLocation = row.Substring(row.IndexOf("File Location:") + "File Location:".Length).Trim();
     else if (row.StartsWith("Host Name:"))
         block.Server = row.Substring(row.IndexOf("Host Name:") + "Host Name:".Length).Trim();
     else if (row.StartsWith("Db Name:"))
         block.DatabaseTarget = row.Substring(row.IndexOf("Db Name:") + "Db Name:".Length).Trim();
     else if (row.StartsWith("Developer:"))
         block.Developer = row.Substring(row.IndexOf("Developer:") + "Developer:".Length).Trim();
     else if (row.StartsWith("Tested in QA:"))
         block.TestedInQA = row.Substring(row.IndexOf("Tested in QA:") + "Tested in QA:".Length).Trim();
     else if (row.StartsWith("Time to deploy:"))
         block.TimeToDeploy = row.Substring(row.IndexOf("Time to deploy:") + "Time to deploy:".Length).Trim();
     else if (row.StartsWith("Deployment Impact:"))
         block.DeploymentImpact = row.Substring(row.IndexOf("Deployment Impact:") + "Deployment Impact:".Length).Trim();
     else if (row.StartsWith("Business Impact:"))
         block.BusinessImpact = row.Substring(row.IndexOf("Business Impact:") + "Business Impact:".Length).Trim();
     else if (row.StartsWith("Approval/Owner:"))
         block.BusinessContact = row.Substring(row.IndexOf("Approval/Owner:") + "Approval/Owner:".Length).Trim();
     else if (row.StartsWith("Notes:"))
         block.Notes = row.Substring(row.IndexOf("Notes:") + "Notes:".Length).Trim();
     else
         block.Notes += String.Format("\n{0}", row);
 }