public static void removeSettings()
        {
            DirectoryInfo directory = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.doombfa");

            if (directory.Exists)
            {
                FileRemover.deleteFiles("profile.bin", directory);
                FileRemover.deleteFiles("DBFAConfig.cfg", directory);
            }
        }
示例#2
0
        public void RemoveOnlyFileWithGivenId()
        {
            imageRemover = new FileRemover();
            File.Create(testPath + "0.png").Close();
            File.Create(testPath + "1.png").Close();

            imageRemover.RemoveImage("0", testPath, ".png");

            Assert.True(!File.Exists(testPath + "0.png"));
            Assert.True(File.Exists(testPath + "1.png"));

            File.Delete(testPath + "1.png");
        }
示例#3
0
        public void DeleteFiles_fakeFileNamesListAndDirPath_createErrorFile()
        {
            FileRemover fileRemover = new FileRemover();

            fileRemover.DeleteFiles(fakeFilesList, dirPath);
            string[] errStr = File.ReadAllLines(Path.Combine(dirPath, "error.log"));

            Assert.Multiple(() =>
            {
                FileAssert.Exists(Path.Combine(dirPath, "error.log"));
                CollectionAssert.AreEqual(errStr, errorStr);
            });
        }
        public static void removeSettings()
        {
            int res = SHGetKnownFolderPath(new Guid("4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4"), 0x8000 | 0x0800, new IntPtr(0), out IntPtr outPath);

            if (res >= 0)
            {
                string        path      = Marshal.PtrToStringUni(outPath);
                DirectoryInfo directory = new DirectoryInfo(path + "/id Software/DOOM BFA");
                if (directory.Exists)
                {
                    FileRemover.deleteFiles("profile.bin", directory);
                    FileRemover.deleteFiles("DBFAConfig.cfg", directory);
                }
            }
        }
示例#5
0
 private void Remove_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         var result = searchResultListbox.SelectedItems[0];
         if (result != null)
         {
             FileRemover.Remove((result as CodeSearchResult).ProgramElement.FullFilePath, RemoverCompleted);
         }
     }
     catch (ArgumentException aex)
     {
         LogEvents.UIGenericError(this, aex);
     }
 }
示例#6
0
        public void DeleteFiles_fileNamesListAndDirPath_filesDeletedAndReturnSize()
        {
            FileRemover fileRemover = new FileRemover();

            long fSize = fileRemover.DeleteFiles(delFiles, dirPath);

            Assert.Multiple(() =>
            {
                FileAssert.DoesNotExist(Path.Combine(dirPath, file1));
                FileAssert.DoesNotExist(Path.Combine(dirPath, file2));
                FileAssert.DoesNotExist(Path.Combine(dirPath, file3));

                Assert.GreaterOrEqual(fSize, 0);
            });
        }
        /// <summary>
        /// synchronise podcast media files
        /// </summary>
        /// <param name="controlFile">control file to use to control the process</param>
        /// <param name="whatIf">true to generate the status messages but not to actually perform the file copy / deletes</param>
        public void Synchronize(IReadOnlyControlFile controlFile, bool whatIf)
        {
            var filesToCopy = new List <FileSyncItem>();

            foreach (PodcastInfo podcast in controlFile.GetPodcasts())
            {
                string podcastSourcePath      = Path.Combine(controlFile.GetSourceRoot(), podcast.Folder);
                string podcastDestinationPath = Path.Combine(controlFile.GetDestinationRoot(), podcast.Folder);

                IList <IFileInfo> podcastSourceFiles = FileFinder.GetFiles(
                    podcastSourcePath,
                    podcast.Pattern.Value,
                    podcast.MaximumNumberOfFiles.Value,
                    podcast.SortField.Value,
                    podcast.AscendingSort.Value);

                FileRemover.RemoveUnwantedFiles(podcastSourceFiles, podcastDestinationPath, podcast.Pattern.Value, whatIf);

                IEnumerable <FileSyncItem> podcastSyncItems = podcastSourceFiles.Select(p => new FileSyncItem {
                    Source = p
                });

                filesToCopy.AddRange(podcastSyncItems);
            }

            FileCopier.CopyFilesToTarget(
                filesToCopy,
                controlFile.GetSourceRoot(),
                controlFile.GetDestinationRoot(),
                controlFile.GetFreeSpaceToLeaveOnDestination(),
                whatIf);

            foreach (PodcastInfo podcast in controlFile.GetPodcasts())
            {
                if (podcast.DeleteEmptyFolder.Value)
                {
                    string podcastDestinationPath = Path.Combine(controlFile.GetDestinationRoot(), podcast.Folder);
                    FolderRemover.RemoveFolderIfEmpty(podcastDestinationPath, whatIf);
                }
            }
        }
 public void ItShouldSubscribeToFileRemoverStatusUpdate()
 {
     FileRemover.AssertWasCalled(c => c.StatusUpdate += PodcastSynchronizerStatusUpdate);
 }
示例#9
0
 protected override void When()
 {
     FileRemover.RemoveUnwantedFiles(FilesToKeep, @"c:\x\y\z", "*.mp3", false);
 }
        public void ItShouldRemoveUnwantedFilesFromEachPodcastDestination()
        {
            FileRemover.AssertWasCalled(r => r.RemoveUnwantedFiles(PodcastFiles1, @"k:\podcasts\pod1", "*.mp3", false));

            FileRemover.AssertWasCalled(r => r.RemoveUnwantedFiles(PodcastFiles2, @"k:\podcasts\AnotherPodcast", "*.wma", false));
        }
示例#11
0
 public FileRemoverTests()
 {
     imageRemover = new FileRemover();
     Directory.CreateDirectory(testPath);
 }
示例#12
0
 protected override void When()
 {
     FileRemover.RemoveUnwantedFiles(FilesToKeep, @"c:\blah", "*.wma", false);
 }