public override void Write(char value) { base.Write(value); RollingLogStreamWriter.TallyKeepingFileStreamWriter byteCount = this; long num = byteCount.tally; System.Text.Encoding encoding = this.Encoding; char[] chrArray = new char[] { value }; byteCount.tally = num + (long)encoding.GetByteCount(chrArray); }
private void Dispose(bool disposing) { try { if (disposing && this.writer != null) { this.writer.Close(); } } finally { this.writer = null; } }
private void UpdateRollingInformationIfNecessary() { string str; string str1; if (this.writer == null) { this.ComputeCurrentFileAndNextFile(out str, out str1); if (str == null || (new FileInfo(str)).Length > this.owner.maxFileSize) { str = str1; } bool exists = (new FileInfo(str)).Exists; FileStream fileStream = new FileStream(str, FileMode.Append, FileAccess.Write, FileShare.Read, this.owner.bufferSize, FileOptions.SequentialScan); this.writer = new RollingLogStreamWriter.TallyKeepingFileStreamWriter(fileStream, RollingLogStreamWriter.StreamWriterRollingHelper.GetEncodingWithFallback(), this.owner.bufferSize); if (exists) { this.writer.Tally = (new FileInfo(str)).Length; } } }
private void PerformRoll() { this.writer.Close(); this.writer = null; this.UpdateRollingInformationIfNecessary(); }