Ejemplo n.º 1
0
        //public override Task Run()
        //{

        //}
        public override void RunSub(ICloneable _threadParameter)
        {
            JudgeTaskCancelFlag();
            //Thread.Sleep(1000);
            CopyFileParameter param           = (CopyFileParameter)_threadParameter;
            DirectoryInfo     originalFold    = new DirectoryInfo(param.OriginalDirectory);
            DirectoryInfo     destinationFold = new DirectoryInfo(param.OutoutDirectoy);

            log.Log(originalFold.Name + "\t" + originalFold.GetFiles().Length.ToString() + "\t" + param.OutoutDirectoy + "\\" + originalFold.Name);


            if (!System.IO.Directory.Exists(param.OutoutDirectoy + "\\" + originalFold.Name))
            {
                System.IO.Directory.CreateDirectory(param.OutoutDirectoy + "\\" + originalFold.Name);
                //log.Log("Created [" + param.OutoutDirectoy + "\\" + originalFold.Name + "]");
            }
            foreach (DirectoryInfo dir in originalFold.GetDirectories())
            {
                //if (token.IsCancellationRequested)
                //{
                //    // Clean up here, then...
                //    log.DeleteLog(1);
                //    log.LogTaskCancel(this.GetType().Name);
                //    //this.BeginInvoke(new SetbuttonStatus(SetLibreOfficeButtonStatus), new object[] { true });
                //    token.ThrowIfCancellationRequested();
                //}
                JudgeTaskCancelFlag();
                CopyFileParameter subparam = (CopyFileParameter)param.Clone();
                subparam.OriginalDirectory = dir.FullName;
                subparam.OutoutDirectoy    = param.OutoutDirectoy + "\\" + originalFold.Name;
                RunSub(subparam);
            }
        }
Ejemplo n.º 2
0
        static void OnCopyFile(NktHook hook, NktProcess process, NktHookCallInfo callInfo)
        {
            APIUnit report = Base(APIType.Simple, APICategory.Simple, APIID.CopyFile, hook, process, callInfo);

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

            param.From       = callInfo.Params().GetAt(0).ReadString();
            param.To         = callInfo.Params().GetAt(1).ReadString();
            report.Parameter = param;
            Reports.Enqueue(report);
        }
Ejemplo n.º 3
0
 private async void BtnCopyFolder_Click(object sender, EventArgs e)
 {
     try
     {
         this.SetFolderButtonStatus(false);
         StartNewTask();
         CopyFileParameter param = new CopyFileParameter();
         param.OutoutDirectoy    = this.lbDestination.Text.Trim();
         param.OriginalDirectory = this.lbOriginal.Text.Trim();
         CopyFolder copyThreading = new CopyFolder(this.log, this.tokenSource, param);
         task = copyThreading.Run();
         await task;
         //
     }
     catch (Exception ex) {
         log.RecordError(ex.Message);
         //this.SetFolderButtonStatus(true);
     }
     finally
     {
         this.SetFolderButtonStatus(true);
     }
 }