本文整理汇总了C#中ISettingsSection.Attribute方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsSection.Attribute方法的具体用法?C# ISettingsSection.Attribute怎么用?C# ISettingsSection.Attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettingsSection
的用法示例。
在下文中一共展示了ISettingsSection.Attribute方法的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: Write
public SavedWindowState Write(ISettingsSection section)
{
section.Attribute("Bounds", Bounds);
section.Attribute("IsFullScreen", IsFullScreen);
section.Attribute("WindowState", WindowState);
return this;
}
示例3: 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;
}
示例4: TryLoad
public static DnSpyFileInfo? TryLoad(ISettingsSection section)
{
var name = section.Attribute<string>(FILEINFO_NAME_ATTR);
var type = section.Attribute<Guid?>(FILEINFO_TYPE_ATTR) ?? FileConstants.FILETYPE_FILE;
if (string.IsNullOrEmpty(name))
return null;
return new DnSpyFileInfo(name, type);
}
示例5: 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));
}
示例6: 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;
}
示例7: 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);
}
}
示例8: 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);
}
示例9: Serialize
public Guid? Serialize(DocumentTabContent content, ISettingsSection section) {
var dc = content as DecompileDocumentTabContent;
if (dc == null)
return null;
section.Attribute("Language", dc.Decompiler.UniqueGuid);
return GUID_SerializedContent;
}
示例10: 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;
}
示例11: 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);
}
示例12: Create
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;
}
示例13: Load
public void Load(ISettingsSection section) {
var listName = section.Attribute<string>(CURRENT_LIST_ATTR);
var names = new HashSet<string>(StringComparer.Ordinal);
foreach (var listSection in section.SectionsWithName(DOCUMENT_LIST_SECTION)) {
var documentList = DocumentList.Create(listSection);
if (names.Contains(documentList.Name))
continue;
documentsList.Add(documentList);
}
hasLoaded = true;
SelectList(listName);
}
示例14: TryDeserialize
public static StackedContentState TryDeserialize(ISettingsSection section) {
var state = new StackedContentState();
bool? b = section.Attribute<bool?>(ISHORIZONTAL_ATTR);
if (b == null)
return null;
state.IsHorizontal = b.Value;
foreach (var lengthSect in section.SectionsWithName(LENGTH_SECTION)) {
var length = lengthSect.Attribute<GridLength?>(LENGTH_ATTR);
if (length == null)
return null;
state.RowsCols.Add(length.Value);
}
return state;
}
示例15: ReadSection
void ReadSection(XElement xml, ISettingsSection section, int recursionCounter) {
if (recursionCounter >= XmlSettingsConstants.MAX_CHILD_DEPTH)
return;
foreach (var xmlAttr in xml.Attributes()) {
var attrName = xmlAttr.Name.LocalName;
if (attrName == XmlSettingsConstants.SECTION_ATTRIBUTE_NAME)
continue;
section.Attribute(attrName, XmlUtils.UnescapeAttributeValue(xmlAttr.Value));
}
foreach (var xmlSect in xml.Elements(XmlSettingsConstants.SECTION_NAME)) {
var name = XmlUtils.UnescapeAttributeValue((string)xmlSect.Attribute(XmlSettingsConstants.SECTION_ATTRIBUTE_NAME));
if (name == null)
continue;
var childSection = section.CreateSection(name);
ReadSection(xmlSect, childSection, recursionCounter + 1);
}
}