protected override void OnDispose(bool disposing) { if (disposing && _reader != null) { _reader.Dispose(); } }
public void Generate() { if (ConvertToPascalCase) { textFormatter = new PascalCaseTextFormatter(); } else { textFormatter = new UnformattedTextFormatter(); } textFormatter.PrefixRemoval = connSettings.PrefixRemoval; project = new Project(Strings.Untitled); diagram = new Diagram(Strings.Untitled, CSharpLanguage.Instance); foreach (var table in tables) { CreateClass(table); } foreach (var view in views) { CreateClass(view); } ArrangeTypes(); project.Add(diagram); metadataReader.Dispose(); }
protected virtual void Dispose(bool disposing) { if (disposing) { _ipDbReader?.Dispose(); } }
private async Task <DatabaseReader> GetDatabaseAsync(CancellationToken cancellationToken) { // Try to load the new database from disk if the current one is a day old. if (_database != null && _databaseLastChecked.HasValue && _databaseLastChecked.Value < SystemClock.UtcNow.SubtractDays(1)) { _database.Dispose(); _database = null; } if (_database != null) { return(_database); } if (_databaseLastChecked.HasValue && _databaseLastChecked.Value >= SystemClock.UtcNow.SubtractSeconds(30)) { return(null); } _databaseLastChecked = SystemClock.UtcNow; if (!await _storage.ExistsAsync(GEO_IP_DATABASE_PATH).AnyContext()) { if (_logger.IsEnabled(LogLevel.Warning)) { _logger.LogWarning("No GeoIP database was found."); } return(null); } if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation("Loading GeoIP database."); } try { using (var stream = await _storage.GetFileStreamAsync(GEO_IP_DATABASE_PATH, cancellationToken).AnyContext()) _database = new DatabaseReader(stream); } catch (Exception ex) { if (_logger.IsEnabled(LogLevel.Error)) { _logger.LogError(ex, "Unable to open GeoIP database."); } } return(_database); }
private void CloseReader() { if (_reader != null) { _reader.Dispose(); _reader = null; } }
private DatabaseReader GetDatabase() { // Try to load the new database from disk if the current one is an hour old. if (_database != null && _databaseLastChecked.HasValue && _databaseLastChecked.Value < DateTime.UtcNow.SubtractHours(1)) { _database.Dispose(); _database = null; } if (_database != null) { return(_database); } if (_databaseLastChecked.HasValue && _databaseLastChecked.Value >= DateTime.UtcNow.SubtractSeconds(30)) { return(null); } _databaseLastChecked = DateTime.UtcNow; string databasePath = PathHelper.ExpandPath(Settings.Current.GeoIPDatabasePath); if (!Path.IsPathRooted(databasePath)) { databasePath = Path.GetFullPath(databasePath); } if (!File.Exists(databasePath)) { Log.Warn().Message("No GeoIP database was found \"{0}\"", databasePath).Write(); return(null); } Log.Info().Message("Loading GeoIP database from \"{0}\"", databasePath).Write(); try { _database = new DatabaseReader(databasePath, FileAccessMode.Memory); } catch (Exception ex) { Log.Error().Exception(ex).Message("Unable to open GeoIP database.").Write(); } return(_database); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_reader != null) { _reader.Dispose(); _reader = null; } } }
private async Task <DatabaseReader> GetDatabaseAsync(CancellationToken cancellationToken) { // Try to load the new database from disk if the current one is an hour old. if (_database != null && _databaseLastChecked.HasValue && _databaseLastChecked.Value < DateTime.UtcNow.SubtractHours(1)) { _database.Dispose(); _database = null; } if (_database != null) { return(_database); } if (_databaseLastChecked.HasValue && _databaseLastChecked.Value >= DateTime.UtcNow.SubtractSeconds(30)) { return(null); } _databaseLastChecked = DateTime.UtcNow; if (!await _storage.ExistsAsync(GEO_IP_DATABASE_PATH).AnyContext()) { _logger.Warn("No GeoIP database was found."); return(null); } _logger.Info("Loading GeoIP database."); try { using (var stream = await _storage.GetFileStreamAsync(GEO_IP_DATABASE_PATH, cancellationToken).AnyContext()) _database = new DatabaseReader(stream); } catch (Exception ex) { _logger.Error(ex, "Unable to open GeoIP database."); } return(_database); }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_mmCountryReader != null) { _mmCountryReader.Dispose(); } } _disposed = true; }
private void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_mmCountryReader != null) { _mmCountryReader.Dispose(); } } _disposed = true; }
protected virtual void Dispose(bool disposing) { try { if (disposing) { if (Reader != null) { Reader.Dispose(); } _instance = null; if (_instance != null) { _instance.Dispose(); _instance = null; } } } catch (Exception) { } }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); reader.Dispose(); }
public void Dispose() { _search?.Dispose(); }
public void Dispose() => reader.Dispose();
public void Dispose() { reader.Dispose(); GC.SuppressFinalize(this); }