本文整理汇总了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);
}
示例2: Serialize
public Guid? Serialize(IFileTabContent content, ISettingsSection section) {
var dc = content as HexFileTabContent;
if (dc == null)
return null;
return GUID_SerializedContent;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例9: Write
public SavedWindowState Write(ISettingsSection section)
{
section.Attribute("Bounds", Bounds);
section.Attribute("IsFullScreen", IsFullScreen);
section.Attribute("WindowState", WindowState);
return this;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}