private PageReport PaintInvalid(Page page, PageReport report, string mode) { int invalidCount = 0; Hashtable shapeHandlers = new Hashtable(); CgoConfig[] Cgo = CgoConfigs.Search(); GroupElementTable groupElementTable = new GroupElementTable(); ElementTable elementTable = new ElementTable(); foreach (Shape shape in page.Shapes) { string shapeName = VisioUtils.GetProperty(shape, "User", "ScreenShape"); if (shapeName == null) { continue; } IShapeHandler shapeHandler = GetShapeHandler(shapeHandlers, shape, shapeName, mode); if (shape.Data1 == _INVALID) { shapeHandler.PaintAsInvalid(); } else { if (Cgo != null) { XmlNode shapeProperties = shapeHandler.GetProperties(); XmlNode cgoNode = shapeProperties.SelectSingleNode("cgoName"); if (cgoNode != null) { string cgoCode = cgoNode.InnerText; if (!CgoConfigs.Exists(Cgo, cgoCode)) { } } } } invalidCount++; string groupElementName = VisioUtils.GetProperty(shape, "Prop", "Group"); string elementName = VisioUtils.GetProperty(shape, "Prop", "Element"); if ((groupElementName == null) || (elementName == null)) { continue; } GroupElement groupElement = new GroupElement(groupElementName); groupElementTable.AddGroupElement(groupElement); Element element = new Element(elementName); elementTable.AddElement(element); } report = ShapeGroupValidation.Validate(groupElementTable, elementTable, report); return(report); }
/// <summary> /// /// </summary> /// <param name="groupElementTable"></param> /// <param name="elementTable"></param> /// <param name="report"></param> /// <returns></returns> public static PageReport Validate(GroupElementTable groupElementTable, ElementTable elementTable, PageReport report) { string badElementList = string.Empty; for (int i = 0; i < groupElementTable.GroupElement.Count; i++) { GroupElement groupElement = (GroupElement)groupElementTable.GroupElement[i]; int expectedCount = groupElement.ExpectedCount; if (expectedCount < 0) { badElementList += Environment.NewLine + "'" + groupElement.ToString() + "'"; } else { for (int n = 0; n < groupElement.Count; n++) { string elementName = groupElement.Element[n]; for (int l = 0; l < elementTable.Element.Count; l++) { Element element = (Element)elementTable.Element[l]; if (element.ToString() == elementName) { element.ReleaseCount(expectedCount); } } } } } badElementList = string.Empty; for (int i = 0; i < elementTable.Element.Count; i++) { Element element = (Element)elementTable.Element[i]; if (element.Count != 0) { badElementList += Environment.NewLine + "'" + element.ToString() + "'"; } } return(report); }
private PageReport PaintInvalid(Page page,PageReport report,string mode) { int invalidCount=0; Hashtable shapeHandlers=new Hashtable(); CgoConfig[] Cgo=CgoConfigs.Search(); GroupElementTable groupElementTable=new GroupElementTable(); ElementTable elementTable=new ElementTable(); foreach(Shape shape in page.Shapes) { string shapeName=VisioUtils.GetProperty(shape,"User","ScreenShape"); if(shapeName==null) continue; IShapeHandler shapeHandler=GetShapeHandler(shapeHandlers,shape,shapeName,mode); if(shape.Data1==_INVALID) { shapeHandler.PaintAsInvalid(); } else { if(Cgo!=null) { XmlNode shapeProperties=shapeHandler.GetProperties(); XmlNode cgoNode=shapeProperties.SelectSingleNode("cgoName"); if(cgoNode!=null) { string cgoCode=cgoNode.InnerText; if(!CgoConfigs.Exists(Cgo,cgoCode)) { } } } } invalidCount++; string groupElementName=VisioUtils.GetProperty(shape,"Prop","Group"); string elementName=VisioUtils.GetProperty(shape,"Prop","Element"); if((groupElementName==null)||(elementName==null)) continue; GroupElement groupElement=new GroupElement(groupElementName); groupElementTable.AddGroupElement(groupElement); Element element=new Element(elementName); elementTable.AddElement(element); } report=ShapeGroupValidation.Validate(groupElementTable,elementTable,report); return report; }
/// <summary> /// /// </summary> /// <param name="groupElementTable"></param> /// <param name="elementTable"></param> /// <param name="report"></param> /// <returns></returns> public static PageReport Validate(GroupElementTable groupElementTable,ElementTable elementTable,PageReport report) { string badElementList=string.Empty; for(int i=0;i<groupElementTable.GroupElement.Count;i++) { GroupElement groupElement=(GroupElement)groupElementTable.GroupElement[i]; int expectedCount=groupElement.ExpectedCount; if(expectedCount<0) { badElementList+=Environment.NewLine+"'"+groupElement.ToString()+"'"; } else { for(int n=0;n<groupElement.Count;n++) { string elementName=groupElement.Element[n]; for(int l=0;l<elementTable.Element.Count;l++) { Element element=(Element)elementTable.Element[l]; if(element.ToString()==elementName) { element.ReleaseCount(expectedCount); } } } } } badElementList=string.Empty; for(int i=0;i<elementTable.Element.Count;i++) { Element element=(Element)elementTable.Element[i]; if(element.Count!=0) { badElementList+=Environment.NewLine+"'"+element.ToString()+"'"; } } return report; }