public void TestGlobalProcess_IsDay() { Assert.IsTrue(GlobalProcess.IsDay("31")); Assert.IsFalse(GlobalProcess.IsDay("2016")); Assert.IsFalse(GlobalProcess.IsDay("1A")); Assert.IsFalse(GlobalProcess.IsDay("32")); Assert.IsTrue(GlobalProcess.IsDay("01")); Assert.IsFalse(GlobalProcess.IsDay("00")); }
/// <summary> /// 获取指定目录所有视频节点中的时间最早的子目录的名称(包括其路径)。 /// </summary> /// <param name="folder">目录文件夹</param> /// <returns>目录文件夹下最早的视频子文件夹</returns> public static HistoryFolderInfo SearchEarliestSubfolder(string videoInfoPath) { try { string path = videoInfoPath; string pathYear = Directory.GetDirectories(path).Where(_ => GlobalProcess.IsYear(getFolderName(_))).Min(); int nYear = int.Parse(getFolderName(pathYear)); string pathMonth = Directory.GetDirectories(pathYear).Where(_ => GlobalProcess.IsMonth(getFolderName(_))).Min(); int nMonth = int.Parse(getFolderName(pathMonth)); string pathDay = Directory.GetDirectories(pathMonth).Where(_ => GlobalProcess.IsDay(getFolderName(_))).Min(); int nDay = int.Parse(getFolderName(pathDay)); return(new HistoryFolderInfo(pathDay, new DateTime(nYear, nMonth, nDay))); } catch { } return(null); }