Beispiel #1
0
        public void ReadXML(XmlReader reader)
        {
            reader.ReadStartElement();

            while (reader.NodeType == XmlNodeType.Element)
            {
                switch (reader.Name)
                {
                case "MaxRecentFiles":
                    maxRecentFiles = reader.ReadElementContentAsInt();
                    break;

                case "RecentFiles":
                    ParseRecentFiles(reader, recentFiles, "RecentFile");
                    break;

                case "MaxRecentCapturedFiles":
                    maxRecentCapturedFiles = reader.ReadElementContentAsInt();
                    break;

                case "RecentCapturedFiles":
                    ParseRecentFiles(reader, recentCapturedFiles, "RecentCapturedFile");
                    break;

                case "Shortcuts":
                    ParseShortcuts(reader);
                    break;

                case "ThumbnailSize":
                    explorerThumbsSize = (ExplorerThumbSize)Enum.Parse(typeof(ExplorerThumbSize), reader.ReadElementContentAsString());
                    break;

                case "ExplorerFilesSplitterDistance":
                    explorerFilesSplitterDistance = reader.ReadElementContentAsInt();
                    break;

                case "ShortcutsFilesSplitterDistance":
                    shortcutsFilesSplitterDistance = reader.ReadElementContentAsInt();
                    break;

                case "ActiveTab":
                    activeTab = (ActiveFileBrowserTab)Enum.Parse(typeof(ActiveFileBrowserTab), reader.ReadElementContentAsString());
                    break;

                case "FilePropertyVisibility":
                    filePropertyVisibility = FilePropertyVisibility.FromXML(reader);
                    break;

                case "LastReplayFolder":
                    lastReplayFolder = reader.ReadElementContentAsString();
                    break;

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

            reader.ReadEndElement();
        }
        public static FilePropertyVisibility FromXML(XmlReader reader)
        {
            FilePropertyVisibility fpv = new FilePropertyVisibility();

            try
            {
                reader.ReadStartElement();

                while (reader.NodeType == XmlNodeType.Element)
                {
                    FileProperty prop = (FileProperty)Enum.Parse(typeof(FileProperty), reader.Name);
                    if (!fpv.visible.ContainsKey(prop))
                    {
                        reader.ReadOuterXml();
                        continue;
                    }

                    bool value = reader.ReadElementContentAsBoolean();
                    fpv.Visible[prop] = value;
                }

                reader.ReadEndElement();
            }
            catch
            {
                log.ErrorFormat("Error while parsing file property visiblity.");
            }


            return(fpv);
        }