Exemple #1
0
        public static SerializedTab TryLoad(ISettingsSection section)
        {
            var contentSect = section.TryGetSection(CONTENT_SECTION);

            if (contentSect == null || contentSect.Attribute <Guid?>(CONTENT_GUID_ATTR) == null)
            {
                return(null);
            }
            var uiSect = section.TryGetSection(UI_SECTION);

            if (uiSect == null)
            {
                return(null);
            }
            var tabUISect = section.TryGetSection(TAB_UI_SECTION);

            if (tabUISect == null)
            {
                return(null);
            }

            var paths = new List <SerializedPath>();

            foreach (var pathSection in section.SectionsWithName(PATH_SECTION))
            {
                paths.Add(SerializedPath.Load(pathSection));
            }

            var autoLoadedFiles = new List <DnSpyFileInfo>();

            foreach (var sect in section.SectionsWithName(AUTOLOADED_SECTION))
            {
                var info = DnSpyFileInfoSerializer.TryLoad(sect);
                if (info != null)
                {
                    autoLoadedFiles.Add(info.Value);
                }
            }

            return(new SerializedTab(contentSect, tabUISect, uiSect, paths, autoLoadedFiles));
        }