示例#1
0
        private IDecorationConditionArgs BuildServiceRunning(ServiceRunningConditionXml serviceRunning)
        {
            var scalarHelper = new ScalarHelper(serviceLocator, new Context(variables));

            return(new RunningArgs(
                       scalarHelper.InstantiateResolver <string>(serviceRunning.ServiceName)
                       , scalarHelper.InstantiateResolver <int>(serviceRunning.TimeOut)
                       ));
        }
示例#2
0
        private IDecorationConditionArgs BuildCustomCondition(CustomConditionXml custom)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));

            return(new CustomConditionArgs(
                       helper.InstantiateResolver <string>(custom.AssemblyPath),
                       helper.InstantiateResolver <string>(custom.TypeName),
                       custom.Parameters.ToDictionary(x => x.Name, y => helper.InstantiateResolver <object>(y.StringValue) as IScalarResolver)
                       ));
        }
示例#3
0
        private IDecorationConditionArgs BuildFolderExists(FolderExistsConditionXml folderExists)
        {
            var scalarHelper = new ScalarHelper(serviceLocator, new Context(variables));

            return(new FolderExistsConditionArgs(
                       serviceLocator.BasePath
                       , scalarHelper.InstantiateResolver <string>(folderExists.Path)
                       , scalarHelper.InstantiateResolver <string>(folderExists.Name)
                       , scalarHelper.InstantiateResolver <bool>(folderExists.NotEmpty)
                       ));
        }
示例#4
0
        private IStopCommandArgs BuildProcessStop(ServiceStopXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                ServiceName = helper.InstantiateResolver <string>(xml.ServiceName),
                TimeOut     = helper.InstantiateResolver <int>(xml.TimeOut),
            };

            return(args.ActLike <IStopCommandArgs>());
        }
示例#5
0
        private ICustomCommandArgs BuildProcessCustom(CustomCommandXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                AssemblyPath = helper.InstantiateResolver <string>(xml.AssemblyPath),
                TypeName     = helper.InstantiateResolver <string>(xml.TypeName),
                Parameters   = xml.Parameters.ToDictionary(x => x.Name, y => helper.InstantiateResolver <object>(y.StringValue)),
            };

            return(args.ActLike <ICustomCommandArgs>());
        }
示例#6
0
        private IDeleteExtensionCommandArgs BuildIoDeleteExtension(FileDeleteExtensionXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                Path      = helper.InstantiateResolver <string>(xml.Path),
                Extension = helper.InstantiateResolver <string>(xml.Extension),
                xml.Settings?.BasePath
            };

            return(args.ActLike <IDeleteExtensionCommandArgs>());
        }
示例#7
0
        private ILoadCommandArgs BuildDataEngineeringTableLoad(TableLoadXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                TableName = helper.InstantiateResolver <string>(xml.TableName),
                FileName  = helper.InstantiateResolver <string>(xml.InternalFileName),
                xml.ConnectionString
            };

            return(args.ActLike <ILoadCommandArgs>());
        }
示例#8
0
        private IEtlRunCommandArgs BuildDataEngineeringEtlRun(EtlRunXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                Name    = helper.InstantiateResolver <string>(xml.Name),
                Path    = helper.InstantiateResolver <string>(xml.Path),
                Version = helper.InstantiateResolver <string>(xml.Version),
            };

            return(args.ActLike <IEtlRunCommandArgs>());
        }
示例#9
0
        private ICopyPatternCommandArgs BuildIoCopyPattern(FileCopyPatternXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                SourcePath      = helper.InstantiateResolver <string>(xml.SourcePath),
                DestinationPath = helper.InstantiateResolver <string>(xml.DestinationPath),
                Pattern         = helper.InstantiateResolver <string>(xml.Pattern),
                xml.Settings?.BasePath
            };

            return(args.ActLike <ICopyPatternCommandArgs>());
        }
示例#10
0
        private ISequenceResolverArgs BuildSentinelLoopResolverArgs <T, U>(string seed, string terminal, string step, IntervalMode intervalMode)
        {
            var helper = new ScalarHelper(serviceLocator, globalVariables);

            var args = new SentinelLoopSequenceResolverArgs <T, U>(
                helper.InstantiateResolver <T>(seed).Execute(),
                helper.InstantiateResolver <T>(terminal).Execute(),
                helper.InstantiateResolver <U>(step).Execute(),
                intervalMode
                );

            return(args);
        }
示例#11
0
        private IBatchRunCommandArgs BuildDataEngineeringBatchRun(SqlRunXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                Name = helper.InstantiateResolver <string>(xml.Name),
                Path = helper.InstantiateResolver <string>(xml.Path),
                xml.Settings?.BasePath,
                Version = helper.InstantiateResolver <string>(xml.Version),
                xml.ConnectionString,
            };

            return(args.ActLike <IBatchRunCommandArgs>());
        }
示例#12
0
        private IRunCommandArgs BuildProcessRun(ExeRunXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                Name = helper.InstantiateResolver <string>(xml.Name),
                Path = helper.InstantiateResolver <string>(xml.Path),
                xml.Settings?.BasePath,
                Argument = helper.InstantiateResolver <string>(xml.Argument),
                TimeOut  = helper.InstantiateResolver <int>(xml.TimeOut),
            };

            return(args.ActLike <IRunCommandArgs>());
        }
示例#13
0
        private IWaitCommandArgs BuildProcessWait(WaitXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                MilliSeconds = helper.InstantiateResolver <int>(xml.MilliSeconds),
            };

            return(args.ActLike <IWaitCommandArgs>());
        }
示例#14
0
        private IKillCommandArgs BuildProcessKill(ExeKillXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                ProcessName = helper.InstantiateResolver <string>(xml.ProcessName),
            };

            return(args.ActLike <IKillCommandArgs>());
        }
示例#15
0
        private IConnectionWaitCommandArgs BuildDataEngineeringConnectionWait(ConnectionWaitXml xml)
        {
            var helper = new ScalarHelper(serviceLocator, new Context(variables));
            var args   = new
            {
                xml.ConnectionString,
                Version = helper.InstantiateResolver <int>(xml.TimeOut),
            };

            return(args.ActLike <IConnectionWaitCommandArgs>());
        }
示例#16
0
        public void Build()
        {
            if (!isSetup)
            {
                throw new InvalidOperationException();
            }

            if (obj is SentinelLoopXml)
            {
                var loop = obj as SentinelLoopXml;
                switch (columnType)
                {
                case ColumnType.Numeric:
                    args = BuildSentinelLoopResolverArgs <decimal, decimal>(loop.Seed, loop.Terminal, loop.Step, loop.IntervalMode);
                    break;

                case ColumnType.DateTime:
                    args = BuildSentinelLoopResolverArgs <DateTime, IDuration>(loop.Seed, loop.Terminal, loop.Step, loop.IntervalMode);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            else if (obj is List <string> )
            {
                var helper    = new ScalarHelper(serviceLocator, globalVariables);
                var resolvers = new List <IScalarResolver>();
                foreach (var value in obj as List <string> )
                {
                    resolvers.Add(helper.InstantiateResolver <string>(value));
                }
                args = new ListSequenceResolverArgs(resolvers);
            }

            if (args == null)
            {
                throw new ArgumentException();
            }
        }