Example #1
0
 public void Save(ISettingsSection section)
 {
     section.Attribute(FILELIST_NAME_ATTR, Name);
     foreach (var info in files)
     {
         DnSpyFileInfoSerializer.Save(section.CreateSection(FILE_SECTION), info);
     }
 }
Example #2
0
		public void Save(ISettingsSection section) {
			Debug.Assert(Content.Attribute<Guid?>(CONTENT_GUID_ATTR) != null);
			section.CreateSection(CONTENT_SECTION).CopyFrom(Content);
			section.CreateSection(UI_SECTION).CopyFrom(UI);
			section.CreateSection(TAB_UI_SECTION).CopyFrom(TabUI);
			foreach (var path in Paths)
				path.Save(section.CreateSection(PATH_SECTION));
			foreach (var f in AutoLoadedFiles)
				DnSpyFileInfoSerializer.Save(section.CreateSection(AUTOLOADED_SECTION), f);
		}
Example #3
0
        public static FileList Create(ISettingsSection section)
        {
            var fileList = new FileList(section.Attribute <string>(FILELIST_NAME_ATTR));

            foreach (var fileSect in section.SectionsWithName(FILE_SECTION))
            {
                var info = DnSpyFileInfoSerializer.TryLoad(fileSect);
                if (info != null)
                {
                    fileList.Files.Add(info.Value);
                }
            }
            return(fileList);
        }
Example #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));
        }