Пример #1
0
 public void TestMethod1()
 {
     string outputDirectory = @"C:\temp\sb01output";
     if (Directory.Exists(outputDirectory))
         Directory.Delete(outputDirectory, true);
     Renamer renamer = new Renamer(outputDirectory);
     renamer.Go(@"C:\temp\sb01testfiles");
 }
Пример #2
0
        public void TestFileMatch()
        {
            string outputDirectory = @"C:\temp\sb01output";
            if (Directory.Exists(outputDirectory))
                Directory.Delete(outputDirectory, true);
            Renamer renamer = new Renamer(outputDirectory);

            FileInfo fileInfo1 = new FileInfo(@"C:\test\copy1.jpg");
            FileInfo fileInfo2 = new FileInfo(@"C:\test\copy2.jpg");

            bool isMatch = renamer.IsExactMatch(fileInfo1, fileInfo2);

            Console.Write("Match? " + isMatch);
        }
Пример #3
0
        private void ButtonGo_Click(object sender, RoutedEventArgs e)
        {
            string source = TextBoxSource.Text;
            string destination = TextBoxDestination.Text;
            string archive = TextBoxArchive.Text;
            bool useYearStructure = CheckBoxUseYearStructure.IsChecked.GetValueOrDefault();
            bool onlyLarge = CheckBoxOnlyLarge.IsChecked.GetValueOrDefault();

            // save to config
            Brew.AddUpdateAppSettings("Source", source);
            Brew.AddUpdateAppSettings("Destination", destination);
            Brew.AddUpdateAppSettings("Archive", archive);
            Brew.AddUpdateAppSettings("UseYearStructure", useYearStructure.ToString());
            Brew.AddUpdateAppSettings("UseYearStructureLargeOnly", onlyLarge.ToString());

            MessageBoxResult messageBoxResult = MessageBox.Show(this, string.Format("Move and rename all media from {0} to {1}?", source, destination), "Confirm", MessageBoxButton.OKCancel);
            if (messageBoxResult == MessageBoxResult.OK)
            {
                Renamer renamer = new Renamer(destination, archive, useYearStructure);
                //renamer.Go(source);
                ButtonGo.IsEnabled = false;
                renamer.GoAsync(source, (percent, message) =>
                {
                    if (percent < 101)
                    {
                        LabelProgress.Content = message;
                        ProgressBarMain.Value = percent;
                    }
                    else
                    {
                        // complete
                        LabelProgress.Content = "Complete";
                        ProgressBarMain.Value = 100;
                        ButtonGo.IsEnabled = true;
                    }
                });
            }
        }