Example #1
0
            /// <summary>
            /// Executes the activity and returns the data necessary to execute putty (executable + arguments)
            /// </summary>
            /// <param name="context">The context</param>
            protected override void Execute(CodeActivityContext context)
            {
                var toolsPath = PuttyHelper.GetPuttyPath(this.ToolsPath.Get(context));

                if (string.IsNullOrEmpty(toolsPath))
                {
                    context.TrackBuildWarning("can't determine PuTTy tools path. Will rely on path");
                    toolsPath = string.Empty;
                }

                this.ToolCommandPath.Set(context, Path.Combine(toolsPath, "plink.exe"));
                this.Arguments.Set(context, this.GenerateCommandLineCommands(context));
            }
Example #2
0
            /// <summary>
            /// Generate the command line arguments to be passed plink
            /// <para></para>
            /// If the user hasn't specified an output FileName we will generate a log
            /// file name with the project name (using the appropriate configuration/platform settings)
            /// and store it on the logs folder in the drops directory
            /// </summary>
            /// <param name="context">Activity context</param>
            /// <returns>The command line arguments</returns>
            private string GenerateCommandLineCommands(ActivityContext context)
            {
                var auth          = this.Authentication.Get(context);
                var port          = this.Port.Get(context);
                var host          = this.Host.Get(context);
                var portParameter = string.Empty;

                if (port > 0)
                {
                    portParameter = string.Format("-P {0}", port);
                }

                return(string.Format(
                           "{0} -ssh -batch -noagent {1} {2} {3}",
                           PuttyHelper.GetAuthenticationParameters(auth),
                           portParameter,
                           host,
                           this.Command.Get(context)));
            }
            /// <summary>
            /// Generate the command line arguments to be passed plink
            /// <para></para>
            /// If the user hasn't specified an output FileName we will generate a log
            /// file name with the project name (using the appropriate configuration/platform settings)
            /// and store it on the logs folder in the drops directory
            /// </summary>
            /// <param name="context">Activity context</param>
            /// <returns>The command line arguments</returns>
            private string GenerateCommandLineCommands(ActivityContext context)
            {
                var auth          = this.Authentication.Get(context);
                var port          = this.Port.Get(context);
                var portParameter = string.Empty;

                if (port > 0)
                {
                    portParameter = string.Format("-P {0}", port);
                }

                return(string.Format(
                           "{0} -{1} {2} {3} {4} {5} -batch -noagent {6} {7} {8}",
                           PuttyHelper.GetAuthenticationParameters(auth),
                           this.Protocol.Get(context),
                           GetStringIfTrue(this.Unsafe, context, "-unsafe"),
                           GetStringIfTrue(this.EnableCompression, context, "-C"),
                           GetStringIfTrue(this.Recursively, context, "-r"),
                           GetStringIfTrue(this.PreserveFileAttributes, context, "-p"),
                           portParameter,
                           this.Source.Get(context),
                           this.Target.Get(context)));
            }