示例#1
0
        //This method is trigered whenever the content has more than one item in it, so it needs to be splitted.
        // @_otherCellContent is used to extract comments, that may be in the other column, and also to fix some Microsoft errors. (the content is not necesarily the one where the KB is located. it could also be in the other cell, that is what @othercellcontent contains)
        public void writeComponentsOnly(string content, string otherCellContent = "")
        {
            string cleanContent = "";

            otherCellContent = utilities.deleteComments(otherCellContent);

            //string[] components = utilities.deleteCommentsInTheMiddle(content.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries));
            string[] components = utilities.splitContent(content);

            if (components.Length == 1)
            {
                cleanContent = utilities.deleteComments(components[0]);
                sheet.Cells[row, cd["component"]] = cleanContent;
                row++;
                excelUtils.replaceComponentContentIfRequired(cleanContent, otherCellContent, row);
                separateSystemsOrComponentsInTwoIfRequired();
            }
            else
            {
                int i;
                for (i = 0; i < components.Length; i += 2)
                {
                    cleanContent = utilities.deleteComments(components[i]);
                    sheet.Cells[row, cd["component"]] = cleanContent;
                    sheet.Cells[row, cd["kb"]]        = utilities.deleteParenthesis(components[i + 1]).Trim();
                    row++;
                    excelUtils.replaceComponentContentIfRequired(cleanContent, otherCellContent, row);
                    separateSystemsOrComponentsInTwoIfRequired();
                }
            }
        }
示例#2
0
        //This method is trigered whenever the content has more than one item in it, so it needs to be splitted.
        // @_otherCellContent is used to extract comments, that may be in the other column, and also to fix some Microsoft errors. (the content is not necesarily the one where the KB is located. it could also be in the other cell, that is what @othercellcontent contains)
        public void writeComponentsOnly(string content, string bulletinsReplacedBy, string otherCellContent = "")
        {
            string comments          = "";
            string cleanContent      = "";
            string otherCellComments = utilities.extractComments(otherCellContent);

            otherCellContent = utilities.deleteComments(otherCellContent);

            //string[] components = utilities.deleteCommentsInTheMiddle(content.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries));
            //string[] components = utilities.deleteCommentsInTheMiddle(utilities.splitBasedOnContent(content));
            string[] components = utilities.splitContent(content);

            if (components.Length == 1) //is there more than one component in the cell
            {
                cleanContent = utilities.deleteComments(components[0]);
                sheet.Cells[row, cd["component"]]    = cleanContent;
                sheet.Cells[row, cd["bulletinsRep"]] = utilities.getBulletinReplacedBy(bulletinsReplacedBy, sheet.Cells[row, cd["kb"]].Text);
                row++;
                excelUtils.replaceComponentContentIfRequired(cleanContent, otherCellContent, row);
                separateSystemsOrComponentsInTwoIfRequired();
            }
            else
            {
                int    i;
                string risk = sheet.Cells[row, cd["risk"]].Text;

                for (i = 0; i < components.Length; i += 2)
                {
                    comments     = utilities.extractComments(components[i].Trim()) + otherCellComments;
                    cleanContent = utilities.deleteComments(components[i]);
                    sheet.Cells[row, cd["component"]]    = cleanContent;
                    sheet.Cells[row, cd["risk"]]         = risk;
                    sheet.Cells[row, cd["kb"]]           = utilities.deleteParenthesis(components[i + 1]) + comments;
                    sheet.Cells[row, cd["bulletinsRep"]] = utilities.getBulletinReplacedBy(bulletinsReplacedBy, sheet.Cells[row, cd["kb"]].Text);
                    row++;
                    excelUtils.replaceComponentContentIfRequired(cleanContent, otherCellContent, row);
                    separateSystemsOrComponentsInTwoIfRequired();
                }
            }
        }