Exemplo n.º 1
0
        // Token: 0x06000960 RID: 2400 RVA: 0x0002C2D8 File Offset: 0x0002A4D8
        public static EseLogRecordPosition GetLastLogRecordPosition(EseLogRecord[] records)
        {
            EseLogRecordPosition eseLogRecordPosition = null;

            if (records.Length > 0)
            {
                int logSectorSize = 0;
                EseLogHeaderRecord eseLogHeaderRecord = records[0] as EseLogHeaderRecord;
                if (eseLogHeaderRecord != null)
                {
                    logSectorSize = eseLogHeaderRecord.SectorSize;
                }
                logSectorSize        = EseLogPos.CheckSectorSize(logSectorSize);
                eseLogRecordPosition = new EseLogRecordPosition();
                eseLogRecordPosition.LogSectorSize = logSectorSize;
                for (int i = records.Length - 1; i >= 1; i--)
                {
                    if (records[i].LogPos != null)
                    {
                        eseLogRecordPosition.LogPos          = records[i].LogPos;
                        eseLogRecordPosition.LogRecordLength = records[i].LogRecSize;
                        break;
                    }
                }
            }
            return(eseLogRecordPosition);
        }
Exemplo n.º 2
0
        // Token: 0x0600097A RID: 2426 RVA: 0x0002C978 File Offset: 0x0002AB78
        private static void InternalTestParseLogfileDump()
        {
            ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "EseHelper.InternalTestParseLogfileDump");
            string value = string.Concat(new string[]
            {
                "LHGI, Create time:12/14/2005 15:30:42 Rand:9483281 Computer:, 00004B9E, 01/23/2006 09:09:02, 01/23/2006 09:06:33, 7.3704.8, 0x0",
                Environment.NewLine,
                "LHGI, Create time:01/28/2006 16:32:56 Rand:277109190 Computer:, 00000001, 01/28/2006 16:32:56, 00/00/1900 00:00:00, 7.3704.8, 0x1",
                Environment.NewLine,
                "LHAI, 1, D:\\StoreA\\MDB1\\priv1.edb",
                Environment.NewLine,
                "LRDI, 0000000075CBABC3, CreateDB , 1, C:\\temp3\\bar.edb",
                Environment.NewLine,
                "LRDI, 0000000075FBABC3, AttachDB , 2, bar.edb",
                Environment.NewLine,
                "LRDI, 0047000075CBABC3, DetachDB , 6, Z:\\temp3\\database files\\bar.edb",
                Environment.NewLine,
                "LRCI, 514F9292BBAD5F0A",
                Environment.NewLine,
                "LRPI, 00000000EF1FB879, Insert   , 005FE92F, 0000036E, 00000001, FFFFFFFFFFFFFFFF, 0000000008DCDFD0",
                Environment.NewLine,
                "LRMI, 00000000D01F91B3, McroComit",
                Environment.NewLine,
                "LRMI, 00000000D01F91B3, McroComit",
                Environment.NewLine,
                "LTEL",
                Environment.NewLine,
                string.Empty
            });
            string text = EseHelper.CreateTemporaryFile(Path.GetTempPath());

            DiagCore.RetailAssert(File.Exists(text), "Temporary file {0} doesn't exist.", new object[]
            {
                text
            });
            using (StreamWriter streamWriter = new StreamWriter(text, false, Encoding.Unicode))
            {
                streamWriter.Write(value);
            }
            EseLogRecord[] array = EseHelper.ParseLogfileDump(text);
            DiagCore.RetailAssert(!File.Exists(text), "File {0} should have been deleted.", new object[]
            {
                text
            });
            foreach (EseLogRecord eseLogRecord in array)
            {
                string value2 = eseLogRecord.ToString();
                DiagCore.RetailAssert(!string.IsNullOrEmpty(value2), "Empty string returned from EseLogRecord.ToString().", new object[0]);
            }
            int num = 0;
            EseLogHeaderRecord eseLogHeaderRecord = array[num++] as EseLogHeaderRecord;

            DiagCore.RetailAssert(eseLogHeaderRecord.Signature == "Create time:12/14/2005 15:30:42 Rand:9483281 Computer:", "EseLogHeaderRecord.Signature not correct.", new object[0]);
            DiagCore.RetailAssert(eseLogHeaderRecord.Generation == 19358L, "EseLogHeaderRecord.Generation not correct.", new object[0]);
            DateTime value3 = new DateTime(2006, 1, 23, 9, 9, 2);

            DiagCore.RetailAssert(eseLogHeaderRecord.CreationTime.Equals(value3), "EseLogHeaderRecord.CreationTime not correct.", new object[0]);
            value3 = new DateTime(2006, 1, 23, 9, 6, 33);
            DiagCore.RetailAssert(eseLogHeaderRecord.PreviousGenerationCreationTime.Equals(value3), "EseLogHeaderRecord.PreviousGenerationCreationTime not correct.", new object[0]);
            DiagCore.RetailAssert(eseLogHeaderRecord.LogFormatVersion == "7.3704.8", "EseLogHeaderRecord.LogFormatVersion not correct.", new object[0]);
            DiagCore.RetailAssert(!eseLogHeaderRecord.IsCircularLoggingOn, "EseLogHeaderRecord.IsCircularLoggingOn not correct.", new object[0]);
            eseLogHeaderRecord = (array[num++] as EseLogHeaderRecord);
            DiagCore.RetailAssert(eseLogHeaderRecord.PreviousGenerationCreationTime.Equals(DateTime.MinValue), "EseLogHeaderRecord.PreviousGenerationCreationTime not correct.", new object[0]);
            DiagCore.RetailAssert(eseLogHeaderRecord.IsCircularLoggingOn, "EseLogHeaderRecord.IsCircularLoggingOn not correct.", new object[0]);
            EseAttachInfoRecord eseAttachInfoRecord = array[num++] as EseAttachInfoRecord;

            DiagCore.RetailAssert(eseAttachInfoRecord.DatabaseId == 1, "EseAttachInfoRecord.DatabaseId not correct.", new object[0]);
            DiagCore.RetailAssert(eseAttachInfoRecord.Database == "D:\\StoreA\\MDB1\\priv1.edb", "EseAttachInfoRecord.Database not correct.", new object[0]);
            EseDatabaseFileRecord eseDatabaseFileRecord = array[num++] as EseDatabaseFileRecord;

            DiagCore.RetailAssert(eseDatabaseFileRecord.Checksum == 1976282051UL, "EseDatabaseFileRecord.Checksum not correct.", new object[0]);
            DiagCore.RetailAssert(eseDatabaseFileRecord.DatabaseId == 1, "EseDatabaseFileRecord.DatabaseId not correct.", new object[0]);
            DiagCore.RetailAssert(eseDatabaseFileRecord.Database == "C:\\temp3\\bar.edb", "EseDatabaseFileRecord.Database not correct.", new object[0]);
            DiagCore.RetailAssert(eseDatabaseFileRecord.Operation == DatabaseOperation.Create, "EseDatabaseFileRecord.Operation not correct.", new object[0]);
            eseDatabaseFileRecord = (array[num++] as EseDatabaseFileRecord);
            DiagCore.RetailAssert(eseDatabaseFileRecord.Operation == DatabaseOperation.Attach, "EseDatabaseFileRecord.Operation not correct.", new object[0]);
            eseDatabaseFileRecord = (array[num++] as EseDatabaseFileRecord);
            DiagCore.RetailAssert(eseDatabaseFileRecord.Operation == DatabaseOperation.Detach, "EseDatabaseFileRecord.Operation not correct.", new object[0]);
            DiagCore.RetailAssert(eseDatabaseFileRecord.Database == "Z:\\temp3\\database files\\bar.edb", "EseDatabaseFileRecord.Database not correct.", new object[0]);
            EseChecksumRecord eseChecksumRecord = array[num++] as EseChecksumRecord;

            DiagCore.RetailAssert(eseChecksumRecord.Checksum == 5859062799143886602UL, "EseChecksumRecord.Checksum not correct.", new object[0]);
            EsePageRecord esePageRecord = array[num++] as EsePageRecord;

            DiagCore.RetailAssert(esePageRecord.Checksum == (ulong)-283133831, "EsePageRecord.Checksum not correct.", new object[0]);
            DiagCore.RetailAssert(esePageRecord.Operation == "Insert", "EsePageRecord.Operation not correct.", new object[0]);
            DiagCore.RetailAssert(esePageRecord.PageNumber == 6285615L, "EsePageRecord.PageNumber not correct.", new object[0]);
            DiagCore.RetailAssert(esePageRecord.ObjectId == 878L, "EsePageRecord.ObjectId not correct.", new object[0]);
            DiagCore.RetailAssert(esePageRecord.DatabaseId == 1L, "EsePageRecord.DatabaseId not correct.", new object[0]);
            DiagCore.RetailAssert(esePageRecord.DbtimeBefore == ulong.MaxValue, "EsePageRecord.DbtimeBefore not correct.", new object[0]);
            DiagCore.RetailAssert(esePageRecord.DbtimeAfter == 148692944UL, "EsePageRecord.DbtimeAfter not correct.", new object[0]);
            EseMiscRecord eseMiscRecord = array[num++] as EseMiscRecord;

            DiagCore.RetailAssert(eseMiscRecord.Checksum == (ulong)-803237453, "EseMiscRecord.Checksum not correct.", new object[0]);
            DiagCore.RetailAssert(eseMiscRecord.Operation == "McroComit", "EseMiscRecord.Operation not correct.", new object[0]);
            DiagCore.RetailAssert(array[num].ToString() == array[num - 1].ToString(), "Records not equal.", new object[0]);
            DiagCore.RetailAssert(array[num].ToString() != array[num - 2].ToString(), "Records equal.", new object[0]);
            EseLogRecord eseLogRecord2 = array[num++];
        }