示例#1
0
 internal static async Task Delete()
 {
     await Task.Run(async delegate
     {
         FileHelper.Delete(FilePath);
         bool exists = true;
         int t       = 0;
         while (exists && (t < 10))
         {
             await Task.Delay(1000);
             exists = !FileHelper.Delete(FilePath);
             t++;
         }
     });
 }
示例#2
0
 private static void deleteSource(string path)
 {
     Task.Run(async delegate
     {
         FileHelper.Delete(path);
         bool exists = true;
         int t       = 0;
         while (exists && (t < 10))
         {
             await Task.Delay(200);
             exists = !FileHelper.Delete(path);
             t++;
         }
     });
 }
示例#3
0
        /*internal static string Up(string path)
         * {
         *  if (!path.NullEmpty())
         *  {
         *      if (path == myPC) return Home;
         *
         *      try { return (new DirectoryInfo(path).Parent).FullName; }
         *      catch (Exception exp) { ExceptionHelper.Log(exp); }
         *  }
         *
         *  return string.Empty;
         * }*/

        internal static async void Delete(SmartItem[] items)
        {
            await Task.Run(() =>
            {
                for (int i = 0; i < items.Length; i++)
                {
                    if (items[i].IsFile)
                    {
                        FileHelper.Delete(items[i].FullName, true);
                    }
                    else
                    {
                        DirectoryHelper.Delete(items[i].FullName);
                    }
                }
            });
        }
示例#4
0
        internal static bool Start()
        {
            if (lastPath != null)
            {
                FileHelper.Delete(lastPath + @"\" + Source);
            }

            if (hasTmpFile() && canWatch())
            {
                for (int i = 0; i < watchList.Count; i++)
                {
                    watchList[i].EnableRaisingEvents = true;
                }
                return(true);
            }

            return(false);
        }