コード例 #1
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("Repeat", Convert.ToString(Repeat, CultureInfo.InvariantCulture));

            writer.WriteStartElement("Frames");

            foreach (IFrameElement frame in Frames) {
                XmlFrameElement elem = frame as XmlFrameElement;
                if (elem == null)
                    elem = new XmlFrameElement(frame);

                writer.WriteStartElement("Frame");
                elem.WriteXml(writer);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
コード例 #2
0
        private void ReadFramesXml(XmlReader reader)
        {
            reader.MoveToContent();
            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Frame":
                            XmlFrameElement frame = new XmlFrameElement();
                            frame.ReadXml(reader);
                            Frames.Add(frame);
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }