コード例 #1
0
 /// <summary>
 /// 默认1000毫秒循环一次
 /// </summary>
 /// <param name="paths"></param>
 /// <param name="callAction"></param>
 /// <param name="millisecondsTimeout"></param>
 public static void ForEachPathsAndSleep(this IEnumerable <string> paths, Action <string> callAction, int millisecondsTimeout = 1000)
 {
     paths.Select(p => p.Replace("\\", "/")).ToList().ForEach((p, i, target) =>
     {
         System.Threading.Thread.Sleep(millisecondsTimeout);
         SystemConsole.SetProgress(p, ((float)i) / target.Count);
         callAction(p);
     });
     SystemConsole.ClearProgress();
 }
コード例 #2
0
 public static void ForEachPaths(this IEnumerable <string> paths, Action <string> callAction)
 {
     paths.Select(p => p.Replace("\\", "/").TrimStart('/')).ToList().ForEach((p, i, target) =>
     {
         SystemConsole.SetProgress(string.Format("is now : {0} {1}", (((float)i) / target.Count).ToString("p"), p));
         //Console.WriteLine("is now : " + (((float) i)/target.Count).ToString("p") + "\t" + p);
         if (File.Exists(p))
         {
             callAction(p);
         }
     });
 }