Exemple #1
0
        public static CameraBlurb FromXML(XmlReader reader)
        {
            reader.ReadStartElement();
            string    cameraType       = "";
            string    identifier       = "";
            string    alias            = "";
            Bitmap    icon             = null;
            Rectangle displayRectangle = Rectangle.Empty;
            string    aspectRatio      = "Auto";
            string    rotation         = "Rotate0";
            string    specific         = "";

            while (reader.NodeType == XmlNodeType.Element)
            {
                switch (reader.Name)
                {
                case "CameraType":
                    cameraType = reader.ReadElementContentAsString();
                    break;

                case "Identifier":
                    identifier = reader.ReadElementContentAsString();
                    break;

                case "Alias":
                    alias = reader.ReadElementContentAsString();
                    break;

                case "Icon":
                    icon = XmlHelper.ParseImageFromBase64(reader.ReadElementContentAsString());
                    break;

                case "DisplayRectangle":
                    displayRectangle = XmlHelper.ParseRectangle(reader.ReadElementContentAsString());
                    break;

                case "AspectRatio":
                    aspectRatio = reader.ReadElementContentAsString();
                    break;

                case "Rotation":
                    rotation = reader.ReadElementContentAsString();
                    break;

                case "Specific":
                    specific = reader.ReadInnerXml();
                    break;

                default:
                    reader.ReadOuterXml();
                    break;
                }
            }

            reader.ReadEndElement();

            return(new CameraBlurb(cameraType, identifier, alias, icon, displayRectangle, aspectRatio, rotation, specific));
        }