protected override void ProcessRecord()
        {
            ResumeSupport = new Resume.ResumeSupport();
            FileSupport   = new FileSupport(MarkFileStatus);

            if (ResumeSupport.IsPending)
            {
                Logger.Instance.Info("Last command wasn't successful due to discconnection.");

                Console.Write("Last command wasn't successful due to discconnection, enter 'y' to complete or any other key to ignore: ");
                String userOption = Console.ReadLine();

                if (userOption.ToLower().Equals("y"))
                {
                    Logger.Instance.Info("Copying those files which were missed due to discconnection with following parameters. Source Path:{0} Destination:{1} Forced:{2} Details:{3}",
                                         String.Join(",", ResumeSupport.GetPath), ResumeSupport.GetDestination, ResumeSupport.GetForce, ResumeSupport.GetDetails);

                    StartCopying(ResumeSupport.GetPath, ResumeSupport.GetDestination, ResumeSupport.GetForce, ResumeSupport.GetDetails);

                    Logger.Instance.Info("Copying operation completed for missing files");
                    ResumeSupport.End();
                    Console.Write("Last command completed, starting current operation");
                }
            }

            Logger.Instance.Info(String.Format("Starting Copy Operation with following parameters. Source Path:{0} Destination:{1} Forced:{2} Details:{3}",
                                               String.Join(",", Path), Destination, Force, Details));
            ResumeSupport.Start(Path, Destination, Force, Details);

            StartCopying(Path, Destination, Force, Details);

            ResumeSupport.End();
            Logger.Instance.Info("Command executed successfully");
            WriteObject("Files copied successfully");
        }
Esempio n. 2
0
        protected override void ProcessRecord()
        {
            ResumeSupport = new Resume.ResumeSupport();
            FileSupport   = new FileSupport(MarkFileStatus);

            if (Resume)
            {
                if (ResumeSupport.IsPending)
                {
                    Logger.Instance.Info("Last command wasn't successful due to discconnection.");

                    WriteObject("Last command wasn't successful due to discconnection, enter 'y' to complete or any other key to ignore: ");
                    Collection <PSObject> result = InvokeCommand.InvokeScript("Read-Host");
                    string userOption            = result != null && result.Count > 0 ? result[0].ToString() : string.Empty;

                    if (userOption.ToLower().Equals("y"))
                    {
                        Logger.Instance.Info("Copying those files which were missed due to discconnection with following parameters. Source Path:{0} Destination:{1} Forced:{2} Details:{3}",
                                             String.Join(",", ResumeSupport.GetPath), ResumeSupport.GetDestination, ResumeSupport.GetForce, ResumeSupport.GetDetails);

                        StartCopying(ResumeSupport.GetPath, ResumeSupport.GetDestination, ResumeSupport.GetForce, ResumeSupport.GetDetails);

                        Logger.Instance.Info("Copying operation completed for missing files");
                        ResumeSupport.End();
                        WriteObject("Last command completed, starting current operation");
                    }
                }
            }
            else
            {
                ResumeSupport.UnmarkResumeFlag();
            }

            Logger.Instance.Info(String.Format("Starting Copy Operation with following parameters. Source Path:{0} Destination:{1} Forced:{2} Details:{3}",
                                               String.Join(",", Path), Destination, Force, Details));

            if (Resume)
            {
                ResumeSupport.Start(Path, Destination, Force, Details);
            }

            StartCopying(Path, Destination.Trim(), Force, Details);
            Thread.Sleep(100);

            if (Resume)
            {
                ResumeSupport.End();
            }

            WriteObject("Files copied successfully");
        }
        protected override void ProcessRecord()
        {
            ResumeSupport = new Resume.ResumeSupport();
            FileSupport = new FileSupport(MarkFileStatus);

            if (Resume)
            {
                if (ResumeSupport.IsPending)
                {
                    Logger.Instance.Info("Last command wasn't successful due to discconnection.");

                    WriteObject("Last command wasn't successful due to discconnection, enter 'y' to complete or any other key to ignore: ");
                    Collection<PSObject> result = InvokeCommand.InvokeScript("Read-Host");
                    string userOption = result != null && result.Count > 0 ? result[0].ToString() : string.Empty;

                    if (userOption.ToLower().Equals("y"))
                    {
                        Logger.Instance.Info("Copying those files which were missed due to discconnection with following parameters. Source Path:{0} Destination:{1} Forced:{2} Details:{3}",
                            String.Join(",", ResumeSupport.GetPath), ResumeSupport.GetDestination, ResumeSupport.GetForce, ResumeSupport.GetDetails);

                        StartCopying(ResumeSupport.GetPath, ResumeSupport.GetDestination, ResumeSupport.GetForce, ResumeSupport.GetDetails);

                        Logger.Instance.Info("Copying operation completed for missing files");
                        ResumeSupport.End();
                        WriteObject("Last command completed, starting current operation");
                    }
                }
            }
            else
            {
                ResumeSupport.UnmarkResumeFlag();
            }

            Logger.Instance.Info(String.Format("Starting Copy Operation with following parameters. Source Path:{0} Destination:{1} Forced:{2} Details:{3}",
                String.Join(",", Path), Destination, Force, Details));

            if (Resume) ResumeSupport.Start(Path, Destination, Force, Details);
            
            StartCopying(Path, Destination.Trim(), Force, Details);
            Thread.Sleep(100);

            if (Resume) ResumeSupport.End();

            WriteObject("Files copied successfully");
        }