public void TestFolderManager_InvalidPath()
        {
            Assert.IsFalse(FolderManager.ClearDirectoryInfoAll("i:\\"));
            Assert.IsFalse(FolderManager.ClearDirectoryInfoAll("abc"));
            string path = @"D:\视频录像\invalid position";

            Assert.IsFalse(FolderManager.DeleteDirectoryInfo(path));
            Assert.IsFalse(FolderManager.ClearDirectoryInfoAll(path));
        }
Example #2
0
        ///<summary>删除最早的历史录像数据</summary>
        public static void DeleteEarliestVideo()
        {
            HistoryFolderArrayInfo earliestFolders = SearchEarliestSubfolders();

            if (earliestFolders != null)
            {
                Logger.Default.Trace($"删除 {earliestFolders.Time.ToShortDateString()} 视频!");
                Parallel.ForEach(earliestFolders.Paths, folder =>
                {
                    FolderManager.ClearDirectoryInfoAll(folder);
                });
            }
        }
        public void TestFolderManager_ClearDirectoryInfoAll()
        {
            string path = @"i:\视频录像\videoID_003_2\2003\03\22";

            Assert.IsFalse(Directory.Exists(@"i:\视频录像"));
            Directory.CreateDirectory(path);
            string filePath = Path.Combine(path, ".error");

            using (FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
            {
                Assert.IsFalse(FolderManager.ClearDirectoryInfoAll(path));
                Assert.IsTrue(Directory.Exists(path));
            }
            Assert.IsTrue(FolderManager.ClearDirectoryInfoAll(path));
            Assert.IsFalse(Directory.Exists(@"i:\视频录像"));
        }
Example #4
0
 public void Delete()
 {
     onStatus(DownloadStatus.Deleted);
     stopDownload();
     FolderManager.ClearDirectoryInfoAll(Path);
 }