private void RegistryIslemleri() { string sistemkey = license.CPUSeriNo() + license.HDDserino(); Registry.CurrentUser.CreateSubKey("PWR"); RegistryKey PtsReg = Registry.CurrentUser.OpenSubKey("PWR", true); try { key = PtsReg.GetValue("key").ToString(); } catch (Exception e) { } try { //baglanti = PtsReg.GetValue("sql").ToString(); } catch (Exception e) { } if (string.IsNullOrEmpty(key)) { try { PtsReg.SetValue("key", "1"); } catch (Exception e) { } DialogResult dr = MessageBox.Show("Lisans Hatası", "Lisans", MessageBoxButtons.OK, MessageBoxIcon.Error); if (dr == DialogResult.OK) { Environment.Exit(0); } } else { if (sistemkey != key) { DialogResult dr = MessageBox.Show("Lisans Hatası", "Lisans", MessageBoxButtons.OK, MessageBoxIcon.Error); if (dr == DialogResult.OK) { Environment.Exit(0); } } } if (string.IsNullOrEmpty(baglanti)) { //try { PtsReg.SetValue("sql", "Data Source=.; Initial Catalog=BrowserTakip; User Id=sa; Password=Recep123"); } catch (Exception e) { } } db = new BrowserContext(baglanti); }
private void timer1_Tick(object sender, EventArgs e) { labelsaat.Text = DateTime.Now.ToString("HH:mm"); labeltarih.Text = DateTime.Now.ToString("dd-MM-yyyy"); Process[] AllProcesses = Process.GetProcesses(); foreach (var process in AllProcesses) { if (process.MainWindowTitle != "") { string s = process.ProcessName.ToLower(); if (s == "opera" || s == "firefox" || s == "iexplore" || s == "microsoftedgecp") { process.Kill(); } } } if (user == null) { OturumuKapat(); return; } try { if (!InternetKontrol()) { OturumuKapat(); MessageBox.Show("Lütfen Öncelikle İnternet Bağlantınızı Kontrol Ediniz...", "İnternete Bağlı Değilsiniz"); return; } using (var bdb = new BrowserContext(baglanti)) { User kullanici = bdb.UserSet.FirstOrDefault(u => u.username == user.username); if (kullanici.Izin == 0) { richTextBox1.Clear(); kullanici.Durum = 0; bdb.SaveChanges(); OturumuKapat(); return; } kullanici.SonGuncelleme = DateTime.Now; kullanici.Durum = 1; foreach (Process process in Process.GetProcessesByName("chrome")) { string url = GetChromeUrl(process); //string url = urlal(); if (string.IsNullOrEmpty(url)) { continue; } if (url == sonurl) { continue; } if (sonurl.Contains(url)) { continue; } //if (!url.Contains("http") || !url.Contains("https")) continue; richTextBox1.Text += (url) + "\n"; sonurl = url; bdb.BrowserLogSet.Add(new BrowserLog() { UserId = kullanici.UserId, User = kullanici, Adres = url, Tarih = DateTime.Now }); } bdb.SaveChanges(); } } catch (Exception) { } try { using (var bdb = new BrowserContext(baglanti)) { User kullanici = bdb.UserSet.FirstOrDefault(u => u.username == user.username); TimeSpan ts = DateTime.Now.Subtract(kullanici.SonGuncelleme); if (ts.TotalSeconds > 30 && ts.TotalMinutes < 10) { using (var bdb2 = new BrowserContext(baglanti)) { if (user == null) { OturumuKapat(); return; } User kullanici2 = bdb2.UserSet.FirstOrDefault(u => u.username == user.username); kullanici2.Durum = 0; bdb2.SaveChanges(); OturumuKapat(); } } } } catch (Exception) { } }