コード例 #1
0
ファイル: AppHistory.cs プロジェクト: luobolong/PlusFTP
 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
ファイル: DragWatcher.cs プロジェクト: luobolong/PlusFTP
 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
ファイル: LocalHelper.cs プロジェクト: luobolong/PlusFTP
        /*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
ファイル: DragWatcher.cs プロジェクト: luobolong/PlusFTP
        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);
        }