예제 #1
0
        public override void Work(FileOperation job)
        {
            File.Delete(job.Source);

            string dir = job.Source;
            while (!string.IsNullOrEmpty(dir = Path.GetDirectoryName(dir)))
            {
                if ((Directory.GetFiles(dir).Length == 0) && (Directory.GetDirectories(dir).Length == 0))
                    Directory.Delete(dir);
                else
                    break;
            }
        }
예제 #2
0
        public override void Work(FileOperation job)
        {
            Directory.CreateDirectory(Path.GetDirectoryName(job.Destination));
            if(File.Exists(job.Destination))
            {
                // Check if the sizes are the same and skip copying if it is.
                FileInfo srcInfo = new FileInfo(job.Source);
                FileInfo destInfo = new FileInfo(job.Destination);

                if (srcInfo.Length == destInfo.Length) return;
            }

            File.Copy(job.Source, job.Destination, true);
        }
예제 #3
0
 public abstract void Work(FileOperation job);
 public FileOperationEventArgs(int progress, FileOperation job)
 {
     this.Progress = progress;
     this.Job = job;
 }