protected FileSectionProviderBase(uint Address, uint PartitionSize, SectionFormat Format, string DisplayName)
 {
     _format = Format;
     _displayName = DisplayName;
     _partitionSize = PartitionSize;
     _address = Address;
 }
Пример #2
0
        public static IEnumerable <SectionFormat> SectionIterator(SectionIteratorKind iteratorKind)
        {
            switch (iteratorKind)
            {
            case SectionIteratorKind.BasicBlocks:
                yield return(SectionFormat.BasicBlockInfo);

                yield return(SectionFormat.MethodProfilingData);

                break;

            case SectionIteratorKind.TokenFlags:
            case SectionIteratorKind.All:
                for (SectionFormat section = 0; section < SectionFormat.SectionFormatCount; section++)
                {
                    if (IBCData.IsTokenList(section) || iteratorKind == SectionIteratorKind.All)
                    {
                        yield return(section);
                    }
                }
                break;

            default:
                throw new IBCException("Unsupported iteratorKind");
            }
        }
Пример #3
0
        private void ParseSchema(XmlDocument doc)
        {
            XmlNodeList lst = doc.GetElementsByTagName("SECTION");

            if (lst.Count == 0)
            {
                throw new XmlException("Could not locate the 'TABLE' node." + Environment.NewLine +
                                       "The Schema is case sensitive.");
            }

            // Process Each Section added to Sections Collection
            foreach (XmlNode tableNode in lst)
            {
                string        Name       = "";
                SectionFormat fileformat = SectionFormat.FixedWidth;

                foreach (XmlAttribute attribute in tableNode.Attributes)
                {
                    switch (attribute.Name.ToLower())
                    {
                    case "name": Name = attribute.Value; break;

                    case "sectionformat": fileformat = (SectionFormat)Enum.Parse(typeof(SectionFormat), attribute.Value); break;
                    }
                }
                Section             section      = new Section(Name, fileformat);
                TextFieldCollection m_TextFields = ParseSchemaSection(tableNode);
                section.TextFields = m_TextFields;
                sections.Add(section);
            }
        }
