Exemplo n.º 1
0
        public override void RunSub(ICloneable _threadParameter)
        {
            JudgeTaskCancelFlag();
            DirectoryInfo CurrentFold = new DirectoryInfo(((DeleteFileParameter)_threadParameter).OutoutDirectoy);

            log.Log("Folder[" + CurrentFold.FullName + "]");
            foreach (FileInfo file in CurrentFold.GetFiles())
            {
                JudgeTaskCancelFlag();
                try
                {
                    JudgeTaskCancelFlag();
                    file.Delete();
                    log.Log(file.FullName + " is deleted.");
                }
                catch (Exception ex)
                {
                    log.Log(" Don't delete the file[" + file.FullName + "] error:" + ex.Message);
                }
            }
            foreach (DirectoryInfo dirinfo in CurrentFold.GetDirectories())
            {
                log.Log("Folder[" + dirinfo.FullName + "]");
                DeleteFileParameter subparam = (DeleteFileParameter)(_threadParameter.Clone());
                subparam.OutoutDirectoy = dirinfo.FullName;
                RunSub(subparam);
            }
        }
Exemplo n.º 2
0
        private async void BtnDeleteAllFiles_Click(object sender, EventArgs e)
        {
            DialogResult dr = OpenFoldDialog();

            if ((dr == DialogResult.Yes) || (dr == DialogResult.OK))
            {
                // await DeleteAllfiles(openFold.SelectedPath);
                try
                {
                    this.SetFolderButtonStatus(false);
                    StartNewTask();
                    DeleteFileParameter param = new DeleteFileParameter();
                    param.OutoutDirectoy = openFold.SelectedPath.Trim();
                    DeleteFile deleteThreading = new DeleteFile(this.log, this.tokenSource, param);
                    task = deleteThreading.Run();
                    await task;
                    //
                }
                catch (Exception ex)
                {
                    log.RecordError(ex.Message);
                    //this.SetFolderButtonStatus(true);
                }
                finally
                {
                    this.SetFolderButtonStatus(true);
                }
            }
        }
 public BaseResponse <bool> DeleteFile(DeleteFileParameter parameter)
 {
     if (Validate(parameter))
     {
         return(scoreManager.DeleteFile(parameter));
     }
     else
     {
         BaseResponse <bool> response = new BaseResponse <bool>();
         response.IsSuccessful = false;
         response.Reason       = "JWT_ERR";
         return(response);
     }
 }
Exemplo n.º 4
0
        static void OnDeleteFile(NktHook hook, NktProcess process, NktHookCallInfo callInfo)
        {
            APIUnit report = Base(APIType.Simple, APICategory.Simple, APIID.DeleteFile, hook, process, callInfo);

            if (report == null)
            {
                return;
            }
            var param = new DeleteFileParameter();

            param.File       = callInfo.Params().GetAt(0).ReadString();
            report.Parameter = param;
            Reports.Enqueue(report);
        }
Exemplo n.º 5
0
 public Task DeleteFile(DeleteFileParameter parameter)
 {
     return(SendAsync(parameter));
 }
Exemplo n.º 6
0
 public DeleteFileResult DeleteFile(DeleteFileParameter deleteFileParam)
 {
     throw new Exception("The method or operation is not implemented.");
 }