/// <summary> /// /// </summary> /// <param name="index">Used to check if must start in this files index or in index + 1</param> public void Skip(int index) { try { //if (State == CopyHandleState.Runing && FileCopier.Writer != null) //{ myThread.Pause(); //If there is any file in copy process then stop copy, //free resources and delete the file with Cancel method. if (FileCopier.CurrentFile != null) { FileCopier.CurrentFile.CopyState = CopyState.Skiped; FileCopier.Skip(); } //Terminate the copy process myThread.Cancel(); myThread = new MyThread(new Action(() => { if (Operation != null) { Operation.Invoke(); RaiseFinished(Errors); Errors.Clear(); } })); if (DiscoverdList.Index == index) { DiscoverdList.Index++; CopiedsFiles++; } myThread.Start(); //} } catch (Exception ex) { MessageBox.Show(Error.GetErrorLog(ex.Message, "NeathCopyEngine", "NeathCopyHandle", "Skip")); using (var w = new StreamWriter(new FileStream(logsPath, FileMode.Append, FileAccess.Write))) { w.WriteLine("-------------------------------"); w.WriteLine(System.DateTime.Now); w.WriteLine(Error.GetErrorLogInLine(ex.Message, "NeathCopyEngine", "NeathCopyHandle", "Skip")); } } }