Exemplo n.º 1
0
        protected override bool _Run()
        {
            try
            {
                string address = Authentication.NextAddress(ServerAddress);

                if (address == null)
                {
                    Exception ex = new Exception("No valid address. (" + ServerAddress + ")");
                    Exceptions.Add(ex);
                    AppendToMessage(ex.Message);
                    return(false);
                }

                Surge.FailureAction tgtAction = DirectoryNotExistsAction;

                FtpClient conn = Authentication.OpenClient(address, Int32.Parse(Port));

                try
                {
                    if (conn.DirectoryExists(Authentication.AdjustPath(address, DirectoryName)))
                    {
                        tgtAction = DirectoryExistsAction;
                    }

                    switch (tgtAction)
                    {
                    case Surge.FailureAction.SkipRemaining:

                        SkipRemaining();
                        break;

                    case Surge.FailureAction.Rollback:

                        RollbackAllPreceedingAndSkipRemaining();
                        break;

                    case Surge.FailureAction.Continue:

                        break;

                    case Surge.FailureAction.SkipToLabel:

                        SkipForwardToFlowControlLabel(TargetLabel);
                        break;
                    }
                }
                finally
                {
                    Authentication.RecycleClient(conn);
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
Exemplo n.º 2
0
        protected override bool _Run()
        {
            try
            {
                PostMortemMetaData["LastOperation"] = "NextAddress";
                string address = Authentication.NextAddress(ServerAddress);

                if (address == null)
                {
                    Exception ex = new Exception("No valid address. (" + ServerAddress + ")");
                    Exceptions.Add(ex);
                    AppendToMessage(ex.Message);
                    return(false);
                }

                Surge.FailureAction tgtAction = FileNotExistsAction;

                PostMortemMetaData["LastOperation"] = "FileExists";
                if (Authentication.FileExists(address, Int32.Parse(Port), FileName))
                {
                    tgtAction = FileExistsAction;
                }

                switch (tgtAction)
                {
                case Surge.FailureAction.SkipRemaining:

                    SkipRemaining();
                    break;

                case Surge.FailureAction.SkipNext:

                    SkipNext();
                    break;

                case Surge.FailureAction.Rollback:

                    RollbackAllPreceedingAndSkipRemaining();
                    break;

                case Surge.FailureAction.Continue:

                    break;

                case Surge.FailureAction.SkipToLabel:

                    SkipForwardToFlowControlLabel(TargetLabel);
                    break;
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
Exemplo n.º 3
0
        protected override bool _Run()
        {
            try
            {
                if (InstructionSet.InstructionSetContainer.ContainsKey(Authentication.ConfigurationName + ".SshClientAddress"))
                {
                    InstructionSet.InstructionSetContainer[Authentication.ConfigurationName + ".SshClientAddress"] = Authentication.TargetAddress((string)InstructionSet.InstructionSetContainer[Authentication.ConfigurationName + ".SshClientAddress"]);
                }
                else
                {
                    InstructionSet.InstructionSetContainer[Authentication.ConfigurationName + ".SshClientAddress"] = Authentication.TargetAddress(null);
                }

                Surge.FailureAction tgtAction = FileNotExistsAction;

                if (Authentication.FileExists(FileName))
                {
                    tgtAction = FileExistsAction;
                }

                switch (tgtAction)
                {
                case Surge.FailureAction.SkipRemaining:

                    SkipRemaining();
                    break;

                case Surge.FailureAction.SkipNext:

                    SkipNext();
                    break;

                case Surge.FailureAction.Rollback:

                    RollbackAllPreceedingAndSkipRemaining();
                    break;

                case Surge.FailureAction.Continue:

                    break;

                case Surge.FailureAction.SkipToLabel:

                    SkipForwardToFlowControlLabel(TargetLabel);
                    break;
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
        protected override bool _Run()
        {
            try
            {
                bool isWindows = STEM.Sys.Control.IsWindows;

                Surge.FailureAction tgtAction = ActionIfNotMatch;

                if (isWindows && OS == OSType.Windows)
                {
                    tgtAction = ActionIfMatch;
                }

                if (!isWindows && OS == OSType.Linux)
                {
                    tgtAction = ActionIfMatch;
                }

                switch (tgtAction)
                {
                case Surge.FailureAction.SkipRemaining:

                    SkipRemaining();
                    break;

                case Surge.FailureAction.SkipNext:

                    SkipNext();
                    break;

                case Surge.FailureAction.Rollback:

                    RollbackAllPreceedingAndSkipRemaining();
                    break;

                case Surge.FailureAction.Continue:

                    break;

                case Surge.FailureAction.SkipToLabel:

                    SkipForwardToFlowControlLabel(TargetLabel);
                    break;
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
        protected override bool _Run()
        {
            try
            {
                Surge.FailureAction tgtAction = DirectoryNotExistsAction;

                if (Authentication.DirectoryExists(DirectoryName))
                {
                    tgtAction = DirectoryExistsAction;
                }

                switch (tgtAction)
                {
                case Surge.FailureAction.SkipRemaining:

                    SkipRemaining();
                    break;

                case Surge.FailureAction.SkipNext:

                    SkipNext();
                    break;

                case Surge.FailureAction.Rollback:

                    RollbackAllPreceedingAndSkipRemaining();
                    break;

                case Surge.FailureAction.Continue:

                    break;

                case Surge.FailureAction.SkipToLabel:

                    SkipForwardToFlowControlLabel(TargetLabel);
                    break;
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
Exemplo n.º 6
0
        protected override bool _Run()
        {
            FileName = STEM.Sys.IO.Path.AdjustPath(FileName);
            try
            {
                Surge.FailureAction tgtAction = FileNotExistsAction;
                if (File.Exists(FileName))
                {
                    tgtAction = FileExistsAction;
                }

                switch (tgtAction)
                {
                case Surge.FailureAction.SkipRemaining:

                    SkipRemaining();
                    break;

                case Surge.FailureAction.SkipNext:

                    SkipNext();
                    break;

                case Surge.FailureAction.Rollback:

                    RollbackAllPreceedingAndSkipRemaining();
                    break;

                case Surge.FailureAction.Continue:

                    break;

                case Surge.FailureAction.SkipToLabel:

                    SkipForwardToFlowControlLabel(TargetLabel);
                    break;
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }