Ejemplo n.º 1
0
        public static SerializedTab TryCreate(IFileTabContentFactoryManager fileTabContentFactoryManager, IFileTab tab)
        {
            var contentSect = new SettingsSection(CONTENT_SECTION);
            var guid        = fileTabContentFactoryManager.Serialize(tab.Content, contentSect);

            if (guid == null)
            {
                return(null);
            }
            contentSect.Attribute(CONTENT_GUID_ATTR, guid.Value);

            var uiSect = new SettingsSection(UI_SECTION);

            tab.UIContext.SaveSerialized(uiSect, tab.UIContext.Serialize());

            var tabUISect = new SettingsSection(TAB_UI_SECTION);

            tab.SerializeUI(tabUISect);

            var paths = new List <SerializedPath>();

            foreach (var node in tab.Content.Nodes)
            {
                paths.Add(SerializedPath.Create(node));
            }

            var autoLoadedFiles = new List <DnSpyFileInfo>();

            foreach (var f in GetAutoLoadedFiles(tab.Content.Nodes))
            {
                autoLoadedFiles.Add(f);
            }

            return(new SerializedTab(contentSect, tabUISect, uiSect, paths, autoLoadedFiles));
        }
Ejemplo n.º 2
0
        public static SerializedTab TryCreate(IFileTabContentFactoryManager creator, IFileTab tab)
        {
            var contentSect = new SettingsSection(CONTENT_SECTION);
            var guid = creator.Serialize(tab.Content, contentSect);
            if (guid == null)
                return null;
            contentSect.Attribute(CONTENT_GUID_ATTR, guid.Value);

            var uiSect = new SettingsSection(UI_SECTION);
            tab.UIContext.SaveSerialized(uiSect, tab.UIContext.Serialize());

            var tabUISect = new SettingsSection(TAB_UI_SECTION);
            tab.SerializeUI(tabUISect);

            var paths = new List<SerializedPath>();
            foreach (var node in tab.Content.Nodes)
                paths.Add(SerializedPath.Create(node));

            var autoLoadedFiles = new List<DnSpyFileInfo>();
            foreach (var f in GetAutoLoadedFiles(tab.Content.Nodes))
                autoLoadedFiles.Add(f);

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