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)); }
public void ReadXML(XmlReader reader) { reader.ReadStartElement(); while (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "Culture": uiCultureName = reader.ReadElementContentAsString(); break; case "ExplorerVisible": explorerVisible = XmlHelper.ParseBoolean(reader.ReadElementContentAsString()); break; case "ExplorerSplitterDistance": explorerSplitterDistance = reader.ReadElementContentAsInt(); break; case "WindowState": windowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), reader.ReadElementContentAsString()); break; case "WindowRectangle": windowRectangle = XmlHelper.ParseRectangle(reader.ReadElementContentAsString()); break; case "Workspace": workspace.ReadXML(reader); break; case "AllowMultipleInstances": allowMultipleInstances = XmlHelper.ParseBoolean(reader.ReadElementContentAsString()); break; case "InstancesOwnPreferences": instancesOwnPreferences = XmlHelper.ParseBoolean(reader.ReadElementContentAsString()); break; case "PreferencesPage": preferencePage = reader.ReadElementContentAsInt(); break; default: reader.ReadOuterXml(); break; } } reader.ReadEndElement(); }