// Token: 0x06001148 RID: 4424 RVA: 0x00046B80 File Offset: 0x00044D80 private EseDatabasePatchFileIO(string edbFilePath, EseDatabasePatchState header, bool readOnly, bool skipIO) { this.m_fReadOnly = readOnly; this.m_fSkipIO = skipIO; this.m_header = header; this.m_patchFileNameInProgress = edbFilePath + ".patch-progress"; this.m_patchFileNameDone = edbFilePath + ".patch-done"; if (!skipIO) { if (this.m_fReadOnly) { EseDatabasePatchFileIO.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EseDatabasePatchFileIO: Opening the completed patch file in read-only mode: {0}", this.m_patchFileNameDone); this.m_fileStream = File.OpenRead(this.m_patchFileNameDone); return; } if (File.Exists(this.m_patchFileNameDone)) { EseDatabasePatchFileIO.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EseDatabasePatchFileIO: Re-opening the completed patch file in write-mode: {0}", this.m_patchFileNameDone); this.m_fileStream = File.Open(this.m_patchFileNameDone, FileMode.Open, FileAccess.ReadWrite, FileShare.None); return; } if (File.Exists(this.m_patchFileNameInProgress)) { EseDatabasePatchFileIO.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EseDatabasePatchFileIO: Re-opening the in-progress patch file in write-mode: {0}", this.m_patchFileNameInProgress); this.m_fileStream = File.Open(this.m_patchFileNameInProgress, FileMode.Open, FileAccess.ReadWrite, FileShare.None); return; } EseDatabasePatchFileIO.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EseDatabasePatchFileIO: Creating the in-progress patch file: {0}", this.m_patchFileNameInProgress); this.m_fileStream = File.Open(this.m_patchFileNameInProgress, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); } }
// Token: 0x0600113B RID: 4411 RVA: 0x000465D4 File Offset: 0x000447D4 public static EseDatabasePatchFileIO OpenWrite(string edbFilePath, EseDatabasePatchState header) { if (header == null) { throw new ArgumentNullException("header"); } return(new EseDatabasePatchFileIO(edbFilePath, header, false, false)); }
// Token: 0x06001142 RID: 4418 RVA: 0x000466F8 File Offset: 0x000448F8 public EseDatabasePatchState ReadHeader() { this.AssertReadOperationValid(); EseDatabasePatchState eseDatabasePatchState = null; this.SeekToStart(); byte[] array = new byte[32768L]; this.ReadFromFile(array, array.Length); int num = 0; int num2 = BitConverter.ToInt32(array, num); num += 4; if (num2 > array.Length - 4 || num2 <= 0) { EseDatabasePatchFileIO.Tracer.TraceError <int, int>((long)this.GetHashCode(), "ReadHeader(): Serialized header state in bytes ({0}) is invalid. Must be >=0 and < pre-allocated fixed byte size of {1} bytes.", num2, array.Length); throw new PagePatchInvalidFileException(this.m_fileStream.Name); } byte[] array2 = new byte[num2]; Array.Copy(array, num, array2, 0, num2); Exception ex = null; try { eseDatabasePatchState = SerializationServices.Deserialize <EseDatabasePatchState>(array2); } catch (SerializationException ex2) { ex = ex2; } catch (TargetInvocationException ex3) { ex = ex3; } catch (DecoderFallbackException ex4) { ex = ex4; } if (ex != null) { EseDatabasePatchFileIO.Tracer.TraceError <Exception>((long)this.GetHashCode(), "ReadHeader deserialize failed: {0}", ex); throw new PagePatchInvalidFileException(this.m_fileStream.Name, ex); } this.m_header = eseDatabasePatchState; return(eseDatabasePatchState); }