Beispiel #1
0
            public ConvertedOperation <DeleteFilesOperation> ConvertActionToOperation(DeleteFilesAction action, IActionConverterContext context)
            {
                var masks = context.ConvertLegacyMask(action.FileMasks, action.Recursive);

                return(new DeleteFilesOperation
                {
                    Includes = masks.Includes,
                    Excludes = masks.Excludes,
                    SourceDirectory = context.ConvertLegacyExpression(AH.NullIf(action.OverriddenSourceDirectory, string.Empty)),
                    VerboseLogging = action.LogVerbose
                });
            }
Beispiel #2
0
            public ConvertedOperation <CopyFilesOperation> ConvertActionToOperation(CopyFilesAction action, IActionConverterContext context)
            {
                var masks = context.ConvertLegacyMask(action.IncludeFileMasks, action.Recursive);

                return(new CopyFilesOperation
                {
                    SourceDirectory = context.ConvertLegacyExpression(action.OverriddenSourceDirectory),
                    TargetDirectory = context.ConvertLegacyExpression(action.OverriddenTargetDirectory),
                    Includes = masks.Includes,
                    Excludes = masks.Excludes,
                    Overwrite = action.Overwrite,
                    VerboseLogging = action.VerboseLogging
                });
            }
Beispiel #3
0
            public ConvertedOperation <ReplaceFileTextOperation> ConvertActionToOperation(ReplaceFileAction action, IActionConverterContext context)
            {
                var mask = context.ConvertLegacyMask(action.FileNameMasks, action.Recursive);

                return(new ReplaceFileTextOperation
                {
                    Includes = mask.Includes,
                    Excludes = mask.Excludes,
                    SearchText = context.ConvertLegacyExpression(action.SearchText),
                    ReplaceText = context.ConvertLegacyExpression(action.ReplaceText),
                    UseRegex = action.UseRegex,
                    SourceDirectory = AH.NullIf(context.ConvertLegacyExpression(action.OverriddenSourceDirectory), string.Empty)
                });
            }
Beispiel #4
0
            public ConvertedOperation <SetFileAttributesOperation> ConvertActionToOperation(SetFileAttributesAction action, IActionConverterContext context)
            {
                var mask = context.ConvertLegacyMask(action.FileMasks, action.Recursive);

                return(new SetFileAttributesOperation
                {
                    Includes = mask.Includes,
                    Excludes = mask.Excludes,
                    VerboseLogging = true,
                    SourceDirectory = AH.NullIf(context.ConvertLegacyExpression(action.OverriddenTargetDirectory), string.Empty),
                    ReadOnly = action.ReadOnly,
                    Hidden = action.Hidden,
                    System = action.System
                });
            }
Beispiel #5
0
            public ConvertedOperation <TransferFilesOperation> ConvertActionToOperation(TransferFilesAction action, IActionConverterContext context)
            {
                var masks = context.ConvertLegacyMask(action.IncludeFileMasks, true);

                var actionConfigProp = context.GetType().GetProperty("ActionConfig", BindingFlags.NonPublic | BindingFlags.Instance);
                var actionConfig     = (Tables.ActionGroupActions_Extended)actionConfigProp.GetValue(context);

                return(new TransferFilesOperation
                {
                    SourceDirectory = context.ConvertLegacyExpression(AH.CoalesceString(action.SourceDirectory, "$WorkingDirectory")),
                    TargetDirectory = context.ConvertLegacyExpression(action.TargetDirectory),
                    DeleteTarget = action.DeleteTarget,
                    Includes = masks.Includes,
                    Excludes = masks.Excludes,
                    SourceServerName = context.ActionServerName,
                    TargetServerName = MungeName(context, actionConfig.Target_Server_Name, actionConfig.Target_Server_Variable_Name)
                });
            }
Beispiel #6
0
            public ConvertedOperation <ConcatenateFilesOperation> ConvertActionToOperation(ConcatenateFilesAction action, IActionConverterContext context)
            {
                var masks     = context.ConvertLegacyMask(action.FileMasks, action.Recursive);
                var separator = AH.NullIf(context.ConvertLegacyExpression(action.ContentSeparationText), string.Empty);

                if (!string.IsNullOrEmpty(separator))
                {
                    separator = Regex.Replace(separator, @"\r?\n", action.ForceLinuxNewlines ? "${LinuxNewLine}" : "${NewLine}");
                }

                return(new ConcatenateFilesOperation
                {
                    Includes = masks.Includes,
                    Excludes = masks.Excludes,
                    ContentSeparationText = separator,
                    OutputFile = context.ConvertLegacyExpression(PathEx.Combine(action.OverriddenTargetDirectory, action.OutputFile)),
                    OutputFileEncoding = context.ConvertLegacyExpression(action.OutputFileEncoding),
                    SourceDirectory = context.ConvertLegacyExpression(AH.NullIf(action.OverriddenSourceDirectory, string.Empty))
                });
            }