Esempio n. 1
0
        // Token: 0x0600095F RID: 2399 RVA: 0x0002C270 File Offset: 0x0002A470
        public static EseLogRecordPosition GetLastLogRecordPosition(string logfileName, string temporaryDirectory, out Exception ex)
        {
            EseLogRecordPosition result = null;

            ex = null;
            try
            {
                EseLogRecord[] logRecords = EseHelper.GetLogRecords(logfileName, temporaryDirectory);
                if (logRecords.Length > 0)
                {
                    result = EseHelper.GetLastLogRecordPosition(logRecords);
                }
            }
            catch (EsentErrorException ex2)
            {
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ex = ex3;
            }
            catch (UnauthorizedAccessException ex4)
            {
                ex = ex4;
            }
            return(result);
        }
Esempio n. 2
0
        // Token: 0x0600097B RID: 2427 RVA: 0x0002CFA4 File Offset: 0x0002B1A4
        private static void InternalTestParseLogfileDumpBadData()
        {
            ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "EseHelper.InternalTestParseLogfileDumpBadData");
            string value  = "LHGX, 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 + string.Empty;
            string value2 = "LRPI, 00000000EF1FB879, Insert   , 005FE92F, THIS IS BAD DATA, 0000036E, 00000001, 0000000008DCDFA0, 0000000008DCDFD0" + 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);
            }
            try
            {
                EseHelper.ParseLogfileDump(text);
                DiagCore.RetailAssert(false, "Should have thrown an EseutilParseErrorException", new object[0]);
            }
            catch (EseutilParseErrorException)
            {
            }
            DiagCore.RetailAssert(!File.Exists(text), "File {0} should have been deleted.", new object[]
            {
                text
            });
            text = EseHelper.CreateTemporaryFile(Path.GetTempPath());
            DiagCore.RetailAssert(File.Exists(text), "Temporary file {0} doesn't exist.", new object[]
            {
                text
            });
            using (StreamWriter streamWriter2 = new StreamWriter(text, false, Encoding.Unicode))
            {
                streamWriter2.Write(value2);
            }
            try
            {
                EseHelper.ParseLogfileDump(text);
                DiagCore.RetailAssert(false, "Should have thrown an EseutilParseErrorException", new object[0]);
            }
            catch (EseutilParseErrorException)
            {
            }
            DiagCore.RetailAssert(!File.Exists(text), "File {0} should have been deleted.", new object[]
            {
                text
            });
            try
            {
                EseHelper.GetLogRecords(Path.GetRandomFileName(), Path.GetTempPath());
                DiagCore.RetailAssert(false, "Should have thrown EsentErrorException.", new object[0]);
            }
            catch (EsentErrorException)
            {
            }
        }
Esempio n. 3
0
 // Token: 0x0600095E RID: 2398 RVA: 0x0002C120 File Offset: 0x0002A320
 public static bool IsLogfileEqual(string logfile1, string logfile2, string temporaryDirectory, EseLogRecordPosition lastRec1, EseLogRecordPosition lastRec2)
 {
     EseLogRecord[] logRecords  = EseHelper.GetLogRecords(logfile1, temporaryDirectory);
     EseLogRecord[] logRecords2 = EseHelper.GetLogRecords(logfile2, temporaryDirectory);
     if (lastRec1 != null)
     {
         EseLogRecordPosition lastLogRecordPosition = EseHelper.GetLastLogRecordPosition(logRecords);
         if (lastLogRecordPosition != null)
         {
             lastRec1.LogPos          = lastLogRecordPosition.LogPos;
             lastRec1.LogRecordLength = lastLogRecordPosition.LogRecordLength;
             lastRec1.LogSectorSize   = lastLogRecordPosition.LogSectorSize;
         }
     }
     if (lastRec2 != null)
     {
         EseLogRecordPosition lastLogRecordPosition2 = EseHelper.GetLastLogRecordPosition(logRecords2);
         if (lastLogRecordPosition2 != null)
         {
             lastRec2.LogPos          = lastLogRecordPosition2.LogPos;
             lastRec2.LogRecordLength = lastLogRecordPosition2.LogRecordLength;
             lastRec2.LogSectorSize   = lastLogRecordPosition2.LogSectorSize;
         }
     }
     if (logRecords2.Length != logRecords.Length)
     {
         ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileEqual({0},{1}) returns false. {0} has {2} records. {1} has {3} records.", new object[]
         {
             logfile1,
             logfile2,
             logRecords.Length,
             logRecords2.Length
         });
         return(false);
     }
     for (int i = 0; i < logRecords.Length; i++)
     {
         if (logRecords[i].ToString() != logRecords2[i].ToString())
         {
             ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileEqual({0},{1}) returns false. {0} has {2} records. {1} has {3} records. The differing log records are {4} and {5}. Differing position is {6}.", new object[]
             {
                 logfile1,
                 logfile2,
                 logRecords.Length,
                 logRecords2.Length,
                 logRecords[i],
                 logRecords2[i],
                 i
             });
             return(false);
         }
     }
     return(true);
 }
