private void disablereadonly_Click(object sender, RoutedEventArgs e) { skype sk = new skype(this); string oldconfig = sk.SkypePath + "\\" + cmb_users.SelectedValue + "\\config.xml"; FileInfo finfo = new FileInfo(oldconfig); if (finfo.IsReadOnly == true) finfo.IsReadOnly = false; WriteConsole("Schreibschutz entfernt."); }
public hosts(MainWindow mw) { werbung.Add("127.0.0.1 rad.msn.com"); werbung.Add("127.0.0.1 live.rads.msn.com"); werbung.Add("127.0.0.1 ads1.msn.com"); werbung.Add("127.0.0.1 static.2mdn.net"); werbung.Add("127.0.0.1 g.msn.com"); werbung.Add("127.0.0.1 a.ads2.msads.net"); werbung.Add("127.0.0.1 b.ads2.msads.net"); werbung.Add("127.0.0.1 ac3.msn.com"); sk = new skype(mw); }
/// <summary> /// Check Timer Skype Running /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dt_Tick(object sender, EventArgs e) { skype sk = new skype(this); if (sk.running() == true) { WriteConsole("Skype Prozess wurde entdeckt."); var dr = MessageBox.Show("Skype muss geschlossen sein um Änderungen vorzunehmen!\nSoll Skype geschlossen werden?", "Skype geöffnet", MessageBoxButton.YesNo, MessageBoxImage.Question); if (dr == MessageBoxResult.Yes) { Process[] proc1 = Process.GetProcesses(); foreach (Process pr in proc1) { if (pr.ProcessName == "Skype") pr.Kill(); } WriteConsole("Skype wurde geschlossen."); Thread.Sleep(1500); } else { MessageBox.Show("Skype AD Blocker wird automatisch geschlossen.","Aufwiedersehen!",MessageBoxButton.OK,MessageBoxImage.Information); Environment.Exit(0); } } }
/// <summary> /// Combox mit Usern anlegen /// </summary> private void userliste() { skype sk = new skype(this); List<string> folderpathes = Directory.EnumerateDirectories(sk.SkypePath).ToList(); List<string> users = new List<string>(); for (int i = 0; i < folderpathes.Count; i++) { if (File.Exists(folderpathes[i] + "\\config.xml")) users.Add(folderpathes[i].ToString()); } for (int i = 0; i < users.Count; i++) { string[] tmp = users[i].Split('\\'); cmb_users.Items.Add(tmp[tmp.Length-1]); } WriteConsole("Alle User geladen."); }
private void MenuItem_Click_1(object sender, RoutedEventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.Title = "Wählen Sie einen Speicherort zum exportieren!"; save.FileName = "config"; save.DefaultExt = ".xml"; save.Filter = "XML documents (.xml)|*.xml"; Nullable<bool> result = save.ShowDialog(); if (result == true) { string goalpath = save.FileName; skype sk = new skype(this); string oldpath = sk.SkypePath + "\\" + cmb_users.SelectedValue + "\\config.xml"; File.Copy(oldpath, goalpath, true); FileInfo finfo = new FileInfo(goalpath); if (finfo.IsReadOnly == true) finfo.IsReadOnly = false; WriteConsole("Config erfolgreich exportiert."); } }
private void import_Click(object sender, RoutedEventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Title = "Wählen Sie eine Config zum importieren!"; open.FileName = "config"; open.DefaultExt = ".xml"; open.Filter = "XML documents (.xml)|*.xml"; Nullable<bool> result = open.ShowDialog(); if (result == true) { string newconfig = open.FileName; skype sk = new skype(this); string oldconfig = sk.SkypePath + "\\" + cmb_users.SelectedValue + "\\config.xml"; FileInfo finfo = new FileInfo(oldconfig); if (finfo.IsReadOnly == true) finfo.IsReadOnly = false; FileInfo finfo2 = new FileInfo(newconfig); if (finfo.IsReadOnly == true) finfo.IsReadOnly = false; File.Copy(newconfig, oldconfig, true); if (finfo.IsReadOnly == false) finfo.IsReadOnly = true; WriteConsole("Config erfolgreich importiert."); } }