Пример #4
0
 private static void ProcessSectionFormat(SectionFormat sf, Utf8JsonWriter jsonw)
 {
     jsonw.WritePropertyName("SectionFormat");
     jsonw.WriteStartObject();
     jsonw.WriteString("BackgroundColor", sf.BackgroundColor.ToStringSafe());
     jsonw.WriteString("CssClass", sf.CssClass);
     jsonw.WriteString("EnableKeepTogether", sf.EnableKeepTogether.ToStringSafe());
     jsonw.WriteString("EnableNewPageAfter", sf.EnableNewPageAfter.ToStringSafe());
     jsonw.WriteString("EnableNewPageBefore", sf.EnableNewPageBefore.ToStringSafe());
     jsonw.WriteString("EnablePrintAtBottomOfPage", sf.EnablePrintAtBottomOfPage.ToStringSafe());
     jsonw.WriteString("EnableResetPageNumberAfter", sf.EnableResetPageNumberAfter.ToStringSafe());
     jsonw.WriteString("EnableSuppress", sf.EnableSuppress.ToStringSafe());
     jsonw.WriteString("EnableSuppressIfBlank", sf.EnableSuppressIfBlank.ToStringSafe());
     jsonw.WriteString("EnableUnderlaySection", sf.EnableUnderlaySection.ToStringSafe());
     jsonw.WriteString("PageOrientation", sf.PageOrientation.ToStringSafe());
     jsonw.WriteString("BackgroundColorFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeBackgroundColor].Text);
     jsonw.WriteString("EnableClampPageFooterFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableClampPageFooter].Text);
     jsonw.WriteString("EnableHideForDrillDownFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableHideForDrillDown].Text);
     jsonw.WriteString("EnableKeepTogetherFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableKeepTogether].Text);
     jsonw.WriteString("EnableNewPageAfterFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableNewPageAfter].Text);
     jsonw.WriteString("EnableNewPageBeforeFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableNewPageBefore].Text);
     jsonw.WriteString("EnablePrintAtBottomOfPageFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnablePrintAtBottomOfPage].Text);
     jsonw.WriteString("EnableResetPageNumberAfterFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableResetPageNumberAfter].Text);
     jsonw.WriteString("EnableSuppressFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableSuppress].Text);
     jsonw.WriteString("EnableSuppressIfBlankFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableSuppressIfBlank].Text);
     jsonw.WriteString("EnableUnderlaySectionFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeEnableUnderlaySection].Text);
     jsonw.WriteString("GroupNumberPerPageFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeGroupNumberPerPage].Text);
     jsonw.WriteString("RecordNumberPerPageFormula", sf.ConditionFormulas[CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeRecordNumberPerPage].Text);
     jsonw.WriteEndObject();
 }
Пример #5
0
        List <IBC.TokenData> ReadTokenSection(SectionFormat section)
        {
            var result = new List <IBC.TokenData>();

            uint numberOfTokens = reader.ReadUInt32();

            uint LastToken = IBC.Utilities.InitialTokenForSection(section);

            for (int i = 0; i < numberOfTokens; ++i)
            {
                uint token = ReadTokenWithMemory(ref LastToken);
                uint flags = ReadFlagWithLookup();

                // Neither minified nor V1 files stored the scenario mask.
                uint?scenarioMask = null;
                if (!minified && (majorVersion > 1))
                {
                    scenarioMask = reader.ReadUInt32();
                }

                result.Add(new IBC.TokenData {
                    Token = token, Flags = flags, ScenarioMask = scenarioMask
                });
            }

            return(result);
        }
Пример #6
0
        Dictionary <SectionFormat, SectionInfo> ReadSectionTable(out long highestValidOffset)
        {
            uint NumberOfEntries = reader.ReadUInt32();
            var  result          = new Dictionary <SectionFormat, SectionInfo>();

            highestValidOffset = 0;
            for (int i = 0; i < NumberOfEntries; ++i)
            {
                SectionInfo   sectionInfo;
                SectionFormat sectionFormat = (SectionFormat)reader.ReadInt32();

                if ((majorVersion == 1) &&
                    (sectionFormat < SectionFormat.UserStringPoolProfilingData))
                {
                    // The ScenarioInfo section was added in V2 and assigned index
                    // zero. Every other section that existed at that point was
                    // bumped up by one.

                    ++sectionFormat;
                }

                sectionInfo.Offset = reader.ReadUInt32();
                sectionInfo.Length = reader.ReadUInt32();

                highestValidOffset = Math.Max(highestValidOffset, sectionInfo.Offset + sectionInfo.Length);

                result.Add(sectionFormat, sectionInfo);
            }

            return(result);
        }
 public IndexPropertyFileSectionProvider(uint Address, uint PartitionSize, SectionFormat Format, string PropertyName, IIndexHelper IndexHelper,
                                         string Root, string DisplayName)
     : base(Address, PartitionSize, Format, DisplayName)
 {
     _indexHelper = IndexHelper;
     _root = Root;
     _propertyName = PropertyName;
 }
 public StaticLinuxImageSection(SectionFormat Format, uint Address, uint PartitionSize, byte[] Data, string DisplayName)
 {
     this.PartitionSize = PartitionSize;
     this.DisplayName = DisplayName;
     this.Format = Format;
     this.Address = Address;
     this.Data = Data;
 }
Пример #9
0
 private void IfPresent(Dictionary <SectionFormat, SectionInfo> sectionTable, SectionFormat section, Action f)
 {
     if (sectionTable.ContainsKey(section))
     {
         SectionInfo info = sectionTable[section];
         SeekTo(info.Offset);
         f();
     }
 }
Пример #10
0
 private static void ProcessSectionFormat(SectionFormat sf, XmlWriter xmlw)
 {
     xmlw.WriteStartElement("SectionFormat");
     xmlw.WriteAttributeString("BackgroundColor", sf.BackgroundColor.ToStringSafe());
     xmlw.WriteAttributeString("CssClass", sf.CssClass);
     xmlw.WriteAttributeString("EnableKeepTogether", sf.EnableKeepTogether.ToStringSafe());
     xmlw.WriteAttributeString("EnableNewPageAfter", sf.EnableNewPageAfter.ToStringSafe());
     xmlw.WriteAttributeString("EnableNewPageBefore", sf.EnableNewPageBefore.ToStringSafe());
     xmlw.WriteAttributeString("EnablePrintAtBottomOfPage", sf.EnablePrintAtBottomOfPage.ToStringSafe());
     xmlw.WriteAttributeString("EnableResetPageNumberAfter", sf.EnableResetPageNumberAfter.ToStringSafe());
     xmlw.WriteAttributeString("EnableSuppress", sf.EnableSuppress.ToStringSafe());
     xmlw.WriteAttributeString("EnableSuppressIfBlank", sf.EnableSuppressIfBlank.ToStringSafe());
     xmlw.WriteAttributeString("EnableUnderlaySection", sf.EnableUnderlaySection.ToStringSafe());
     xmlw.WriteEndElement();
 }
        private static void ApplySectionFormat(
            this Range range,
            SectionFormat sectionFormat)
        {
            if (sectionFormat == null)
            {
                return;
            }

            var implementedProperties = new[]
            {
                nameof(SectionFormat.Options),
            };

            sectionFormat.ThrowOnNotImplementedProperty(implementedProperties);

            range.ApplySectionFormatOptions(sectionFormat.Options);
        }
Пример #12
0
        //
        // Class constuctor for class IBCData
        //
        private static SectionTypeInfo[] ComputeSectionTypeInfos()
        {
            TokenType tokenType;

            SectionTypeInfo[] sectionTypeInfo = new SectionTypeInfo[(int)SectionFormat.SectionFormatCount];

            tokenType = TokenType.TokenTypeOther;
            sectionTypeInfo[(int)SectionFormat.BasicBlockInfo] = new SectionTypeInfo(tokenType, SectionFormat.BasicBlockInfo);
            sectionTypeInfo[(int)SectionFormat.BlobStream]     = new SectionTypeInfo(tokenType, SectionFormat.BlobStream);

            for (SectionFormat section = 0; section < SectionFormat.SectionFormatCount; section++)
            {
                //
                // Initialize tokenType, commonMask and description with their typical values
                //
                tokenType = TokenType.MetaDataToken;

                //
                // Override the typical values of tokenType or commonMask
                // using this switch statement whenever necessary
                //
                switch (section)
                {
                case SectionFormat.ScenarioInfo:
                case SectionFormat.BasicBlockInfo:
                case SectionFormat.BlobStream:
                    tokenType = TokenType.TokenTypeOther;
                    break;

                case SectionFormat.TypeProfilingData:
                case SectionFormat.GenericTypeProfilingData:
                    tokenType = TokenType.TypeToken;
                    break;

                case SectionFormat.MethodProfilingData:
                    tokenType = TokenType.MethodToken;
                    break;
                }

                sectionTypeInfo[(int)section] = new SectionTypeInfo(tokenType, section);
            }

            return(sectionTypeInfo);
        }
Пример #13
0
        private void GetSectionFormat(SectionFormat sectionFormat, XmlWriter writer)
        {
            WriteAndTraceStartElement(writer, "SectionFormat");

            writer.WriteAttributeString("CssClass", sectionFormat.CssClass);
            writer.WriteAttributeString("EnableKeepTogether", sectionFormat.EnableKeepTogether.ToString());
            writer.WriteAttributeString("EnableNewPageAfter", sectionFormat.EnableNewPageAfter.ToString());
            writer.WriteAttributeString("EnableNewPageBefore", sectionFormat.EnableNewPageBefore.ToString());
            writer.WriteAttributeString("EnablePrintAtBottomOfPage", sectionFormat.EnablePrintAtBottomOfPage.ToString());
            writer.WriteAttributeString("EnableResetPageNumberAfter", sectionFormat.EnableResetPageNumberAfter.ToString());
            writer.WriteAttributeString("EnableSuppress", sectionFormat.EnableSuppress.ToString());
            writer.WriteAttributeString("EnableSuppressIfBlank", sectionFormat.EnableSuppressIfBlank.ToString());
            writer.WriteAttributeString("EnableUnderlaySection", sectionFormat.EnableUnderlaySection.ToString());
            if ((ShowFormatTypes & FormatTypes.Color) == FormatTypes.Color)
            {
                GetColorFormat(sectionFormat.BackgroundColor, writer, "BackgroundColor");
            }

            writer.WriteEndElement();
        }
Пример #14
0
        private void GetSectionFormat(SectionFormat sectionFormat, XmlWriter writer)
        {
            WriteAndTraceStartElement(writer, "SectionFormat");

            writer.WriteAttributeString("CssClass", sectionFormat.CssClass);
            writer.WriteAttributeString("EnableKeepTogether", sectionFormat.EnableKeepTogether.ToString());
            writer.WriteAttributeString("EnableNewPageAfter", sectionFormat.EnableNewPageAfter.ToString());
            writer.WriteAttributeString("EnableNewPageBefore", sectionFormat.EnableNewPageBefore.ToString());
            writer.WriteAttributeString("EnablePrintAtBottomOfPage", sectionFormat.EnablePrintAtBottomOfPage.ToString());
            writer.WriteAttributeString("EnableResetPageNumberAfter", sectionFormat.EnableResetPageNumberAfter.ToString());
            writer.WriteAttributeString("EnableSuppress", sectionFormat.EnableSuppress.ToString());
            writer.WriteAttributeString("EnableSuppressIfBlank", sectionFormat.EnableSuppressIfBlank.ToString());
            writer.WriteAttributeString("EnableUnderlaySection", sectionFormat.EnableUnderlaySection.ToString());
            if ((ShowFormatTypes & FormatTypes.Color) == FormatTypes.Color)
                GetColorFormat(sectionFormat.BackgroundColor, writer, "BackgroundColor");

            writer.WriteEndElement();
        }
Пример #15
0
 public static bool IsTokenList(SectionFormat sectionType)
 {
     return(s_sectionTypeInfo[(int)sectionType].TokenType != TokenType.TokenTypeOther);
 }
Пример #16
0
 public SectionTypeInfo(TokenType tokenType, SectionFormat section)
 {
     TokenType   = tokenType;
     Description = section.ToString();
 }
Пример #17
0
 public static uint InitialTokenForSection(SectionFormat format)
 {
     return(((uint)format - (uint)CONSTANT.FirstTokenFlagSection) << 24);
 }
Пример #18
0
 public FileSectionProvider(uint Address, uint PartitionSize, SectionFormat Format, string FileName, string SectionDisplayName)
     : base(Address, PartitionSize, Format, SectionDisplayName)
 {
     _fileName = FileName;
 }
Пример #19
0
 public Section(string Name, SectionFormat Format)
 {
     m_TextFields = new TextFieldCollection();
     m_Name       = Name;
     m_Format     = Format;
 }