static ProxyListCruncher() { IpQuery.Open("Assets/ipdb.bin", true); IpQuery.LoadBIN(); ProxyQuery.Open("Assets/proxydb.bin", IP2Proxy.Component.IOModes.IP2PROXY_MEMORY_MAPPED); workerThreads = new Thread[Environment.ProcessorCount]; for (int i = 0; i < workerThreads.Length; i++) { workerThreads[i] = new Thread(WorkLoop); workerThreads[i].Start(); } }
void LoadIp2l(string binFile) { IP2Location.Component ip2l; if (binFile == "" || binFile == null) { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = "IP2L Database files (*.BIN)|*.BIN|All files (*.*)|*.*"; openFileDialog.FilterIndex = 1; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { binFile = openFileDialog.FileName; } } } if (binFile != "" && binFile != null) { ip2l = new IP2Location.Component(); ip2l.UseMemoryMappedFile = true; ip2l.IPDatabasePath = binFile; if (ip2l.LoadBIN()) { this.ip2l = ip2l; textBox1.Text = binFile; Properties.Settings.Default.DbFile = binFile; Properties.Settings.Default.Save(); } else { MessageBox.Show("Não foi possível abrir o arquivo do banco de dados", "Falha", MessageBoxButtons.OK, MessageBoxIcon.Error); Properties.Settings.Default.DbFile = ""; Properties.Settings.Default.Save(); } } WarnIp2lNotLoadeded(); }