protected virtual void Dispose(bool disoposing) { if (disoposing) { if (_currentContent != null) { _currentContent = null; } } }
public FileLogger(string name, Func <string, LogLevel, bool> filter, string folder = null, int backlogBytesSize = 20 * 1024) : base(name, filter) { string currentFolder = SchubertUtility.GetApplicationDirectory(); if (folder.IsNullOrWhiteSpace()) { _folderName = currentFolder; } else { if (Path.IsPathRooted(folder)) { _folderName = folder; } else { string dir = String.Concat(currentFolder.TrimEnd('\\', '/'), "/"); _folderName = new Uri(new Uri(dir), folder).LocalPath; } } if (!Directory.Exists(_folderName)) { lock (_lock) { if (!Directory.Exists(_folderName)) { Directory.CreateDirectory(_folderName); } } } BlockingContent content = null; _currentContent = _blockingContents.GetOrAdd(_folderName.ToLower(), k => (content = new BlockingContent(_folderName, backlogBytesSize))); if (content != null) { if (!Object.ReferenceEquals(_currentContent, content)) { content.Dispose(); } else { content.Run(); } } }