当前位置: 首页>>代码示例>>C#>>正文


C# ISettingsSection.GetOrCreateSection方法代码示例

本文整理汇总了C#中ISettingsSection.GetOrCreateSection方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsSection.GetOrCreateSection方法的具体用法?C# ISettingsSection.GetOrCreateSection怎么用?C# ISettingsSection.GetOrCreateSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISettingsSection的用法示例。


在下文中一共展示了ISettingsSection.GetOrCreateSection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

		public MainWindowControlState Read(ISettingsSection section) {
			HorizontalContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(HORIZONTALCONTENT_SECT));
			VerticalContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(VERTICALCONTENT_SECT));

			foreach (var twSect in section.SectionsWithName(TOOLWINDOWUI_SECT)) {
				var state = ToolWindowUIState.TryDeserialize(twSect);
				if (state == null)
					continue;
				switch (state.Location) {
				case AppToolWindowLocation.Left:	LeftState = state; break;
				case AppToolWindowLocation.Right:	RightState = state; break;
				case AppToolWindowLocation.Top:		TopState = state; break;
				case AppToolWindowLocation.Bottom:	BottomState = state; break;
				}
			}

			foreach (var locSect in section.SectionsWithName(LOCATION_SECT)) {
				var guid = locSect.Attribute<Guid?>(LOCATION_GUID_ATTR);
				var loc = locSect.Attribute<AppToolWindowLocation?>(LOCATION_ATTR);
				if (guid == null || loc == null)
					continue;
				if (!IsValid(loc.Value))
					continue;
				SavedLocations[guid.Value] = loc.Value;
			}

			return this;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:28,代码来源:MainWindowControl.cs

示例2: Save

		public void Save(ISettingsSection section) {
			section.Attribute(NAME_ATTR, Name);
			section.Attribute(INDEX_ATTR, Index);
			section.Attribute(ISHORIZONTAL_ATTR, IsHorizontal);

			if (StackedContentState != null)
				StackedContentStateSerializer.Serialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION), StackedContentState);

			foreach (var stg in TabGroups)
				stg.Save(section.CreateSection(TABGROUP_SECTION));
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:11,代码来源:SerializedTabs.cs

示例3: Load

		public static SerializedTabGroupWindow Load(ISettingsSection section) {
			var name = section.Attribute<string>(NAME_ATTR) ?? MAIN_NAME;
			int index = section.Attribute<int?>(INDEX_ATTR) ?? -1;
			bool isHorizontal = section.Attribute<bool?>(ISHORIZONTAL_ATTR) ?? false;
			var stackedContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION));
			var tgw = new SerializedTabGroupWindow(name, index, isHorizontal, stackedContentState);

			foreach (var tgSection in section.SectionsWithName(TABGROUP_SECTION))
				tgw.TabGroups.Add(SerializedTabGroup.Load(tgSection));

			return tgw;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:12,代码来源:SerializedTabs.cs

示例4: Write

		public void Write(ISettingsSection section) {
			Debug.Assert(HorizontalContentState != null && VerticalContentState != null);
			if (HorizontalContentState != null)
				StackedContentStateSerializer.Serialize(section.GetOrCreateSection(HORIZONTALCONTENT_SECT), HorizontalContentState);
			if (VerticalContentState != null)
				StackedContentStateSerializer.Serialize(section.GetOrCreateSection(VERTICALCONTENT_SECT), VerticalContentState);
			Debug.Assert(LeftState != null && RightState != null && TopState != null && BottomState != null);
			if (LeftState != null)
				ToolWindowUIState.Serialize(section.CreateSection(TOOLWINDOWUI_SECT), LeftState);
			if (RightState != null)
				ToolWindowUIState.Serialize(section.CreateSection(TOOLWINDOWUI_SECT), RightState);
			if (TopState != null)
				ToolWindowUIState.Serialize(section.CreateSection(TOOLWINDOWUI_SECT), TopState);
			if (BottomState != null)
				ToolWindowUIState.Serialize(section.CreateSection(TOOLWINDOWUI_SECT), BottomState);
			foreach (var kv in SavedLocations) {
				var sect = section.CreateSection(LOCATION_SECT);
				sect.Attribute(LOCATION_GUID_ATTR, kv.Key);
				sect.Attribute(LOCATION_ATTR, kv.Value);
			}
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:21,代码来源:MainWindowControl.cs

示例5: TryDeserialize

        public static ToolWindowUIState TryDeserialize(ISettingsSection section)
        {
            var location = section.Attribute<AppToolWindowLocation?>(LOCATION_ATTR);
            int? index = section.Attribute<int?>(INDEX_ATTR);
            bool? isHorizontal = section.Attribute<bool?>(ISHORIZONTAL_ATTR);
            if (location == null || index == null || isHorizontal == null)
                return null;
            var state = new ToolWindowUIState();
            state.Location = location.Value;
            state.Index = index.Value;
            state.IsHorizontal = isHorizontal.Value;

            foreach (var sect in section.SectionsWithName(GROUP_SECT)) {
                var content = ToolWindowGroupState.TryDeserialize(sect);
                if (content == null)
                    return null;
                state.Groups.Add(content);
            }

            state.StackedContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION));
            if (state.StackedContentState == null)
                return null;

            return state;
        }
开发者ID:n017,项目名称:dnSpy,代码行数:25,代码来源:MainWindowControl.cs

示例6: Serialize

 public static void Serialize(ISettingsSection section, ToolWindowUIState state)
 {
     section.Attribute(LOCATION_ATTR, state.Location);
     section.Attribute(INDEX_ATTR, state.Index);
     section.Attribute(ISHORIZONTAL_ATTR, state.IsHorizontal);
     foreach (var content in state.Groups)
         ToolWindowGroupState.Serialize(section.CreateSection(GROUP_SECT), content);
     Debug.Assert(state.StackedContentState != null);
     if (state.StackedContentState != null)
         StackedContentStateSerializer.Serialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION), state.StackedContentState);
 }
开发者ID:n017,项目名称:dnSpy,代码行数:11,代码来源:MainWindowControl.cs


注:本文中的ISettingsSection.GetOrCreateSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。