private void automaticAddButtonClicked(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(automaticAddTextBox.Text)) { MessageBox.Show("Please enter a directory.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (Settings.WatchedDirectories.Any(w => w.Path == automaticAddTextBox.Text)) { MessageBox.Show("This directory has already been added.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } var watch = new WatchedDirectory(); watch.Path = automaticAddTextBox.Text; watch.Label = (automaticLabelComboBox.SelectedItem as ComboBoxItem).Tag as TorrentLabel; Settings.WatchedDirectories = Settings.WatchedDirectories.Concat(new[] { watch }).ToArray(); automaticAddTextBox.Text = string.Empty; }
public void SetToDefaults() { // General SaveSession = true; AutoUpdate = true; PromptForSaveOnShellLinks = true; DeleteTorrentsAfterAdd = false; SeedOnlyWhenIdle = false; // Downloads DefaultDownloadLocation = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"); PostCompletionDestination = string.Empty; WatchedDirectories = new WatchedDirectory[0]; // Connection IncomingPort = 22239; UseRandomPort = false; MapWithUPnP = false; MaxUploadSpeed = 0; MaxDownloadSpeed = 0; MaxConnections = 500; MaxConnectionsPerTorrent = 100; UploadSlotsPerTorrent = 4; // BitTorrent EnableDHT = true; EncryptionSettings = EncryptionTypes.RC4Header | EncryptionTypes.RC4Full; HoursToSeed = 0; TargetSeedRatio = 0; // Interface ShowTrayIcon = true; CloseToSystemTray = true; MinimizeToSystemTray = false; ShowNotificationOnCompletion = true; ConfirmExitWhenActive = true; ConfirmTorrentRemoval = true; WarnOnDangerousFiles = true; WarnWhenRunningAsAdministrator = true; StartTorrentsImmediately = true; DoubleClickSeeding = DoubleClickAction.OpenFolder; DoubleClickDownloading = DoubleClickAction.OpenFolder; // Completion TorrentCompletionCommand = string.Empty; // RSS RssFeeds = new RssFeed[0]; MinutesBetweenRssUpdates = 5; // Other RecentDownloadLocations = new string[0]; Labels = new TorrentLabel[0]; TotalBytesDownloaded = TotalBytesUploaded = 0; WindowWidth = WindowHeight = -1; Maximized = false; }