public FileZipper( IFileFinder fileFinder, DirectoryMover mover ) { Mover = mover; FileFinder = fileFinder; }
public MainWindow() { InitializeComponent(); DM = new DirectoryMover(); DM.Completed += DM_Completed; LoadSettings(); RefreshFiles(); LBDirectories.ItemsSource = DM.Directories; }
public void Initialise() { testSourceReleaseNamesFile = @"C:\Users\Dj Music\Documents\visual studio 2015\Projects\MusicMoverApp\TestFiles\TestSourceReleaseNames.txt"; testTargetReleaseNamesFile = @"C:\Users\Dj Music\Documents\visual studio 2015\Projects\MusicMoverApp\TestFiles\TestTargetReleaseNames.txt"; testSourcePath = @"C:\Users\Dj Music\Documents\visual studio 2015\Projects\MusicMoverApp\TestFiles\Source"; testTargetPath = @"C:\Users\Dj Music\Documents\visual studio 2015\Projects\MusicMoverApp\TestFiles\Target"; testDeletePath = @"C:\Users\Dj Music\Documents\visual studio 2015\Projects\MusicMoverApp\TestFiles\Delete"; testDirectoryMover = new DirectoryMover(testTargetReleaseNamesFile); // delete target directory if it exists if (Directory.Exists(testTargetPath)) { testFiles = Directory.GetFiles(testTargetPath); foreach (string testFile in testFiles) { File.SetAttributes(testFile, FileAttributes.Normal); File.Delete(testFile); } Directory.Delete(testTargetPath); } // create Delete folder if it doesnt exist if (!Directory.Exists(testDeletePath)) { Directory.CreateDirectory(testDeletePath); } // copy files to Delete folder testFiles = Directory.GetFiles(testSourcePath); foreach (string testFile in testFiles) { var testFileName = Path.GetFileName(testFile); var testCopySourceFile = Path.Combine(testSourcePath, testFileName); var testCopyDestinationFile = Path.Combine(testDeletePath, testFileName); if (!File.Exists(testCopyDestinationFile)) { File.Copy(testCopySourceFile, testCopyDestinationFile); } } // delete TestReleaseNames file if it exists if (File.Exists(testTargetReleaseNamesFile)) { File.SetAttributes(testTargetReleaseNamesFile, FileAttributes.Normal); File.Delete(testTargetReleaseNamesFile); } // create TestReleaseNames file if it does not exist if (!File.Exists(testTargetReleaseNamesFile)) { File.Copy(testSourceReleaseNamesFile, testTargetReleaseNamesFile); } }
public FileZipper() { Mover = new DirectoryMover(); FileFinder = new FileFinder(); }