Beispiel #1
0
 private string VersionToString(DataFormatVersion version)
 {
     return(String.Format("'{0}' {1}.{2} {3}.{4} {5}.{6}", version.name,
                          version.readerVersion & 0xFFFF, (version.readerVersion >> 16) & 0xFFFF,
                          version.updateVersion & 0xFFFF, (version.updateVersion >> 16) & 0xFFFF,
                          version.writerVersion & 0xFFFF, (version.writerVersion >> 16) & 0xFFFF));
 }
Beispiel #2
0
        private DataFormatVersion ReadFormatVersion()
        {
            DataFormatVersion version = new DataFormatVersion();
            int strByteLength         = (int)_reader.ReadInt32();

            BinaryReader tempReader = new BinaryReader(_reader.BaseStream, System.Text.Encoding.Unicode);

            char[] chars = tempReader.ReadChars(strByteLength / 2);

            version.name          = new string(chars);
            version.readerVersion = _reader.ReadInt32();
            version.updateVersion = _reader.ReadInt32();
            version.writerVersion = _reader.ReadInt32();
            return(version);
        }
Beispiel #3
0
        public IEnumerable <String> GetLines()
        {
            DataFormatVersion version = ReadFormatVersion();

            yield return(VersionToString(version));

            while (!Done())
            {
                long       address = _reader.BaseStream.Position;
                BamlRecord record  = ReadRecord();

                if ((record.Flags & BamlRecordFlags.End) != 0)
                {
                    IndentLevel -= 1;
                }
                string indent = Indent;  // save the indent because ProcessBamlRecord() may change it.

                ProcessBamlRecord(record);

                if (record.Flags == BamlRecordFlags.Debug && !ShowDebugRecords)
                {
                    continue;
                }

                if (record.Flags == BamlRecordFlags.Table && !ShowTableRecords)
                {
                    continue;
                }

                string recNumString  = String.Format("#{0:d3}: ", _recordNumber);
                string addressString = String.Format("{0:x5}: ", address);

                string preamble = String.Empty;
                preamble += (ShowRecordNumbers) ? recNumString : String.Empty;
                preamble += (ShowAddresses) ? addressString : String.Empty;
                preamble += indent;
                yield return(preamble + RecordToString(record));
            }
        }