Exemple #1
0
 public void TestGlobalProcess_IsMonth()
 {
     Assert.IsTrue(GlobalProcess.IsMonth("12"));
     Assert.IsFalse(GlobalProcess.IsMonth("2016"));
     Assert.IsFalse(GlobalProcess.IsMonth("1A"));
     Assert.IsFalse(GlobalProcess.IsMonth("13"));
     Assert.IsTrue(GlobalProcess.IsMonth("01"));
     Assert.IsFalse(GlobalProcess.IsMonth("00"));
 }
Exemple #2
0
 /// <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);
 }