private static void WriteStroke(Sketch.Stroke stroke, XmlTextWriter xmlDocument) { string[] strokeAttributeNames = stroke.XmlAttrs.getAttributeNames(); object[] strokeAttributeValues = stroke.XmlAttrs.getAttributeValues(); Sketch.Substroke[] substrokes = stroke.Substrokes; int length; int i; xmlDocument.WriteStartElement("shape"); // Write all the attributes length = strokeAttributeNames.Length; for (i = 0; i < length; ++i) { if (strokeAttributeValues[i] != null) { xmlDocument.WriteAttributeString(strokeAttributeNames[i], strokeAttributeValues[i].ToString()); } } // Write the substroke references length = substrokes.Length; for (i = 0; i < length; ++i) { SaveToXML.WriteSubstrokeReference(substrokes[i], xmlDocument); } xmlDocument.WriteEndElement(); }
private static void WriteShape(Sketch.Shape shape, XmlTextWriter xmlDocument) { string[] shapeAttributeNames = shape.XmlAttrs.getAttributeNames(); object[] shapeAttributeValues = shape.XmlAttrs.getAttributeValues(); Sketch.Substroke[] substrokes = shape.Substrokes; int length; int i; xmlDocument.WriteStartElement("shape"); // Write all the attributes length = shapeAttributeNames.Length; for (i = 0; i < length; ++i) { if (shapeAttributeValues[i] != null) { xmlDocument.WriteAttributeString(shapeAttributeNames[i], shapeAttributeValues[i].ToString()); } } // Write all the substrokes args length = substrokes.Length; for (i = 0; i < length; ++i) { SaveToXML.WriteSubstrokeReference(substrokes[i], xmlDocument); } // Write all of the neighbor args foreach (Sketch.Shape neighbor in shape.ConnectedShapes) { SaveToXML.WriteNeighborReference(neighbor, xmlDocument); } if (shape.Type == Domain.LogicDomain.SUBCIRCUIT) { xmlDocument.WriteStartElement("SubCircuit"); xmlDocument.WriteAttributeString("tagNumber", shape.SubCircuitNumber.ToString()); xmlDocument.WriteEndElement(); } xmlDocument.WriteEndElement(); }