Esempio n. 4
0
 // Token: 0x0600095D RID: 2397 RVA: 0x0002BF50 File Offset: 0x0002A150
 public static bool IsLogfileSubset(string logfile1, string logfile2, string temporaryDirectory, EseLogRecordPosition lastRec1, EseLogRecordPosition lastRec2)
 {
     EseLogRecord[] logRecords  = EseHelper.GetLogRecords(logfile1, temporaryDirectory);
     EseLogRecord[] logRecords2 = EseHelper.GetLogRecords(logfile2, temporaryDirectory);
     if (lastRec1 != null)
     {
         EseLogRecordPosition lastLogRecordPosition = EseHelper.GetLastLogRecordPosition(logRecords);
         if (lastLogRecordPosition != null)
         {
             lastRec1.LogPos          = lastLogRecordPosition.LogPos;
             lastRec1.LogRecordLength = lastLogRecordPosition.LogRecordLength;
             lastRec1.LogSectorSize   = lastLogRecordPosition.LogSectorSize;
         }
     }
     if (lastRec2 != null)
     {
         EseLogRecordPosition lastLogRecordPosition2 = EseHelper.GetLastLogRecordPosition(logRecords2);
         if (lastLogRecordPosition2 != null)
         {
             lastRec2.LogPos          = lastLogRecordPosition2.LogPos;
             lastRec2.LogRecordLength = lastLogRecordPosition2.LogRecordLength;
             lastRec2.LogSectorSize   = lastLogRecordPosition2.LogSectorSize;
         }
     }
     if (logRecords2.Length > logRecords.Length)
     {
         ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileSubset({0},{1}) returns false. {0} has {2} records. {1} has {3} records.", new object[]
         {
             logfile1,
             logfile2,
             logRecords.Length,
             logRecords2.Length
         });
         return(false);
     }
     for (int i = 0; i < logRecords2.Length - 1; i++)
     {
         bool flag = true;
         if ((!(logRecords[i] is EseChecksumRecord) || !(logRecords2[i] is EseChecksumRecord)) && logRecords[i].ToString() != logRecords2[i].ToString())
         {
             flag = false;
         }
         if (!flag)
         {
             ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileSubset({0},{1}) returns false. {0} has {2} records. {1} has {3} records. The differing log records are {4} and {5}. Differing position is {6}.", new object[]
             {
                 logfile1,
                 logfile2,
                 logRecords.Length,
                 logRecords2.Length,
                 logRecords[i],
                 logRecords2[i],
                 i
             });
             return(false);
         }
     }
     if (!(logRecords2[logRecords2.Length - 1] is EseEofRecord))
     {
         ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileSubset({0},{1}) returns false. {0} has {2} records. {1} has {3} records. File {1} does not end in an EOF record. The last record is {4}.", new object[]
         {
             logfile1,
             logfile2,
             logRecords.Length,
             logRecords2.Length,
             logRecords2[logRecords2.Length - 1]
         });
         return(false);
     }
     return(true);
 }