Exemple #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));
        }
Exemple #2
0
		public static SerializedPath Load(ISettingsSection pathSection) {
			var path = new SerializedPath();

			foreach (var sect in pathSection.SectionsWithName(NAME_SECTION))
				path.Names.Add(NodePathNameSerializer.Load(sect));

			return path;
		}
Exemple #3
0
		public static SerializedPath Create(IFileTreeNodeData node) {
			var path = new SerializedPath();

			while (node != null && node.TreeNode.Parent != null) {
				path.Names.Add(node.NodePathName);
				var parent = node.TreeNode.Parent;
				node = parent.Data as IFileTreeNodeData;
			}
			path.Names.Reverse();

			return path;
		}
Exemple #4
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));
        }
Exemple #5
0
        public static SerializedPath Load(ISettingsSection pathSection)
        {
            var path = new SerializedPath();

            foreach (var sect in pathSection.SectionsWithName(NAME_SECTION))
                path.Names.Add(NodePathNameSerializer.Load(sect));

            return path;
        }
Exemple #6
0
        public static SerializedPath Create(IFileTreeNodeData node)
        {
            var path = new SerializedPath();

            while (node != null && node.TreeNode.Parent != null) {
                path.Names.Add(node.NodePathName);
                var parent = node.TreeNode.Parent;
                node = parent.Data as IFileTreeNodeData;
            }
            path.Names.Reverse();

            return path;
        }