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) { } }
public static void Initialize(Action <string, string> log, string category) { DatabaseReader reader; if (File.Exists("GeoIP2-Country.mmdb")) { reader = new DatabaseReader("GeoIP2-Country.mmdb"); log(category, "Loaded GeoIP2-Country.mmdb"); } else if (File.Exists("GeoLite2-Country.mmdb")) { reader = new DatabaseReader("GeoLite2-Country.mmdb"); log(category, "Loaded GeoLite2-Country.mmdb"); } else { reader = null; } _instance = new GeoIP(reader); }