Esempio n. 1
0
        /// <summary>
        /// The Button_Click_DelOldFolder
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/></param>
        /// <param name="e">The e<see cref="RoutedEventArgs"/></param>
        private void Button_Click_DelOldFolder(object sender, RoutedEventArgs e)
        {
            using (WinForms.FolderBrowserDialog dlg = new WinForms.FolderBrowserDialog()) {
                string path = null;
                if (dlg.ShowDialog() == WinForms.DialogResult.OK)
                {
                    path = dlg.SelectedPath + @"\";

                    var sk  = new DeleteOldFiles();
                    int day = -1;
                    try {
                        day = Convert.ToInt32(FOldDayTextBox.Text);
                        if (day <= 0 || day >= 1000)
                        {
                            throw new Exception("Not valid days");
                        }
                        sk.Delete(day, path);
                    }
                    catch (Exception) {
                        MessageBox.Show("Not valid days", "Error",
                                        MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Drag and drop in old file folder
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Border_Drop_1(object sender, DragEventArgs e)
 {
     string[] Args = (string[])e.Data.GetData(DataFormats.FileDrop, true);
     DropOldFiles.Visibility = Visibility.Collapsed;
     foreach (var path in Args)
     {
         if (System.IO.Directory.Exists(path))
         {
             var sk  = new DeleteOldFiles();
             int day = -1;
             try {
                 day = Convert.ToInt32(FOldDayTextBox.Text);
                 if (day <= 0 || day >= 1000)
                 {
                     throw new Exception("Not valid days");
                 }
                 sk.Delete(day, path);
             }
             catch (Exception) {
                 MessageBox.Show("Not valid days", "Error",
                                 MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }
 }
Esempio n. 3
0
        internal override HttpContent GenerateRequestBody()
        {
            var form = new MultipartFormDataContent();

            if (Title != null)
            {
                form.Add(new StringContent(Title), "title");
            }

            if (RssSourceUrl != null)
            {
                form.Add(new StringContent(RssSourceUrl), "rss_source_url");
            }

            if (ParentDirectoryId != null)
            {
                form.Add(new StringContent(ParentDirectoryId.Value.ToString()), "parent_dir_id");
            }

            if (DeleteOldFiles != null)
            {
                form.Add(new StringContent(DeleteOldFiles.ToString()), "delete_old_files");
            }

            if (DontProcessWholeFeed != null)
            {
                form.Add(new StringContent(DontProcessWholeFeed.ToString()), "dont_process_whole_feed");
            }

            if (Keywords.Any())
            {
                form.Add(new StringContent(string.Join(",", Keywords)), "keyword");
            }

            if (UnwantedKeywords.Any())
            {
                form.Add(new StringContent(string.Join(",", UnwantedKeywords)), "unwanted_keywords");
            }

            if (Paused != null)
            {
                form.Add(new StringContent(Paused.ToString()), "paused");
            }

            return(form);
        }
Esempio n. 4
0
        /// <summary>
        /// Download delete old files btn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_DownloadDelOld(object sender, RoutedEventArgs e)
        {
            var dk  = new DeleteOldFiles();
            int day = -1;

            try {
                day = Convert.ToInt32(OldDayTextBox.Text);
                if (day <= 0 || day >= 1000)
                {
                    throw new Exception("Not valid days");
                }
                dk.Delete(day, KnownFolders.GetPath(KnownFolder.Downloads));
            }
            catch (Exception) {
                MessageBox.Show("Not valid days", "Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            Console.WriteLine("please enter the path that you wish to copy");
            string sourcePath = Console.ReadLine();

            Console.WriteLine("now enter the destination you wish to copy it to");
            string destinationPath = Console.ReadLine();

            //Get directory info for both paths

            var sourceInfo      = new DirectoryInfo(sourcePath);
            var destinationInfo = new DirectoryInfo(destinationPath);

            CopyFiles.CopyDirectory(sourceInfo, destinationInfo);

            Console.WriteLine("Type 'D' if you want the source files deleted");

            //Delete already copied files if user proceeds
            if (Console.ReadKey().Key == ConsoleKey.D)
            {
                DeleteOldFiles.Delete(sourceInfo);
            }
        }