public void LoadXML(XmlReader reader) { _FractalColours.Clear(); _FractalIterations = new List <WooFractalIteration>(); while (reader.NodeType != XmlNodeType.EndElement && reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "MATERIALSELECTION") { _MaterialSelection = new MaterialSelection(); _MaterialSelection.LoadXML(reader); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "RENDEROPTIONS") { _RenderOptions = new RenderOptions(); _RenderOptions.LoadXML(reader); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "FRACTALCOLOURS") { FractalGradient fractalColour = new FractalGradient(); fractalColour.LoadXML(reader); _FractalColours.Add(fractalColour); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "KIFSFRACTAL") { KIFSIteration fractalIteration = new KIFSIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BULBFRACTAL") { MandelbulbIteration fractalIteration = new MandelbulbIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BOXFRACTAL") { MandelboxIteration fractalIteration = new MandelboxIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "KLEINIANGROUP") { KleinianGroupIteration fractalIteration = new KleinianGroupIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BOXFOLD") { BoxfoldIteration fractalIteration = new BoxfoldIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } } reader.Read(); }
public void Load(string xml) { _FractalIterations = new List <WooFractalIteration>(); using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { while (reader.NodeType != XmlNodeType.EndElement && reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "RENDEROPTIONS") { _RenderOptions = new RenderOptions(); _RenderOptions.LoadXML(reader); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "FRACTALCOLOURS") { _FractalColours = new FractalColours(); _FractalColours.LoadXML(reader); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "KIFSFRACTAL") { KIFSIteration fractalIteration = new KIFSIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BULBFRACTAL") { MandelbulbIteration fractalIteration = new MandelbulbIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BOXFRACTAL") { MandelboxIteration fractalIteration = new MandelboxIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } } } }
public void Load(string xml) { _FractalIterations = new List<WooFractalIteration>(); using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { while (reader.NodeType != XmlNodeType.EndElement && reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "RENDEROPTIONS") { _RenderOptions = new RenderOptions(); _RenderOptions.LoadXML(reader); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "FRACTALCOLOURS") { _FractalColours = new FractalColours(); _FractalColours.LoadXML(reader); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "KIFSFRACTAL") { KIFSIteration fractalIteration = new KIFSIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BULBFRACTAL") { MandelbulbIteration fractalIteration = new MandelbulbIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } if (reader.NodeType == XmlNodeType.Element && reader.Name == "BOXFRACTAL") { MandelboxIteration fractalIteration = new MandelboxIteration(); fractalIteration.LoadXML(reader); _FractalIterations.Add(fractalIteration); } } } }