public static void SerXForm(XmlWriter w, XForm xf, List <XForm> xfs) { bool final = false; if (xfs == null) { final = true; } w.WriteStartElement(final ? "finalxform" : "xform"); if (!final) { w.WriteAttributeString("weight", xf.baseWeight.ToString()); } w.WriteAttributeString("color", xf.color.ToString()); w.WriteAttributeString("symmetry", xf.symmetry.ToString()); foreach (Variation v in xf.Variations) {//variations w.WriteAttributeString(v.Name, v.Value.ToString()); //foreach variable... } w.WriteAttributeString("coefs", SerializationUtils.GenCoefsString(xf.PreCoefs)); w.WriteAttributeString("post", SerializationUtils.GenCoefsString(xf.PostCoefs)); foreach (Variable v in xf.Variables) {//variables w.WriteAttributeString(v.Name, v.Value.ToString()); } if (!final) { string xaos = ""; List <Conn> conns = xf.GetConns(); /*for (int i=0;i<conns.Count;i++) * { * xaos += conns[i].WeightTo.ToString() + " "; * }*/ foreach (XForm xf2 in xfs) { double weight = 0.0;//default nincs osszekotve foreach (Conn c in conns) { if (c.ConnTo == xf2) { weight = c.WeightTo; break; } } xaos += weight.ToString() + " "; } w.WriteAttributeString("chaos", xaos); w.WriteAttributeString("opacity", xf.opacity.ToString()); w.WriteAttributeString("name", xf.name); } //w.WriteAttributeString("var_color", xf.var_color.ToString());//TODO: itt neha elszall??? w.WriteEndElement();//xform }