public static String GetSettings(SettingsType type, SectionType section) { return (ConfigurationManager.AppSettings[ String.Format("{0}_{1}", Enum.Parse(typeof(SettingsType), type.ToString()).ToString(), Enum.Parse(typeof(SectionType), section.ToString()).ToString()) ]); }
public void Describe() { Console.WriteLine("{0} SECTION HEADER --- {1}", Type.ToString().ToUpperInvariant(), GetName()); Console.WriteLine("Data Offset: {0,8:X} Data Size: {1}B", SegmentImageOffset, SegmentImageSize); Console.WriteLine("Virt Base Address: {0,8:X} Alignment: {1}B", SegmentInMemVirtAddress, Math.Pow(Alignment, 2)); Console.WriteLine("Link Index: {0,8:X} Info: {1,8:X}", LinkIndex, Info); Console.WriteLine(); if (SectionData != null) { SectionData.Describe(); } }
public bool Write(BinaryWriter outputWriter) { if (IsNull()) { outputWriter.Write((Int32)0); } else { string name = Type.ToString(); Debug.Assert(name.Length == 4, "Section type name MUST be 4 characters long!"); outputWriter.WriteFixedString(name, System.Text.Encoding.ASCII); } outputWriter.Write((Int32)Size); outputWriter.Write((Int32)Offset); return(true); }
private string GetSectionCaption(SectionType sectionType) { switch (sectionType) { case SectionType.Administration: return(loc.Section_Administration); case SectionType.Analytics: return(loc.Section_Analytics); case SectionType.Programming: return(loc.Section_Programming); case SectionType.ProjectManagement: return(loc.Section_ProjectManagement); case SectionType.Testing: return(loc.Section_Testing); default: return(sectionType.ToString()); } }
/// <summary> /// Parse a section from the xml. /// </summary> /// <param name="reader">XmlReader where the intermediate is persisted.</param> /// <param name="tableDefinitions">TableDefinitions to use in the intermediate.</param> /// <returns>The parsed Section.</returns> internal static Section Parse(XmlReader reader, TableDefinitionCollection tableDefinitions) { Debug.Assert("section" == reader.LocalName); int codepage = 0; bool empty = reader.IsEmptyElement; string id = null; Section section = null; SectionType type = SectionType.Unknown; while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "codepage": codepage = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture); break; case "id": id = reader.Value; break; case "type": switch (reader.Value) { case "bundle": type = SectionType.Bundle; break; case "fragment": type = SectionType.Fragment; break; case "module": type = SectionType.Module; break; case "patchCreation": type = SectionType.PatchCreation; break; case "product": type = SectionType.Product; break; case "patch": type = SectionType.Patch; break; default: throw new WixException(WixErrors.IllegalAttributeValue(SourceLineNumber.CreateFromUri(reader.BaseURI), "section", reader.Name, reader.Value, "fragment", "module", "patchCreation", "product", "patch")); } break; default: if (!reader.NamespaceURI.StartsWith("http://www.w3.org/", StringComparison.Ordinal)) { throw new WixException(WixErrors.UnexpectedAttribute(SourceLineNumber.CreateFromUri(reader.BaseURI), "section", reader.Name)); } break; } } if (null == id && (SectionType.Unknown != type && SectionType.Fragment != type)) { throw new WixException(WixErrors.ExpectedAttribute(SourceLineNumber.CreateFromUri(reader.BaseURI), "section", "id", "type", type.ToString())); } if (SectionType.Unknown == type) { throw new WixException(WixErrors.ExpectedAttribute(SourceLineNumber.CreateFromUri(reader.BaseURI), "section", "type")); } section = new Section(id, type, codepage); section.sourceLineNumbers = SourceLineNumber.CreateFromUri(reader.BaseURI); if (!empty) { bool done = false; while (!done && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "table": section.Tables.Add(Table.Parse(reader, section, tableDefinitions)); break; default: throw new WixException(WixErrors.UnexpectedElement(SourceLineNumber.CreateFromUri(reader.BaseURI), "section", reader.Name)); } break; case XmlNodeType.EndElement: done = true; break; } } if (!done) { throw new WixException(WixErrors.ExpectedEndElement(SourceLineNumber.CreateFromUri(reader.BaseURI), "section")); } } return(section); }
/// <summary> /// Converts the given SectionPropertyExceptions /// </summary> /// <param name="sepx"></param> public void Apply(SectionPropertyExceptions sepx) { XmlElement pgMar = _nodeFactory.CreateElement("w", "pgMar", OpenXmlNamespaces.WordprocessingML); XmlElement pgSz = _nodeFactory.CreateElement("w", "pgSz", OpenXmlNamespaces.WordprocessingML); XmlElement docGrid = _nodeFactory.CreateElement("w", "docGrid", OpenXmlNamespaces.WordprocessingML); XmlElement cols = _nodeFactory.CreateElement("w", "cols", OpenXmlNamespaces.WordprocessingML); XmlElement pgBorders = _nodeFactory.CreateElement("w", "pgBorders", OpenXmlNamespaces.WordprocessingML); XmlElement paperSrc = _nodeFactory.CreateElement("w", "paperSrc", OpenXmlNamespaces.WordprocessingML); XmlElement footnotePr = _nodeFactory.CreateElement("w", "footnotePr", OpenXmlNamespaces.WordprocessingML); XmlElement pgNumType = _nodeFactory.CreateElement("w", "pgNumType", OpenXmlNamespaces.WordprocessingML); //convert headers of this section if (_ctx.Doc.HeaderAndFooterTable.OddHeaders.Count > 0) { CharacterRange evenHdr = _ctx.Doc.HeaderAndFooterTable.EvenHeaders[_sectNr]; if (evenHdr != null) { HeaderPart evenPart = _ctx.Docx.MainDocumentPart.AddHeaderPart(); _ctx.Doc.Convert(new HeaderMapping(_ctx, evenPart, evenHdr)); appendRef(_sectPr, "headerReference", "even", evenPart.RelIdToString); } CharacterRange oddHdr = _ctx.Doc.HeaderAndFooterTable.OddHeaders[_sectNr]; if (oddHdr != null) { HeaderPart oddPart = _ctx.Docx.MainDocumentPart.AddHeaderPart(); _ctx.Doc.Convert(new HeaderMapping(_ctx, oddPart, oddHdr)); appendRef(_sectPr, "headerReference", "default", oddPart.RelIdToString); } CharacterRange firstHdr = _ctx.Doc.HeaderAndFooterTable.FirstHeaders[_sectNr]; if (firstHdr != null) { HeaderPart firstPart = _ctx.Docx.MainDocumentPart.AddHeaderPart(); _ctx.Doc.Convert(new HeaderMapping(_ctx, firstPart, firstHdr)); appendRef(_sectPr, "headerReference", "first", firstPart.RelIdToString); } } //convert footers of this section if (_ctx.Doc.HeaderAndFooterTable.OddFooters.Count > 0) { CharacterRange evenFtr = _ctx.Doc.HeaderAndFooterTable.EvenFooters[_sectNr]; if (evenFtr != null) { FooterPart evenPart = _ctx.Docx.MainDocumentPart.AddFooterPart(); _ctx.Doc.Convert(new FooterMapping(_ctx, evenPart, evenFtr)); appendRef(_sectPr, "footerReference", "even", evenPart.RelIdToString); } CharacterRange oddFtr = _ctx.Doc.HeaderAndFooterTable.OddFooters[_sectNr]; if (oddFtr != null) { FooterPart oddPart = _ctx.Docx.MainDocumentPart.AddFooterPart(); _ctx.Doc.Convert(new FooterMapping(_ctx, oddPart, oddFtr)); appendRef(_sectPr, "footerReference", "default", oddPart.RelIdToString); } CharacterRange firstFtr = _ctx.Doc.HeaderAndFooterTable.FirstFooters[_sectNr]; if (firstFtr != null) { FooterPart firstPart = _ctx.Docx.MainDocumentPart.AddFooterPart(); _ctx.Doc.Convert(new FooterMapping(_ctx, firstPart, firstFtr)); appendRef(_sectPr, "footerReference", "first", firstPart.RelIdToString); } } foreach (SinglePropertyModifier sprm in sepx.grpprl) { switch (sprm.OpCode) { //page margins case SinglePropertyModifier.OperationCode.sprmSDxaLeft: //left margin _marLeft = System.BitConverter.ToInt16(sprm.Arguments, 0); appendValueAttribute(pgMar, "left", _marLeft.ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDxaRight: //right margin _marRight = System.BitConverter.ToInt16(sprm.Arguments, 0); appendValueAttribute(pgMar, "right", _marRight.ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDyaTop: //top margin appendValueAttribute(pgMar, "top", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDyaBottom: //bottom margin appendValueAttribute(pgMar, "bottom", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDzaGutter: //gutter margin appendValueAttribute(pgMar, "gutter", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDyaHdrTop: //header margin appendValueAttribute(pgMar, "header", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDyaHdrBottom: //footer margin appendValueAttribute(pgMar, "footer", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; //page size and orientation case SinglePropertyModifier.OperationCode.sprmSXaPage: //width _pgWidth = System.BitConverter.ToInt16(sprm.Arguments, 0); appendValueAttribute(pgSz, "w", _pgWidth.ToString()); break; case SinglePropertyModifier.OperationCode.sprmSYaPage: //height appendValueAttribute(pgSz, "h", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSBOrientation: //orientation appendValueAttribute(pgSz, "orient", ((PageOrientation)sprm.Arguments[0]).ToString()); break; //paper source case SinglePropertyModifier.OperationCode.sprmSDmBinFirst: appendValueAttribute(paperSrc, "first", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDmBinOther: appendValueAttribute(paperSrc, "other", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; //page borders case SinglePropertyModifier.OperationCode.sprmSBrcTop80: case SinglePropertyModifier.OperationCode.sprmSBrcTop: //top XmlElement topBorder = _nodeFactory.CreateElement("w", "top", OpenXmlNamespaces.WordprocessingML); appendBorderAttributes(new BorderCode(sprm.Arguments), topBorder); addOrSetBorder(pgBorders, topBorder); break; case SinglePropertyModifier.OperationCode.sprmSBrcLeft80: case SinglePropertyModifier.OperationCode.sprmSBrcLeft: //left XmlElement leftBorder = _nodeFactory.CreateElement("w", "left", OpenXmlNamespaces.WordprocessingML); appendBorderAttributes(new BorderCode(sprm.Arguments), leftBorder); addOrSetBorder(pgBorders, leftBorder); break; case SinglePropertyModifier.OperationCode.sprmSBrcBottom80: case SinglePropertyModifier.OperationCode.sprmSBrcBottom: //left XmlElement bottomBorder = _nodeFactory.CreateElement("w", "bottom", OpenXmlNamespaces.WordprocessingML); appendBorderAttributes(new BorderCode(sprm.Arguments), bottomBorder); addOrSetBorder(pgBorders, bottomBorder); break; case SinglePropertyModifier.OperationCode.sprmSBrcRight80: case SinglePropertyModifier.OperationCode.sprmSBrcRight: //left XmlElement rightBorder = _nodeFactory.CreateElement("w", "right", OpenXmlNamespaces.WordprocessingML); appendBorderAttributes(new BorderCode(sprm.Arguments), rightBorder); addOrSetBorder(pgBorders, rightBorder); break; //footnote porperties case SinglePropertyModifier.OperationCode.sprmSRncFtn: //restart code FootnoteRestartCode fncFtn = FootnoteRestartCode.continuous; //open office uses 1 byte values instead of 2 bytes values: if (sprm.Arguments.Length == 2) { fncFtn = (FootnoteRestartCode)System.BitConverter.ToInt16(sprm.Arguments, 0); } if (sprm.Arguments.Length == 1) { fncFtn = (FootnoteRestartCode)sprm.Arguments[0]; } appendValueElement(footnotePr, "numRestart", fncFtn.ToString(), true); break; case SinglePropertyModifier.OperationCode.sprmSFpc: //position code Int16 fpc = 0; if (sprm.Arguments.Length == 2) { fpc = System.BitConverter.ToInt16(sprm.Arguments, 0); } else { fpc = (Int16)sprm.Arguments[0]; } if (fpc == 2) { appendValueElement(footnotePr, "pos", "beneathText", true); } break; case SinglePropertyModifier.OperationCode.sprmSNfcFtnRef: //number format Int16 nfc = System.BitConverter.ToInt16(sprm.Arguments, 0); appendValueElement(footnotePr, "numFmt", NumberingMapping.GetNumberFormat(nfc), true); break; case SinglePropertyModifier.OperationCode.sprmSNFtn: Int16 nFtn = System.BitConverter.ToInt16(sprm.Arguments, 0); appendValueElement(footnotePr, "numStart", nFtn.ToString(), true); break; //doc grid case SinglePropertyModifier.OperationCode.sprmSDyaLinePitch: appendValueAttribute(docGrid, "linePitch", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDxtCharSpace: appendValueAttribute(docGrid, "charSpace", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSClm: appendValueAttribute(docGrid, "type", ((DocGridType)System.BitConverter.ToInt16(sprm.Arguments, 0)).ToString()); break; //columns case SinglePropertyModifier.OperationCode.sprmSCcolumns: _colNumber = (int)(System.BitConverter.ToInt16(sprm.Arguments, 0) + 1); _colSpace = new Int16[_colNumber]; appendValueAttribute(cols, "num", _colNumber.ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDxaColumns: //evenly spaced columns appendValueAttribute(cols, "space", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; case SinglePropertyModifier.OperationCode.sprmSDxaColWidth: //there is at least one width set, so create the array if (_colWidth == null) { _colWidth = new Int16[_colNumber]; } byte index = sprm.Arguments[0]; Int16 w = System.BitConverter.ToInt16(sprm.Arguments, 1); _colWidth[index] = w; break; case SinglePropertyModifier.OperationCode.sprmSDxaColSpacing: //there is at least one space set, so create the array if (_colSpace == null) { _colSpace = new Int16[_colNumber]; } _colSpace[sprm.Arguments[0]] = System.BitConverter.ToInt16(sprm.Arguments, 1); break; //bidi case SinglePropertyModifier.OperationCode.sprmSFBiDi: appendFlagElement(_sectPr, sprm, "bidi", true); break; //title page case SinglePropertyModifier.OperationCode.sprmSFTitlePage: appendFlagElement(_sectPr, sprm, "titlePg", true); break; //RTL gutter case SinglePropertyModifier.OperationCode.sprmSFRTLGutter: appendFlagElement(_sectPr, sprm, "rtlGutter", true); break; //type case SinglePropertyModifier.OperationCode.sprmSBkc: _type = (SectionType)sprm.Arguments[0]; break; //align case SinglePropertyModifier.OperationCode.sprmSVjc: appendValueElement(_sectPr, "vAlign", sprm.Arguments[0].ToString(), true); break; //pgNumType case SinglePropertyModifier.OperationCode.sprmSNfcPgn: PageNumberFormatCode pgnFc = (PageNumberFormatCode)sprm.Arguments[0]; appendValueAttribute(pgNumType, "fmt", pgnFc.ToString()); break; case SinglePropertyModifier.OperationCode.sprmSPgnStart: appendValueAttribute(pgNumType, "start", System.BitConverter.ToInt16(sprm.Arguments, 0).ToString()); break; } } //build the columns if (_colWidth != null) { //set to unequal width XmlAttribute equalWidth = _nodeFactory.CreateAttribute("w", "equalWidth", OpenXmlNamespaces.WordprocessingML); equalWidth.Value = "0"; cols.Attributes.Append(equalWidth); //calculate the width of the last column: //the last column width is not written to the document because it can be calculated. if (_colWidth[_colWidth.Length - 1] == 0) { Int16 lastColWidth = (Int16)(_pgWidth - _marLeft - _marRight); for (int i = 0; i < _colWidth.Length - 1; i++) { lastColWidth -= _colSpace[i]; lastColWidth -= _colWidth[i]; } _colWidth[_colWidth.Length - 1] = lastColWidth; } //append the xml elements for (int i = 0; i < _colWidth.Length; i++) { XmlElement col = _nodeFactory.CreateElement("w", "col", OpenXmlNamespaces.WordprocessingML); XmlAttribute w = _nodeFactory.CreateAttribute("w", "w", OpenXmlNamespaces.WordprocessingML); XmlAttribute space = _nodeFactory.CreateAttribute("w", "space", OpenXmlNamespaces.WordprocessingML); w.Value = _colWidth[i].ToString(); space.Value = _colSpace[i].ToString(); col.Attributes.Append(w); col.Attributes.Append(space); cols.AppendChild(col); } } //append the section type appendValueElement(_sectPr, "type", _type.ToString(), true); //append footnote properties if (footnotePr.ChildNodes.Count > 0) { _sectPr.AppendChild(footnotePr); } //append page size if (pgSz.Attributes.Count > 0) { _sectPr.AppendChild(pgSz); } //append borders if (pgBorders.ChildNodes.Count > 0) { _sectPr.AppendChild(pgBorders); } //append margin if (pgMar.Attributes.Count > 0) { _sectPr.AppendChild(pgMar); } //append paper info if (paperSrc.Attributes.Count > 0) { _sectPr.AppendChild(paperSrc); } //append columns if (cols.Attributes.Count > 0 || cols.ChildNodes.Count > 0) { _sectPr.AppendChild(cols); } //append doc grid if (docGrid.Attributes.Count > 0) { _sectPr.AppendChild(docGrid); } //numType if (pgNumType.Attributes.Count > 0) { _sectPr.AppendChild(pgNumType); } if (_writer != null) { //write the properties _sectPr.WriteTo(_writer); } }
private void RedisIntercept(CachingMethod method, IInvocation invocation, string key, SectionType type, int time) { switch (method) { case CachingMethod.Get: { var list = default(object); var cacheObj = CacheContainer.GetInstances <ICacheProvider>(string.Format("{0}.{1}", type.ToString(), CacheTargetType.Redis.ToString())); var json = cacheObj.Get <string>(key); if (string.IsNullOrEmpty(json)) { invocation.Proceed(); list = invocation.ReturnValue; if (list != null) { json = JsonConvert.SerializeObject(list); cacheObj.Add(key, json, time); } } else { list = JsonConvert.DeserializeObject(json, invocation.Method.ReturnType); } invocation.ReturnValue = list; break; } case CachingMethod.Put: { break; } case CachingMethod.Remove: { break; } } }
public override string ToString() { return(String.Format("{0}, Size: {1}, Vers: {2}", Type.ToString(), Size, Version)); }
public override string ToString() // helpful for debugger { return(Type.ToString()); }
public string GetSectionType() { return(sectionType.ToString()); }
// apply relocation to the in-memory copy of the code section // addr: the run-time address of the location being relocated // offset: the offset within the object code section of the // location being relocated // section: an in-memory copy of the object code section // addend: a constant to add to the value of the relocation symbol // symbol: the relocation symbol whose value is to be added to // the location specified by addr and offset. // type: the type of relocation to be performed, as specified // in the Elf documentation (and as discovered by // inspection of Arm object code files). protected void performRelocation( uint addr, int offset, byte[] section, uint addend, ST symbol, uint type) { uint word = getInt32(section, offset); uint newWord = 0; string name = symbol.name; int val; // value of the symbol string symbolKind = "??"; SectionType st = SectionType.Unknown; if (!String.IsNullOrEmpty(name)) { bool isNewUnknown = false; SyEntry sym = af.LookupSymbol(name, out isNewUnknown); if (sym == null) { if (name == "__cs3_heap_start" || name == "_end") { // This is a temporary fixup; the proper solution would involve // reading loader script which defined __cs3_heap_start = _end. val = DataEnd; //af.DefineSymbol(name, -1, val-bssStart, SectionType.Bss); } //else if (name == "__cs3_heap_limit") // val = dataEnd + heapSize; else { if (isNewUnknown) { af.ParseError("reference to undefined external symbol {0}", name); } return; } } else { val = sym.SymValue; } } else { bool local = true; val = getSymbolValue(symbol, ref symbolKind, ref st, ref local); switch (st) { case SectionType.Text: val += TextStart; break; case SectionType.Data: val += DataStart; break; case SectionType.Bss: val += BssStart; break; default: Debug.WriteLine(String.Format( "- anon symbol, kind={0}, section type {1} ignored", symbolKind, st.ToString())); return; } } uint opnd; bool supported = true; switch (type) { case 0: return; case 2: // R_ARM_ABS32 newWord = (uint)(word + val + addend); break; case 1: // R_ARM_PC24 (used by gcc from Australia) case 27: // R_ARM_PLT32 (deprecated but used by CodeSourcery) case 28: // R_ARM_CALL (used by CodeSourcery) case 29: // R_ARM_JUMP24 (used by CodeSourcery) opnd = (uint)((word & 0x00ffffff) << 2); if ((opnd & 0x02000000) != 0) // sign extend? { opnd |= 0xFC000000; } opnd += (uint)(val + addend - addr); opnd = (uint)((opnd >> 2) & 0xFFFFFF); newWord = (uint)((word & 0xFF000000) | opnd); break; default: supported = false; break; } if (!supported || trace > 0) { Debug.WriteLine(String.Format( " Relocation: old=0x{0:X}, new=0x{1:X}, val=0x{2:X}, add=0x{3:X}, type={4}", word, newWord, val, addend, type)); } if (!supported) { throw new AsmException("unhandled relocation type: {0}", type); } putInt32(section, offset, newWord); }
public bool IsOfType(SectionType type) { return(Type.Equals(type.ToString())); }
public async Task LoadSection(SectionType section, bool resetOffset = false) { window.SetIsEnabled(false); if (resetOffset) { ResetOffset(); } try { bool filter; switch (section) { case SectionType.General: filter = AppManager.Instance.Settings.DefaultFeed != RantSort.Top ? AppManager.Instance.Settings.FilterOutRead : false; await LoadFeed(FeedType.General, sort : AppManager.Instance.Settings.DefaultFeed, filter : filter); //TODO: Add params from Settings break; case SectionType.GeneralAlgo: await LoadFeed(FeedType.General, sort : RantSort.Algo, filter : AppManager.Instance.Settings.FilterOutRead); break; case SectionType.GeneralRecent: await LoadFeed(FeedType.General, sort : RantSort.Recent, filter : AppManager.Instance.Settings.FilterOutRead); break; case SectionType.TopDay: await LoadFeed(FeedType.General, sort : RantSort.Top, range : RantRange.Day); break; case SectionType.Top: //TODO: Add Default to options case SectionType.TopWeek: await LoadFeed(FeedType.General, sort : RantSort.Top, range : RantRange.Week); break; case SectionType.TopMonth: await LoadFeed(FeedType.General, sort : RantSort.Top, range : RantRange.Month); break; case SectionType.TopAll: await LoadFeed(FeedType.General, sort : RantSort.Top, range : RantRange.All); break; case SectionType.Story: filter = ds.DefaultRange != RantRange.All ? AppManager.Instance.Settings.FilterOutRead : false; await LoadFeed(FeedType.Stories, ds.DefaultFeed, AppManager.Instance.Settings.DefaultRange, filter : filter); break; case SectionType.StoryDay: await LoadFeed(FeedType.Stories, ds.DefaultFeed, RantRange.Day, filter : ds.FilterOutRead); break; case SectionType.StoryWeek: await LoadFeed(FeedType.Stories, ds.DefaultFeed, RantRange.Week, filter : ds.FilterOutRead); break; case SectionType.StoryMonth: await LoadFeed(FeedType.Stories, ds.DefaultFeed, RantRange.Month, filter : ds.FilterOutRead); break; case SectionType.StoryAll: await LoadFeed(FeedType.Stories, ds.DefaultFeed, RantRange.All); break; case SectionType.Collab: await LoadCollabs(); break; case SectionType.Notifications: LoadNotifications(); break; case SectionType.Drafts: LoadDrafts(); break; case SectionType.Updates: LoadUpdatesSection(); break; default: throw new NotSupportedException(section.ToString() + " not supported."); } currentSectionType = section; } catch (Exception e) { throw; } finally { window.SetIsEnabled(true); } }
/// <summary> /// Parse a section from the xml. /// </summary> /// <param name="reader">XmlReader where the intermediate is persisted.</param> /// <param name="tableDefinitions">TableDefinitions to use in the intermediate.</param> /// <returns>The parsed Section.</returns> internal static Section Parse(XmlReader reader, TableDefinitionCollection tableDefinitions) { Debug.Assert("section" == reader.LocalName); int codepage = 0; bool empty = reader.IsEmptyElement; string id = null; Section section = null; SectionType type = SectionType.Unknown; while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "codepage": codepage = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture); break; case "id": id = reader.Value; break; case "type": switch (reader.Value) { case "bundle": type = SectionType.Bundle; break; case "fragment": type = SectionType.Fragment; break; case "module": type = SectionType.Module; break; case "patchCreation": type = SectionType.PatchCreation; break; case "product": type = SectionType.Product; break; case "patch": type = SectionType.Patch; break; default: throw new WixException(WixErrors.IllegalAttributeValue(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", reader.Name, reader.Value, "fragment", "module", "patchCreation", "product", "patch")); } break; default: if (!reader.NamespaceURI.StartsWith("http://www.w3.org/", StringComparison.Ordinal)) { throw new WixException(WixErrors.UnexpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", reader.Name)); } break; } } if (null == id && (SectionType.Unknown != type && SectionType.Fragment != type)) { throw new WixException(WixErrors.ExpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", "id", "type", type.ToString())); } if (SectionType.Unknown == type) { throw new WixException(WixErrors.ExpectedAttribute(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", "type")); } section = new Section(id, type, codepage); section.sourceLineNumbers = SourceLineNumberCollection.FromUri(reader.BaseURI); if (!empty) { bool done = false; while (!done && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "table": section.Tables.Add(Table.Parse(reader, section, tableDefinitions)); break; default: throw new WixException(WixErrors.UnexpectedElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "section", reader.Name)); } break; case XmlNodeType.EndElement: done = true; break; } } if (!done) { throw new WixException(WixErrors.ExpectedEndElement(SourceLineNumberCollection.FromUri(reader.BaseURI), "section")); } } return section; }
public ArticlesNYT GetArticlesNyt(SectionType sectionType) { return(WebHelper.Get <ArticlesNYT>($"{_nancyData.TopStoriesUrl}{sectionType.ToString().ToLower()}.json?api-key={_nancyData.NancyApiKey}")); }
public Section GetSection(SectionType sectionType, double width) { switch (sectionType) { case SectionType.Trepezoidal: return(new TrapezoidalSection(width)); case SectionType.Rectangular: throw new NotImplementedException(Resources.RECTANGULAR_SECTION_NOT_IMPLEMENTED_ERROR); default: throw new NotSupportedException(string.Format(Resources.ENUM_VALUE_NOT_SUPPORTED_ERROR, sectionType.ToString())); } }