public TaskFile Inicial(string pathToDB, string pathByFile) { //копирование файла в директорию загрузки ресурсов БД if (!Directory.Exists(Path.Combine(pathToDB, "Resources"))) { Directory.CreateDirectory(Path.Combine(pathToDB, "Resources")); } if (!File.Exists(Path.Combine(pathToDB, "Resources", this.StoreName)) && File.Exists(pathByFile)) { this.State = StateFile.Load; System.Threading.Tasks.Task.Factory.StartNew(() => { CopyEx.Copy(pathByFile, Path.Combine(pathToDB, "Resources", StoreName), true, true, (d, pce) => { Progress = pce.ProgressPercentage; }); this.State = StateFile.Exists; }); } return(this); }
protected override void OnExecute(BackgroundWorker backgroundWorker) { this.backgroundWorker = backgroundWorker; CopyEx.Copy(SharedData.Instance.ArchiveFileName, FileName, false, OnCopyProgress); }