Canguro.Model.Serializer.Serializer.writeMaterial C# (CSharp) Method

writeMaterial() private method

private writeMaterial ( XmlWriter xml, Material mat ) : void
xml XmlWriter
mat Material
return void
        private void writeMaterial(XmlWriter xml, Material.Material mat)
        {
            MaterialTypeProps tProps = mat.TypeProperties;
            MaterialDesignProps dProps = mat.DesignProperties;
            double e, u, a;
            string type = "";
            string design = (dProps is RebarDesignProps) ? "Rebar" :
                (dProps is ColdFormedDesignProps) ? "ColdFormed" :
                (dProps is SteelDesignProps) ? "Steel" :
                (dProps is ConcreteDesignProps) ? "Concrete" :
                (dProps is AluminumDesignProps) ? "Aluminum" : "None";
            if (tProps is IsotropicTypeProps)
            {
                IsotropicTypeProps iProps = tProps as IsotropicTypeProps;
                type = "Isotropic";
                e = iProps.E;
                u = iProps.Nu;
                a = iProps.Alpha;
            }
            else if (tProps is UniaxialTypeProps)
            {
                UniaxialTypeProps uProps = tProps as UniaxialTypeProps;
                type = "Uniaxial";
                e = uProps.E;
                u = 0.0;
                a = uProps.A;
            }
            else
            {
                e = u = a = 0.0;
                type = (tProps is OrthotropicTypeProps) ? "Orthotropic" : "Anisotropic";
            }
            xml.WriteStartElement("Material");
            xml.WriteAttributeString("Material", mat.Name);
            xml.WriteAttributeString("Type", type);
            xml.WriteAttributeString("DesignType", design);
            xml.WriteAttributeString("UnitMass", mat.Density.ToString());
            xml.WriteAttributeString("UnitWeight", mat.UnitWeight.ToString());
            xml.WriteAttributeString("E", e.ToString());
            xml.WriteAttributeString("U", u.ToString());
            xml.WriteAttributeString("A", a.ToString());
            xml.WriteAttributeString("MDampRatio", "0");
            xml.WriteAttributeString("VDampMass", "0");
            xml.WriteAttributeString("VDampStiff", "0");
            xml.WriteAttributeString("HDampMass", "0");
            xml.WriteAttributeString("HDampStiff", "0");
            xml.WriteAttributeString("NumAdvance", "0");
            xml.WriteAttributeString("Color", "Yellow");
            //            xml.WriteAttributeString("TempDepend", CodeYN(!(mat.DesignProperties is RebarDesignProps)));
            xml.WriteEndElement();
        }