コード例 #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));
        }
コード例 #2
0
        public SettingsExportable(ISettingsService settingsService)
        {
            this.settingsService = settingsService;

            ISettingsSection sect = settingsService.GetOrCreateSection(Constants.SettingsGuid);

            CopyInjectedDLLToTemp = sect.Attribute <bool?>(nameof(CopyInjectedDLLToTemp)) ?? CopyInjectedDLLToTemp;

            var sectInjections = sect.TryGetSection(SectionRecentInjections);

            if (!(sectInjections is null))
            {
                RecentInjections = sectInjections.SectionsWithName(SectionRecentInjectionsInjection).Select(InjectionArguments.FromSection).ToList();
            }

            PropertyChanged += OnPropertyChanged;
        }
コード例 #3
0
        public SettingsExportable(ISettingsService settingsService)
        {
            this.settingsService = settingsService;

            ISettingsSection sect = settingsService.GetOrCreateSection(Constants.SettingsGuid);

            UnderlineManagedAssemblies = sect.Attribute <bool?>(nameof(UnderlineManagedAssemblies)) ?? UnderlineManagedAssemblies;
            CopyInjectedDllToTemp      = sect.Attribute <bool?>(nameof(CopyInjectedDllToTemp)) ?? CopyInjectedDllToTemp;
            AutoMapDllImports          = sect.Attribute <bool?>(nameof(AutoMapDllImports)) ?? AutoMapDllImports;
            AutoMapOverrides           = sect.Attribute <bool?>(nameof(AutoMapOverrides)) ?? AutoMapOverrides;

            var sectInjections = sect.TryGetSection(SectionRecentInjections);

            if (!(sectInjections is null))
            {
                RecentInjections = sectInjections.SectionsWithName(SectionRecentInjectionsInjection).Select(InjectionArguments.FromSection).ToList();
            }

            PropertyChanged += OnPropertyChanged;
        }
コード例 #4
0
ファイル: SerializedTabs.cs プロジェクト: manojdjoshi/dnSpy
		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 autoLoadedDocuments = new List<DsDocumentInfo>();
			foreach (var sect in section.SectionsWithName(AUTOLOADED_SECTION)) {
				var info = DsDocumentInfoSerializer.TryLoad(sect);
				if (info != null)
					autoLoadedDocuments.Add(info.Value);
			}

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