Example #1
0
		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);
		}
Example #2
0
        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);
        }
Example #3
0
        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) {
            }
        }
Example #4
0
		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) {
			}
		}