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


C# ISettingsSection类代码示例

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


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

示例1: TryLoad

		public static DsDocumentInfo? TryLoad(ISettingsSection section) {
			var name = section.Attribute<string>(DOCUMENTINFO_NAME_ATTR);
			var type = section.Attribute<Guid?>(DOCUMENTINFO_TYPE_ATTR) ?? DocumentConstants.DOCUMENTTYPE_FILE;
			if (string.IsNullOrEmpty(name))
				return null;
			return new DsDocumentInfo(name, type);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:DsDocumentInfoSerializer.cs

示例2: Serialize

		public Guid? Serialize(IFileTabContent content, ISettingsSection section) {
			var dc = content as HexFileTabContent;
			if (dc == null)
				return null;

			return GUID_SerializedContent;
		}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:7,代码来源:HexFileTabContent.cs

示例3: Serialize

		public static void Serialize(ISettingsSection section, StackedContentState state) {
			section.Attribute(ISHORIZONTAL_ATTR, state.IsHorizontal);
			foreach (var length in state.RowsCols) {
				var lengthSect = section.CreateSection(LENGTH_SECTION);
				lengthSect.Attribute(LENGTH_ATTR, length);
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:StackedContentState.cs

示例4: 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

示例5: Deserialize

		public DocumentTabContent Deserialize(Guid guid, ISettingsSection section, IDocumentTabContentFactoryContext context) {
			if (guid != GUID_SerializedContent)
				return null;

			var filename = section.Attribute<string>("filename");
			return hexViewDocumentTabContentCreator.Value.TryCreate(filename);
		}
开发者ID:0xd4d,项目名称:dnSpy,代码行数:7,代码来源:HexBoxDocumentTabContent.cs

示例6: Write

        XElement Write(ISettingsSection section, int recursionCounter)
        {
            var xmlSect = new XElement(XmlSettingsConstants.SECTION_NAME);

            if (recursionCounter >= XmlSettingsConstants.MAX_CHILD_DEPTH)
                return xmlSect;

            xmlSect.SetAttributeValue(XmlSettingsConstants.SECTION_ATTRIBUTE_NAME, XmlUtils.EscapeAttributeValue(section.Name));
            foreach (var attr in section.Attributes.OrderBy(a => a.Item1.ToUpperInvariant())) {
                var n = XmlUtils.FilterAttributeName(attr.Item1);
                Debug.Assert(n != null, "Invalid character(s) in section attribute name. Only valid XML attribute names can be used.");
                if (n == null)
                    continue;
                bool b = n == XmlSettingsConstants.SECTION_ATTRIBUTE_NAME;
                Debug.Assert(!b, string.Format("Attribute name '{0}' is reserved for use by the XML writer", XmlSettingsConstants.SECTION_ATTRIBUTE_NAME));
                if (b)
                    continue;
                xmlSect.SetAttributeValue(n, XmlUtils.EscapeAttributeValue(attr.Item2));
            }

            foreach (var childSection in Sort(section.Sections))
                xmlSect.Add(Write(childSection, recursionCounter + 1));

            return xmlSect;
        }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:25,代码来源:XmlSettingsWriter.cs

示例7: Read

		public static HexBoxUIState Read(ISettingsSection section, HexBoxUIState s) {
			if (s.HexBoxState == null)
				return s;

			s.BytesGroupCount = section.Attribute<int?>("BytesGroupCount");
			s.BytesPerLine = section.Attribute<int?>("BytesPerLine");
			s.UseHexPrefix = section.Attribute<bool?>("UseHexPrefix");
			s.ShowAscii = section.Attribute<bool?>("ShowAscii");
			s.LowerCaseHex = section.Attribute<bool?>("LowerCaseHex");
			s.AsciiEncoding = section.Attribute<AsciiEncoding?>("AsciiEncoding");

			s.HexOffsetSize = section.Attribute<int?>("HexOffsetSize") ?? 0;
			s.UseRelativeOffsets = section.Attribute<bool?>("UseRelativeOffsets") ?? false;
			s.BaseOffset = section.Attribute<ulong?>("BaseOffset") ?? 0;

			s.HexBoxState.TopOffset = section.Attribute<ulong?>("HexBoxState-TopOffset") ?? 0;
			s.HexBoxState.Column = section.Attribute<int?>("HexBoxState-Column") ?? 0;
			s.HexBoxState.StartOffset = section.Attribute<ulong?>("HexBoxState-StartOffset") ?? 0;
			s.HexBoxState.EndOffset = section.Attribute<ulong?>("HexBoxState-EndOffset") ?? 0;
			s.HexBoxState.CaretPosition.Offset = section.Attribute<ulong?>("HexBoxState-HexBoxPosition-Offset") ?? 0;
			s.HexBoxState.CaretPosition.Kind = section.Attribute<HexBoxPositionKind?>("HexBoxState-HexBoxPosition-Kind") ?? 0;
			s.HexBoxState.CaretPosition.KindPosition = section.Attribute<byte?>("HexBoxState-HexBoxPosition-KindPosition") ?? 0;

			var from = section.Attribute<ulong?>("HexBoxState-Selection-From");
			var to = section.Attribute<ulong?>("HexBoxState-Selection-To");
			if (from != null && to != null)
				s.HexBoxState.Selection = new HexSelection((ulong)from, (ulong)to);

			return s;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:30,代码来源:HexBoxUIStateSerializer.cs

示例8: Read

 public SavedWindowState Read(ISettingsSection section)
 {
     Bounds = section.Attribute<Rect?>("Bounds") ?? Rect.Empty;
     IsFullScreen = section.Attribute<bool?>("IsFullScreen") ?? false;
     WindowState = section.Attribute<WindowState?>("WindowState") ?? WindowState.Normal;
     return this;
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:7,代码来源:SavedWindowState.cs

示例9: Write

 public SavedWindowState Write(ISettingsSection section)
 {
     section.Attribute("Bounds", Bounds);
     section.Attribute("IsFullScreen", IsFullScreen);
     section.Attribute("WindowState", WindowState);
     return this;
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:7,代码来源:SavedWindowState.cs

示例10: Write

		public static HexBoxUIState Write(ISettingsSection section, HexBoxUIState s) {
			if (s.HexBoxState == null)
				return s;

			section.Attribute("BytesGroupCount", s.BytesGroupCount);
			section.Attribute("BytesPerLine", s.BytesPerLine);
			section.Attribute("UseHexPrefix", s.UseHexPrefix);
			section.Attribute("ShowAscii", s.ShowAscii);
			section.Attribute("LowerCaseHex", s.LowerCaseHex);
			section.Attribute("AsciiEncoding", s.AsciiEncoding);

			section.Attribute("HexOffsetSize", s.HexOffsetSize);
			section.Attribute("UseRelativeOffsets", s.UseRelativeOffsets);
			section.Attribute("BaseOffset", s.BaseOffset);

			section.Attribute("HexBoxState-TopOffset", s.HexBoxState.TopOffset);
			section.Attribute("HexBoxState-Column", s.HexBoxState.Column);
			section.Attribute("HexBoxState-StartOffset", s.HexBoxState.StartOffset);
			section.Attribute("HexBoxState-EndOffset", s.HexBoxState.EndOffset);
			section.Attribute("HexBoxState-HexBoxPosition-Offset", s.HexBoxState.CaretPosition.Offset);
			section.Attribute("HexBoxState-HexBoxPosition-Kind", s.HexBoxState.CaretPosition.Kind);
			section.Attribute("HexBoxState-HexBoxPosition-KindPosition", s.HexBoxState.CaretPosition.KindPosition);
			if (s.HexBoxState.Selection != null) {
				section.Attribute("HexBoxState-Selection-From", s.HexBoxState.Selection.Value.From);
				section.Attribute("HexBoxState-Selection-To", s.HexBoxState.Selection.Value.To);
			}

			return s;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:29,代码来源:HexBoxUIStateSerializer.cs

示例11: Serialize

		public Guid? Serialize(DocumentTabContent content, ISettingsSection section) {
			var hb = content as HexViewDocumentTabContent;
			if (hb == null)
				return null;

			section.Attribute("filename", hb.Filename);
			return GUID_SerializedContent;
		}
开发者ID:0xd4d,项目名称:dnSpy,代码行数:8,代码来源:HexBoxDocumentTabContent.cs

示例12: Serialize

		public Guid? Serialize(IFileTabContent content, ISettingsSection section) {
			if (content is AssemblyChildNodeTabContent) {
				// There's nothing else we need to serialize it, but if there were, use 'section'
				// to write the info needed by Deserialize() above.
				return GUID_SerializedContent;
			}
			return null;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:8,代码来源:AssemblyChildNodeTabContent.cs

示例13: Serialize

		public Guid? Serialize(IFileTabContent content, ISettingsSection section) {
			var dc = content as DecompileFileTabContent;
			if (dc == null)
				return null;

			section.Attribute("Language", dc.Language.UniqueGuid);
			return GUID_SerializedContent;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:8,代码来源:DecompileFileTabContent.cs

示例14: RemoveSection

		public void RemoveSection(ISettingsSection section) {
			Debug.Assert(section != null);
			if (section == null)
				throw new ArgumentNullException(nameof(section));

			bool b = sections.Remove(section);
			Debug.Assert(b);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:SettingsSectionProvider.cs

示例15: Deserialize

		public DocumentTabContent Deserialize(Guid guid, ISettingsSection section, IDocumentTabContentFactoryContext context) {
			if (guid != GUID_SerializedContent)
				return null;

			var langGuid = section.Attribute<Guid?>("Language") ?? DecompilerConstants.LANGUAGE_CSHARP;
			var language = DecompilerService.FindOrDefault(langGuid);
			return new DecompileDocumentTabContent(this, context.Nodes, language);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:DecompileDocumentTabContent.cs


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